Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22

以下内容为反编译后的 AFValidateInAppPurchase.java 源代码,内容仅作参考


package com.appsflyer;

import android.content.Context;
import b.a.f.b;
import com.applovin.sdk.AppLovinEventParameters;
import com.appsflyer.internal.ac;
import com.appsflyer.internal.model.event.Purchase;
import com.appsflyer.internal.model.event.SdkServices;
import com.appsflyer.internal.model.event.Validate;
import com.appsflyer.internal.referrer.Payload;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
public class AFValidateInAppPurchase implements Runnable {
    private static String $$b = "https://%ssdk-services.%s/validate-android-signature";
    private static String values;
    private String $$a;
    private WeakReference<Context> AFDateFormat;
    private String AFDeepLinkManager;
    private String collectIntentsFromActivities;
    private Map<String, String> dateFormatUTC;
    private String getDataFormatter;
    private String getInstance;
    private String valueOf;

    static {
        StringBuilder sb = new StringBuilder("https://%svalidate.%s/api/v");
        sb.append(AppsFlyerLibCore.SERVER_BUILD_NUMBER);
        sb.append("/androidevent?buildnumber=6.2.0&app_id=");
        values = sb.toString();
    }

    public AFValidateInAppPurchase(Context context, String str, String str2, String str3, String str4, String str5, String str6, Map<String, String> map) {
        this.AFDateFormat = new WeakReference<>(context);
        this.valueOf = str;
        this.$$a = str2;
        this.getInstance = str4;
        this.AFDeepLinkManager = str5;
        this.collectIntentsFromActivities = str6;
        this.dateFormatUTC = map;
        this.getDataFormatter = str3;
    }

    private static HttpURLConnection AFDateFormat(Purchase purchase) {
        StringBuilder sb = new StringBuilder("Calling ");
        sb.append(purchase.urlString());
        AFLogger.afDebugLog(sb.toString());
        return new BackgroundHttpTask(purchase.trackingStopped(AppsFlyerLib.getInstance().isStopped())).doInBackground();
    }

    private static void AFDateFormat(boolean z, String str, String str2, String str3, String str4) {
        if (AppsFlyerLibCore.valueOf != null) {
            StringBuilder sb = new StringBuilder("Validate callback parameters: ");
            sb.append(str);
            sb.append(" ");
            sb.append(str2);
            sb.append(" ");
            sb.append(str3);
            AFLogger.afDebugLog(sb.toString());
            if (z) {
                AFLogger.afDebugLog("Validate in app purchase success: ".concat(String.valueOf(str4)));
                AppsFlyerLibCore.valueOf.onValidateInApp();
                return;
            }
            AFLogger.afDebugLog("Validate in app purchase failed: ".concat(String.valueOf(str4)));
            AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = AppsFlyerLibCore.valueOf;
            if (str4 == null) {
                str4 = "Failed validating";
            }
            appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure(str4);
        }
    }

    public static void setUrl(Map<String, String> map) {
        char c;
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String value = entry.getValue();
            String key = entry.getKey();
            int hashCode = key.hashCode();
            if (hashCode != -1421272810) {
                if (hashCode == 454162577 && key.equals("sdk-services")) {
                    c = 0;
                }
                c = 65535;
            } else {
                if (key.equals("validate")) {
                    c = 1;
                }
                c = 65535;
            }
            if (c == 0) {
                $$b = value;
            } else if (c == 1) {
                values = value;
            }
        }
    }

    static void valueOf(AFValidateInAppPurchase aFValidateInAppPurchase, Map map, Map map2, WeakReference weakReference) {
        if (weakReference.get() != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(ServerConfigHandler.getUrl(values));
            sb.append(((Context) weakReference.get()).getPackageName());
            String obj = sb.toString();
            String string = AppsFlyerLibCore.getSharedPreferences((Context) weakReference.get()).getString(Payload.RFR, "");
            AFEvent key = new Validate((Context) weakReference.get()).key(aFValidateInAppPurchase.valueOf);
            key.valueOf = string;
            AFEvent aFEvent = (Validate) key;
            AppsFlyerLibCore appsFlyerLibCore = AppsFlyerLibCore.getInstance();
            Map<String, Object> valueOf = appsFlyerLibCore.valueOf(aFEvent);
            valueOf.put("price", aFValidateInAppPurchase.AFDeepLinkManager);
            valueOf.put("currency", aFValidateInAppPurchase.collectIntentsFromActivities);
            valueOf.put(AppLovinEventParameters.IN_APP_PURCHASE_DATA, map);
            if (map2 != null) {
                valueOf.put("extra_prms", map2);
            }
            valueOf.putAll(appsFlyerLibCore.valueOf());
            ac.AFDateFormat().AFDateFormat("server_request", obj, new JSONObject(valueOf).toString());
            HttpURLConnection httpURLConnection = null;
            try {
                httpURLConnection = AFDateFormat((Purchase) aFEvent.addParams(valueOf).urlString(obj));
                int responseCode = httpURLConnection != null ? httpURLConnection.getResponseCode() : -1;
                String readServerResponse = appsFlyerLibCore.readServerResponse(httpURLConnection);
                ac.AFDateFormat().AFDateFormat("server_response", obj, String.valueOf(responseCode), readServerResponse);
                StringBuilder sb2 = new StringBuilder("Validate-WH response - ");
                sb2.append(responseCode);
                sb2.append(": ");
                sb2.append(new JSONObject(readServerResponse).toString());
                AFLogger.afInfoLog(sb2.toString());
            } catch (Throwable th) {
                try {
                    AFLogger.afErrorLog(th.getMessage(), th);
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                } finally {
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                }
            }
        }
    }

    @Override
    public void run() {
        String str = this.valueOf;
        if (str == null || str.length() == 0 || AppsFlyerLib.getInstance().isStopped()) {
            return;
        }
        HttpURLConnection httpURLConnection = null;
        try {
            Context context = this.AFDateFormat.get();
            if (context == null) {
                return;
            }
            HashMap hashMap = new HashMap();
            hashMap.put("public-key", this.$$a);
            hashMap.put("sig-data", this.getInstance);
            hashMap.put(InAppPurchaseMetaData.KEY_SIGNATURE, this.getDataFormatter);
            final HashMap hashMap2 = new HashMap(hashMap);
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    AFValidateInAppPurchase aFValidateInAppPurchase = AFValidateInAppPurchase.this;
                    AFValidateInAppPurchase.valueOf(aFValidateInAppPurchase, hashMap2, aFValidateInAppPurchase.dateFormatUTC, AFValidateInAppPurchase.this.AFDateFormat);
                }
            }).start();
            hashMap.put("dev_key", this.valueOf);
            hashMap.put("app_id", context.getPackageName());
            hashMap.put(ServerParameters.AF_USER_ID, AppsFlyerLib.getInstance().getAppsFlyerUID(context));
            hashMap.put(ServerParameters.ADVERTISING_ID_PARAM, AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM));
            String jSONObject = new JSONObject(hashMap).toString();
            String url = ServerConfigHandler.getUrl($$b);
            ac.AFDateFormat().AFDateFormat("server_request", url, jSONObject);
            HttpURLConnection AFDateFormat = AFDateFormat((Purchase) new SdkServices().addParams(hashMap).urlString(url));
            int responseCode = AFDateFormat != null ? AFDateFormat.getResponseCode() : -1;
            String readServerResponse = AppsFlyerLibCore.getInstance().readServerResponse(AFDateFormat);
            ac.AFDateFormat().AFDateFormat("server_response", url, String.valueOf(responseCode), readServerResponse);
            JSONObject jSONObject2 = new JSONObject(readServerResponse);
            jSONObject2.put(b.f70a, responseCode);
            if (responseCode == 200) {
                StringBuilder sb = new StringBuilder("Validate response 200 ok: ");
                sb.append(jSONObject2.toString());
                AFLogger.afInfoLog(sb.toString());
                AFDateFormat(jSONObject2.optBoolean(IronSourceConstants.EVENTS_RESULT), this.getInstance, this.AFDeepLinkManager, this.collectIntentsFromActivities, jSONObject2.toString());
            } else {
                AFLogger.afInfoLog("Failed Validate request");
                AFDateFormat(false, this.getInstance, this.AFDeepLinkManager, this.collectIntentsFromActivities, jSONObject2.toString());
            }
            if (AFDateFormat != null) {
                AFDateFormat.disconnect();
            }
        } catch (Throwable th) {
            try {
                if (AppsFlyerLibCore.valueOf != null) {
                    AFLogger.afErrorLog("Failed Validate request + ex", th);
                    AFDateFormat(false, this.getInstance, this.AFDeepLinkManager, this.collectIntentsFromActivities, th.getMessage());
                }
                AFLogger.afErrorLog(th.getMessage(), th);
            } finally {
                if (0 != 0) {
                    httpURLConnection.disconnect();
                }
            }
        }
    }
}