正在查看: Brevistay v5.8.2 应用的 CrossPromotionHelper.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Brevistay v5.8.2 应用的 CrossPromotionHelper.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.appsflyer.share;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.internal.ac;
import com.appsflyer.internal.db;
import com.appsflyer.internal.dg;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
public class CrossPromotionHelper {
private static String AFInAppEventParameterName = "https://%simpression.%s";
public static void logAndOpenStore(Context context, String str, String str2) {
logAndOpenStore(context, str, str2, null);
}
public static void logAndOpenStore(Context context, String str, String str2, Map<String, String> map) {
LinkGenerator valueOf = valueOf(context, str, str2, map, String.format(db.AFInAppEventParameterName, AppsFlyerLib.getInstance().getHostPrefix(), ac.AFInAppEventParameterName().getHostName()));
if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
AFLogger.values("CustomerUserId not set, track And Open Store is disabled", true);
return;
}
if (map == null) {
map = new HashMap<>();
}
map.put("af_campaign", str2);
AppsFlyerLib.getInstance().logEvent(context, "af_cross_promotion", map);
new Thread(new d(valueOf.generateLink(), new dg(), context, AppsFlyerLib.getInstance().isStopped())).start();
}
public static void logCrossPromoteImpression(Context context, String str, String str2) {
logCrossPromoteImpression(context, str, str2, null);
}
public static void logCrossPromoteImpression(Context context, String str, String str2, Map<String, String> map) {
if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
AFLogger.values("CustomerUserId not set, Promote Impression is disabled", true);
} else {
new Thread(new d(valueOf(context, str, str2, map, String.format(AFInAppEventParameterName, AppsFlyerLib.getInstance().getHostPrefix(), ac.AFInAppEventParameterName().getHostName())).generateLink(), null, null, AppsFlyerLib.getInstance().isStopped())).start();
}
}
private static LinkGenerator valueOf(Context context, String str, String str2, Map<String, String> map, String str3) {
LinkGenerator linkGenerator = new LinkGenerator("af_cross_promotion");
linkGenerator.AFInAppEventType = str3;
linkGenerator.AFKeystoreWrapper = str;
linkGenerator.addParameter("af_siteid", context.getPackageName());
if (str2 != null) {
linkGenerator.setCampaign(str2);
}
if (map != null) {
linkGenerator.addParameters(map);
}
String string = AppsFlyerProperties.getInstance().getString("advertiserId");
if (string != null) {
linkGenerator.addParameter("advertising_id", string);
}
return linkGenerator;
}
public static void setUrl(Map<String, String> map) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String value = entry.getValue();
String key = entry.getKey();
key.hashCode();
if (key.equals("app")) {
db.AFInAppEventParameterName = value;
} else if (key.equals("impression")) {
AFInAppEventParameterName = value;
}
}
}
static class d implements Runnable {
private final dg AFInAppEventParameterName;
private final String AFKeystoreWrapper;
private final WeakReference<Context> valueOf;
private final boolean values;
d(String str, dg dgVar, Context context, boolean z) {
this.AFKeystoreWrapper = str;
this.AFInAppEventParameterName = dgVar;
this.valueOf = new WeakReference<>(context);
this.values = z;
}
@Override
public final void run() {
HttpURLConnection httpURLConnection;
Throwable th;
if (this.values) {
return;
}
try {
httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(this.AFKeystoreWrapper).openConnection()));
try {
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setInstanceFollowRedirects(false);
int responseCode = httpURLConnection.getResponseCode();
if (responseCode == 200) {
StringBuilder sb = new StringBuilder("Cross promotion impressions success: ");
sb.append(this.AFKeystoreWrapper);
AFLogger.values(sb.toString(), false);
} else if (responseCode == 301 || responseCode == 302) {
StringBuilder sb2 = new StringBuilder("Cross promotion redirection success: ");
sb2.append(this.AFKeystoreWrapper);
AFLogger.values(sb2.toString(), false);
if (this.AFInAppEventParameterName != null && this.valueOf.get() != null) {
this.AFInAppEventParameterName.values = httpURLConnection.getHeaderField("Location");
dg dgVar = this.AFInAppEventParameterName;
Context context = this.valueOf.get();
if (dgVar.values != null) {
context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(dgVar.values)).setFlags(268435456));
}
}
} else {
StringBuilder sb3 = new StringBuilder("call to ");
sb3.append(this.AFKeystoreWrapper);
sb3.append(" failed: ");
sb3.append(responseCode);
AFLogger.values(sb3.toString());
}
} catch (Throwable th2) {
th = th2;
try {
AFLogger.AFInAppEventParameterName(th.getMessage(), th);
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
} finally {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
}
} catch (Throwable th3) {
httpURLConnection = null;
th = th3;
}
}
}
}