iKredit v1.2.0.3版本的 MD5 值为:2c00c5c79eecbd6be4c3c546c28d778d

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


package com.appsflyer.internal;

import android.content.Context;
import android.content.Intent;
import com.appsflyer.AFEvent;
import com.appsflyer.AFInAppEventType;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerInAppPurchaseValidatorListener;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerLibCore;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.ServerConfigHandler;
import com.appsflyer.ServerParameters;
import com.appsflyer.internal.model.event.Validate;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;

public final class w implements Runnable {

    private static String f297 = null;

    private static String f298 = "https://%ssdk-services.%s/validate-android-signature";

    private String f299;

    private final Intent f300;

    private Map<String, String> f301;

    private WeakReference<Context> f302;

    private String f303;

    private String f304;

    private String f305;

    private String f306;

    private String f307;

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

    public w(Context context, String str, String str2, String str3, String str4, String str5, String str6, Map<String, String> map, Intent intent) {
        this.f302 = new WeakReference<>(context);
        this.f304 = str;
        this.f299 = str2;
        this.f306 = str4;
        this.f305 = str5;
        this.f307 = str6;
        this.f301 = map;
        this.f303 = str3;
        this.f300 = intent;
    }

    @Override
    public final void run() {
        String str = this.f304;
        if (str == null || str.length() == 0 || AppsFlyerLib.getInstance().isTrackingStopped()) {
            return;
        }
        HttpURLConnection httpURLConnection = null;
        try {
            Context context = this.f302.get();
            if (context == null) {
                return;
            }
            HashMap hashMap = new HashMap();
            hashMap.put("public-key", this.f299);
            hashMap.put("sig-data", this.f306);
            hashMap.put("signature", this.f303);
            final HashMap hashMap2 = new HashMap(hashMap);
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    w wVar = w.this;
                    w.m225(wVar, hashMap2, wVar.f301, w.this.f302);
                }
            }).start();
            hashMap.put("dev_key", this.f304);
            hashMap.put("app_id", context.getPackageName());
            hashMap.put("uid", 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(f298);
            if (ai.f189 == null) {
                ai.f189 = new ai();
            }
            ai.f189.m173("server_request", url, jSONObject);
            HttpURLConnection m221 = m221((Validate) new Validate().params(hashMap).urlString(url));
            int responseCode = m221 != null ? m221.getResponseCode() : -1;
            AppsFlyerLibCore.getInstance();
            String m53 = AppsFlyerLibCore.m53(m221);
            if (ai.f189 == null) {
                ai.f189 = new ai();
            }
            ai.f189.m173("server_response", url, String.valueOf(responseCode), m53);
            JSONObject jSONObject2 = new JSONObject(m53);
            jSONObject2.put("code", responseCode);
            if (responseCode == 200) {
                StringBuilder sb = new StringBuilder("Validate response 200 ok: ");
                sb.append(jSONObject2.toString());
                AFLogger.afInfoLog(sb.toString());
                m223(jSONObject2.optBoolean("result"), this.f306, this.f305, this.f307, jSONObject2.toString());
            } else {
                AFLogger.afInfoLog("Failed Validate request");
                m223(false, this.f306, this.f305, this.f307, jSONObject2.toString());
            }
            if (m221 != null) {
                m221.disconnect();
            }
        } catch (Throwable th) {
            try {
                if (AppsFlyerLibCore.f70 != null) {
                    AFLogger.afErrorLog("Failed Validate request + ex", th);
                    m223(false, this.f306, this.f305, this.f307, th.getMessage());
                }
                AFLogger.afErrorLog(th.getMessage(), th);
            } finally {
                if (0 != 0) {
                    httpURLConnection.disconnect();
                }
            }
        }
    }

    private static HttpURLConnection m221(Validate validate) {
        StringBuilder sb = new StringBuilder("Calling ");
        sb.append(validate.urlString());
        AFLogger.afDebugLog(sb.toString());
        return new z(validate.trackingStopped(AppsFlyerLib.getInstance().isTrackingStopped())).m231();
    }

    private static void m223(boolean z, String str, String str2, String str3, String str4) {
        if (AppsFlyerLibCore.f70 != 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.f70.onValidateInApp();
                return;
            }
            AFLogger.afDebugLog("Validate in app purchase failed: ".concat(String.valueOf(str4)));
            AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = AppsFlyerLibCore.f70;
            if (str4 == null) {
                str4 = "Failed validating";
            }
            appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure(str4);
        }
    }

    static void m225(w wVar, Map map, Map map2, WeakReference weakReference) {
        if (weakReference.get() != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(ServerConfigHandler.getUrl(f297));
            sb.append(((Context) weakReference.get()).getPackageName());
            String obj = sb.toString();
            String string = AppsFlyerLibCore.getSharedPreferences((Context) weakReference.get()).getString("referrer", "");
            AFEvent context = new Validate().encrypt(true).context((Context) weakReference.get());
            context.f13 = wVar.f304;
            context.f18 = AFInAppEventType.PURCHASE;
            context.f17 = string;
            context.f16 = wVar.f300;
            AFEvent aFEvent = (Validate) context;
            Map<String, Object> m124 = AppsFlyerLibCore.getInstance().m124(aFEvent);
            m124.put(FirebaseAnalytics.Param.PRICE, wVar.f305);
            m124.put(FirebaseAnalytics.Param.CURRENCY, wVar.f307);
            m124.put("receipt_data", map);
            if (map2 != null) {
                m124.put("extra_prms", map2);
            }
            String jSONObject = new JSONObject(m124).toString();
            if (ai.f189 == null) {
                ai.f189 = new ai();
            }
            ai.f189.m173("server_request", obj, jSONObject);
            HttpURLConnection httpURLConnection = null;
            try {
                httpURLConnection = m221((Validate) aFEvent.params(m124).urlString(obj));
                int responseCode = httpURLConnection != null ? httpURLConnection.getResponseCode() : -1;
                AppsFlyerLibCore.getInstance();
                String m53 = AppsFlyerLibCore.m53(httpURLConnection);
                if (ai.f189 == null) {
                    ai.f189 = new ai();
                }
                ai.f189.m173("server_response", obj, String.valueOf(responseCode), m53);
                StringBuilder sb2 = new StringBuilder("Validate-WH response - ");
                sb2.append(responseCode);
                sb2.append(": ");
                sb2.append(new JSONObject(m53).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();
                    }
                }
            }
        }
    }
}