MD5 校验值:d967c90bd4fc5aa328060de26be5b56a
AppLovinBridge.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.safedk.android.analytics; import android.content.Context; import android.os.Bundle; import android.text.TextUtils; import com.applovin.communicator.AppLovinCommunicator; import com.applovin.communicator.AppLovinCommunicatorMessage; import com.applovin.communicator.AppLovinCommunicatorPublisher; import com.applovin.communicator.AppLovinCommunicatorSubscriber; import com.safedk.android.SafeDK; import com.safedk.android.analytics.reporters.CrashReporter; import com.safedk.android.utils.Logger; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; public class AppLovinBridge { private static Context B = null; public static final String a = "SafeDK"; public static final String b = "v1/events"; public static final String c = "v1/image_uploaded"; public static final String d = "v1/resolved"; public static final String e = "platform"; public static final String f = "package"; public static final String g = "android"; public static final String h = "body"; private static final String j = "AppLovinBridge"; private static final String k = "max_ad_events"; private static final String l = "safedk_init"; private static final String m = "send_http_request"; private static final String n = "receive_http_response"; private static final String o = "url"; private static final String p = "backup_url"; private static final String q = "post_body"; private static final String r = "report"; private static final String s = "metadata"; private static final String t = "events"; private static String u = "https://edge.safedk.com/v1/events"; private static String v = "https://edge.safedk.com/v1/events"; private static String w = "https://edge.safedk.com/v1/image_uploaded"; private static String x = "https://edge.safedk.com/v1/image_uploaded"; private static String y = "https://edge.safedk.com/v1/resolved"; private static String z = "https://edge.safedk.com/v1/resolved"; private static HashMap<String, ArrayList<b>> A = new HashMap<>(); static AppLovinCommunicatorSubscriber i = new AppLovinCommunicatorSubscriber() { @Override public void onMessageReceived(AppLovinCommunicatorMessage message) { Logger.d(AppLovinBridge.j, "Response received " + message.getMessageData() + ", topic=" + message.getTopic() + ", url=" + message.getMessageData().getString("url")); Bundle messageData = message.getMessageData(); String string = message.getMessageData().getString("url"); if (string.endsWith(AppLovinBridge.b)) { AppLovinBridge.b(AppLovinBridge.b, messageData.getBundle(AppLovinBridge.h)); } else if (string.endsWith(AppLovinBridge.c)) { AppLovinBridge.b(AppLovinBridge.c, messageData.getBundle(AppLovinBridge.h)); } else if (string.endsWith(AppLovinBridge.d)) { AppLovinBridge.b(AppLovinBridge.d, messageData.getBundle(AppLovinBridge.h)); } } @Override public String getCommunicatorId() { return AppLovinBridge.a; } }; public static void init(Context context) { B = context; registerToReceiveResponse(i); } public static void receiveEdgeUrls(String url, String backupUrl) { Logger.d(j, "receiveEdgeUrls url=" + url + ", backupUrl=" + backupUrl); if (!TextUtils.isEmpty(url)) { u = url + "/" + b; Logger.d(j, "receiveEdgeUrls edgeBrandSafetyReportUrl updated to " + u); w = url + "/" + c; Logger.d(j, "receiveEdgeUrls ImageUploadedUrl updated to " + w); y = url + "/" + d; Logger.d(j, "receiveEdgeUrls resolvedUrl updated to " + y); } if (!TextUtils.isEmpty(backupUrl)) { v = backupUrl + "/" + b; Logger.d(j, "Backup edgeBackupBrandSafetyReportUrl updated to " + v); x = backupUrl + "/" + c; Logger.d(j, "Backup ImageUploadedUrl updated to " + x); z = backupUrl + "/" + d; Logger.d(j, "Backup resolvedUrl updated to " + z); } } public static void a(ArrayList<Bundle> arrayList, AppLovinCommunicatorPublisher appLovinCommunicatorPublisher) { Logger.d(j, "reportEvents start " + arrayList.size() + " events. edgeUrl=" + u + ", events : " + arrayList.toString()); Bundle bundle = new Bundle(); bundle.putString("url", u); bundle.putString(p, v); Bundle bundle2 = new Bundle(); bundle2.putBundle(s, SafeDK.getInstance().n().e()); bundle2.putParcelableArrayList("events", arrayList); Bundle bundle3 = new Bundle(); bundle3.putBundle("report", bundle2); bundle.putBundle(q, bundle3); AppLovinCommunicatorMessage appLovinCommunicatorMessage = new AppLovinCommunicatorMessage(bundle, m, appLovinCommunicatorPublisher); AppLovinCommunicator appLovinCommunicator = AppLovinCommunicator.getInstance(B); Logger.d(j, "publishing message with " + arrayList.size() + " events"); appLovinCommunicator.getMessagingService().publish(appLovinCommunicatorMessage); } public static void reportImageUploadEvent(Bundle data, AppLovinCommunicatorPublisher callback) { Logger.d(j, "reportImageUploadEvent start. Data=" + data.toString()); Bundle bundle = new Bundle(); bundle.putString("url", w); bundle.putString(p, x); bundle.putBundle(q, data); AppLovinCommunicatorMessage appLovinCommunicatorMessage = new AppLovinCommunicatorMessage(bundle, m, callback); AppLovinCommunicator appLovinCommunicator = AppLovinCommunicator.getInstance(B); Logger.d(j, "publishing message. body=" + data.toString()); appLovinCommunicator.getMessagingService().publish(appLovinCommunicatorMessage); } public static void reportClickUrlResolvedEvent(Bundle data, AppLovinCommunicatorPublisher callback) { Logger.d(j, "reportClickUrlResolvedEvent start"); Bundle bundle = new Bundle(); bundle.putString("url", y); bundle.putString(p, z); bundle.putBundle(q, data); AppLovinCommunicatorMessage appLovinCommunicatorMessage = new AppLovinCommunicatorMessage(bundle, m, callback); AppLovinCommunicator appLovinCommunicator = AppLovinCommunicator.getInstance(B); Logger.d(j, "publishing message"); appLovinCommunicator.getMessagingService().publish(appLovinCommunicatorMessage); } public static void registerToReceiveMaxEvents(AppLovinCommunicatorSubscriber subscriber) { a(subscriber, k); } public static void registerToReceiveResponse(AppLovinCommunicatorSubscriber subscriber) { a(subscriber, n); } public static void registerToReceiveSafeDKSettings(AppLovinCommunicatorSubscriber subscriber) { a(subscriber, l); } private static void a(AppLovinCommunicatorSubscriber appLovinCommunicatorSubscriber, String str) { AppLovinCommunicator.getInstance(B).subscribe(appLovinCommunicatorSubscriber, Arrays.asList(str)); } public static void registerListener(String requestName, b listener) { try { Logger.d(j, "registerListener started, requestName=" + requestName); if (!A.containsKey(requestName)) { Logger.d(j, "registerListener listener list created for requestName=" + requestName); A.put(requestName, new ArrayList<>()); } ArrayList<b> arrayList = A.get(requestName); Logger.d(j, "registerListener listener added for requestName=" + requestName + "," + listener); arrayList.add(listener); } catch (Throwable th) { Logger.e(j, "registerListener failed during registerListener. requestName:" + requestName + ", listener: " + listener, th); new CrashReporter().caughtException(th); } } public static void b(String str, Bundle bundle) { try { Logger.d(j, "notifyListeners started, requestName=" + str + ",data=" + bundle.toString()); Iterator<b> it = A.get(str).iterator(); while (it.hasNext()) { b next = it.next(); Logger.d(j, "Invoking handler for requestName '" + str + "', Bundle : " + bundle.toString()); next.a(str, bundle); } } catch (Throwable th) { Logger.e(j, "Failed to read response", th); } } }