package com.appsflyer;

import com.appsflyer.deeplink.DeepLinkListener;
import com.appsflyer.deeplink.DeepLinkResult;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;

public class AppsFlyer2dXConversionCallback implements AppsFlyerConversionListener, DeepLinkListener {
    static {
        Covode.recordClassIndex(2547);
    }

    public native void onAppOpenAttributionNative(Object obj);

    public native void onAttributionFailureNative(Object obj);

    public native void onDeepLinkingNative(DeepLinkResult deepLinkResult);

    public native void onInstallConversionDataLoadedNative(Object obj);

    public native void onInstallConversionFailureNative(Object obj);

    public void onAttributionFailure(String str) {
        AFInAppEventType("onInstallConversionFailure", str);
    }

    public void onConversionDataFail(String str) {
        AFInAppEventType("onAttributionFailure", str);
    }

    public void onAppOpenAttribution(Map<String, String> map) {
        MethodCollector.i(17424);
        onAppOpenAttributionNative(map);
        MethodCollector.o(17424);
    }

    public void onConversionDataSuccess(Map<String, Object> map) {
        MethodCollector.i(17323);
        onInstallConversionDataLoadedNative(map);
        MethodCollector.o(17323);
    }

    public void onDeepLinking(DeepLinkResult deepLinkResult) {
        MethodCollector.i(17531);
        onDeepLinkingNative(deepLinkResult);
        MethodCollector.o(17531);
    }

    private void AFInAppEventType(String str, String str2) {
        MethodCollector.i(17629);
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("status", "failure");
            jSONObject.put("data", str2);
            int hashCode = str.hashCode();
            if (hashCode != -1390007222) {
                if (hashCode == 1050716216) {
                    if (str.equals("onInstallConversionFailure")) {
                        onInstallConversionFailureNative(jSONObject);
                        MethodCollector.o(17629);
                        return;
                    }
                }
            } else if (str.equals("onAttributionFailure")) {
                onAttributionFailureNative(jSONObject);
            }
            MethodCollector.o(17629);
        } catch (JSONException e) {
            e.printStackTrace();
            MethodCollector.o(17629);
        }
    }
}
