iKredit v1.2.0.3版本的 MD5 值为:2c00c5c79eecbd6be4c3c546c28d778d
以下内容为反编译后的 CrossPromotionHelper.java 源代码,内容仅作参考
package com.appsflyer.share;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.ServerConfigHandler;
import com.appsflyer.ServerParameters;
import com.appsflyer.internal.ae;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class CrossPromotionHelper {
public static void trackAndOpenStore(Context context, String str, String str2) {
trackAndOpenStore(context, str, str2, null);
}
public static void trackAndOpenStore(Context context, String str, String str2, Map<String, String> map) {
LinkGenerator m232 = m232(context, str, str2, map, ServerConfigHandler.getUrl(Constants.BASE_URL_APP_APPSFLYER_COM));
if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
AFLogger.afInfoLog("CustomerUserId not set, track And Open Store is disabled", true);
return;
}
HashMap hashMap = new HashMap();
if (map != null) {
hashMap.putAll(map);
}
hashMap.put("af_campaign", str2);
AppsFlyerLib.getInstance().trackEvent(context, "af_cross_promotion", hashMap);
new e(new ae(), context, AppsFlyerLib.getInstance().isTrackingStopped()).execute(m232.generateLink());
}
public static void trackCrossPromoteImpression(Context context, String str, String str2) {
if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
AFLogger.afInfoLog("CustomerUserId not set, Promote Impression is disabled", true);
} else {
new e(null, null, AppsFlyerLib.getInstance().isTrackingStopped()).execute(m232(context, str, str2, null, ServerConfigHandler.getUrl("https://%simpression.%s")).generateLink());
}
}
private static LinkGenerator m232(Context context, String str, String str2, Map<String, String> map, String str3) {
LinkGenerator linkGenerator = new LinkGenerator("af_cross_promotion");
linkGenerator.f325 = str3;
linkGenerator.f329 = str;
linkGenerator.addParameter(Constants.URL_SITE_ID, context.getPackageName());
if (str2 != null) {
linkGenerator.setCampaign(str2);
}
if (map != null) {
linkGenerator.addParameters(map);
}
String string = AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM);
if (string != null) {
linkGenerator.addParameter(Constants.URL_ADVERTISING_ID, string);
}
return linkGenerator;
}
public static class e extends AsyncTask<String, Void, Void> {
private ae f322;
private boolean f323;
private WeakReference<Context> f324;
e(ae aeVar, Context context, boolean z) {
this.f322 = aeVar;
this.f324 = new WeakReference<>(context);
this.f323 = z;
}
@Override
public Void doInBackground(String... strArr) {
HttpURLConnection httpURLConnection;
String str;
if (this.f323) {
return null;
}
try {
str = strArr[0];
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
} catch (Throwable th) {
th = th;
httpURLConnection = null;
}
try {
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setInstanceFollowRedirects(false);
int responseCode = httpURLConnection.getResponseCode();
if (responseCode == 200) {
AFLogger.afInfoLog("Cross promotion impressions success: ".concat(String.valueOf(str)), false);
} else {
if (responseCode != 301 && responseCode != 302) {
StringBuilder sb = new StringBuilder("call to ");
sb.append(str);
sb.append(" failed: ");
sb.append(responseCode);
AFLogger.afInfoLog(sb.toString());
}
AFLogger.afInfoLog("Cross promotion redirection success: ".concat(String.valueOf(str)), false);
if (this.f322 != null && this.f324.get() != null) {
this.f322.f166 = httpURLConnection.getHeaderField(Constants.HTTP_REDIRECT_URL_HEADER_FIELD);
ae aeVar = this.f322;
Context context = this.f324.get();
if (aeVar.f166 != null) {
context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(aeVar.f166)).setFlags(268435456));
}
}
}
} catch (Throwable th2) {
th = th2;
try {
AFLogger.afErrorLog(th.getMessage(), th, true);
} finally {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
}
}
}
}