S T G SuperAPPS v9.99.99版本的 MD5 值为:ec866d8c695a659ed10459d6bd169615

以下内容为反编译后的 CrossPromotionHelper.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.ServerConfigHandler;
import com.appsflyer.ServerParameters;
import com.appsflyer.internal.ac;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

public class CrossPromotionHelper {

    private static String f344 = "https://%simpression.%s";

    public static class a implements Runnable {

        private final String f345;

        private final ac f346;

        private final boolean f347;

        private final WeakReference<Context> f348;

        a(String str, ac acVar, Context context, boolean z10) {
            this.f345 = str;
            this.f346 = acVar;
            this.f348 = new WeakReference<>(context);
            this.f347 = z10;
        }

        @Override
        public final void run() {
            HttpURLConnection httpURLConnection;
            Throwable th2;
            if (this.f347) {
                return;
            }
            try {
                httpURLConnection = (HttpURLConnection) new URL(this.f345).openConnection();
                try {
                    httpURLConnection.setConnectTimeout(10000);
                    httpURLConnection.setInstanceFollowRedirects(false);
                    int responseCode = httpURLConnection.getResponseCode();
                    if (responseCode == 200) {
                        StringBuilder sb2 = new StringBuilder("Cross promotion impressions success: ");
                        sb2.append(this.f345);
                        AFLogger.afInfoLog(sb2.toString(), false);
                    } else if (responseCode != 301 && responseCode != 302) {
                        StringBuilder sb3 = new StringBuilder("call to ");
                        sb3.append(this.f345);
                        sb3.append(" failed: ");
                        sb3.append(responseCode);
                        AFLogger.afInfoLog(sb3.toString());
                    } else {
                        StringBuilder sb4 = new StringBuilder("Cross promotion redirection success: ");
                        sb4.append(this.f345);
                        AFLogger.afInfoLog(sb4.toString(), false);
                        if (this.f346 != null && this.f348.get() != null) {
                            this.f346.f211 = httpURLConnection.getHeaderField("Location");
                            ac acVar = this.f346;
                            Context context = this.f348.get();
                            if (acVar.f211 != null) {
                                context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(acVar.f211)).setFlags(268435456));
                            }
                        }
                    }
                    httpURLConnection.disconnect();
                } catch (Throwable th3) {
                    th2 = th3;
                    try {
                        AFLogger.afErrorLog(th2.getMessage(), th2, true);
                    } finally {
                        if (httpURLConnection != null) {
                            httpURLConnection.disconnect();
                        }
                    }
                }
            } catch (Throwable th4) {
                httpURLConnection = null;
                th2 = th4;
            }
        }
    }

    public static void logAndOpenStore(Context context, String str, String str2) {
        logAndOpenStore(context, str, str2, null);
    }

    public static void logCrossPromoteImpression(Context context, String str, String str2) {
        logCrossPromoteImpression(context, str, str2, null);
    }

    public static void setUrl(Map<String, String> map) {
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String value = entry.getValue();
            String key = entry.getKey();
            char c10 = 65535;
            int hashCode = key.hashCode();
            if (hashCode != 96801) {
                if (hashCode == 120623625 && key.equals("impression")) {
                    c10 = 1;
                }
            } else if (key.equals("app")) {
                c10 = 0;
            }
            if (c10 == 0) {
                Constants.f343 = value;
            } else if (c10 == 1) {
                f344 = value;
            }
        }
    }

    private static LinkGenerator m232(Context context, String str, String str2, Map<String, String> map, String str3) {
        LinkGenerator linkGenerator = new LinkGenerator("af_cross_promotion");
        linkGenerator.f354 = str3;
        linkGenerator.f358 = 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("advertising_id", string);
        }
        return linkGenerator;
    }

    public static void logAndOpenStore(Context context, String str, String str2, Map<String, String> map) {
        LinkGenerator m232 = m232(context, str, str2, map, ServerConfigHandler.getUrl(Constants.f343));
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
            AFLogger.afInfoLog("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 a(m232.generateLink(), new ac(), context, AppsFlyerLib.getInstance().isStopped())).start();
    }

    public static void logCrossPromoteImpression(Context context, String str, String str2, Map<String, String> map) {
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
            AFLogger.afInfoLog("CustomerUserId not set, Promote Impression is disabled", true);
        } else {
            new Thread(new a(m232(context, str, str2, map, ServerConfigHandler.getUrl(f344)).generateLink(), null, null, AppsFlyerLib.getInstance().isStopped())).start();
        }
    }
}