导航菜单

页面标题

页面副标题

RummyCircle v11000.89 - RCInitAttributionRouter.java 源代码

正在查看: RummyCircle v11000.89 应用的 RCInitAttributionRouter.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.games24x7.onboarding.communication.complex.routers.initattribution;

import android.os.Build;
import android.os.Bundle;
import com.appsflyer.AppsFlyerLib;
import com.games24x7.coregame.KrakenApplication;
import com.games24x7.coregame.common.communication.nativecomm.ComplexLayerCommInterface;
import com.games24x7.coregame.common.deeplink.util.NativeUtil;
import com.games24x7.coregame.common.deeplink.util.OEMUtils;
import com.games24x7.coregame.common.deeplink.util.PreferenceManager;
import com.games24x7.coregame.common.utility.analytics.AnalyticsUtil;
import com.games24x7.coregame.common.utility.analytics.firebase.FirebaseAnalyticsUtility;
import com.games24x7.coregame.common.utility.attributions.AttributionListener;
import com.games24x7.coregame.common.utility.attributions.controller.AttributionController;
import com.games24x7.coregame.common.utility.attributions.controller.NAEUtilityController;
import com.games24x7.coregame.common.utility.attributions.factory.AttributionProviderFactory;
import com.games24x7.coregame.common.utility.flavor.FlavorManager;
import com.games24x7.coregame.common.utility.general.RouterUtility;
import com.games24x7.coregame.common.utility.json.JsonUtility;
import com.games24x7.coregame.common.utility.log.Logger;
import com.games24x7.coregame.common.utility.native.NativeUtils;
import com.games24x7.coregame.common.utility.native.UrlUtility;
import com.games24x7.coregame.common.utility.runtimevars.RunTimeVarsUtility;
import com.games24x7.onboarding.communication.OnBoardingComplexEvents;
import com.games24x7.pgeventbus.event.EventInfo;
import com.games24x7.pgeventbus.event.PGEvent;
import com.games24x7.pgnetwork.utils.CookieConfig;
import com.games24x7.pgnetwork.utils.ReplicateUrlData;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.q;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
import kotlin.text.o;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

@Metadata
public final class RCInitAttributionRouter implements AttributionListener {
    private static boolean IS_APP_LAUNCH_EVENT_FIRED = false;

    @NotNull
    public static final String TAG = "RC_INIT_ATTRIB";
    private static boolean isAttributionSent;
    private ComplexLayerCommInterface communicationInterface;

    @NotNull
    private String intentData = "";

    @NotNull
    public static final Companion Companion = new Companion(null);

    @NotNull
    private static EventInfo clientEventInfo = new EventInfo("na", "na", (String) null, (String) null, 12, (DefaultConstructorMarker) null);

    @NotNull
    private static final List<String> supportedEvents = q.b(OnBoardingComplexEvents.RC_INIT_ATTRIBUTION);

    @Metadata
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public final boolean getIS_APP_LAUNCH_EVENT_FIRED() {
            return RCInitAttributionRouter.IS_APP_LAUNCH_EVENT_FIRED;
        }

        @NotNull
        public final List<String> getSupportedEvents() {
            return RCInitAttributionRouter.supportedEvents;
        }

        public final void setIS_APP_LAUNCH_EVENT_FIRED(boolean z) {
            RCInitAttributionRouter.IS_APP_LAUNCH_EVENT_FIRED = z;
        }

        private Companion() {
        }
    }

    private final void addPushTokenToNAE(AttributionController attributionController) {
        String string = PreferenceManager.Companion.getInstance(KrakenApplication.Companion.getApplicationContext()).getUnitySharedPref().getString("registration_id_2", "");
        String str = string != null ? string : "";
        if (!o.i(str)) {
            attributionController.setParam("gcmId", str);
        }
    }

    private final void fireTrackingForAppLaunch(String str, Bundle bundle) {
        JSONObject jSONObject = new JSONObject();
        if (str != null) {
            try {
                jSONObject.put("intentUrl", str);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (bundle != null) {
            jSONObject.put("intentObject", JsonUtility.INSTANCE.convertBundleToJson(bundle));
        }
        JSONObject jSONObject2 = new JSONObject();
        try {
            jSONObject2.put("event", "appLaunch");
            jSONObject2.put("ajaxData", "null");
            jSONObject2.put("ajaxResponse", "null");
            jSONObject2.put("ajaxUrl", "null");
            jSONObject2.put("formData", "null");
            jSONObject2.put("id", "null");
            jSONObject2.put("metadata", jSONObject.toString());
            jSONObject2.put("selectedItem", "null");
            jSONObject2.put("timestamp", new Date().getTime());
            jSONObject2.put("url", str);
            jSONObject2.put("gameId", "null");
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        AnalyticsUtil analyticsUtil = AnalyticsUtil.INSTANCE;
        String jSONObject3 = jSONObject2.toString();
        Intrinsics.checkNotNullExpressionValue(jSONObject3, "analyticsObj.toString()");
        AnalyticsUtil.sendAnalyticsEvent$default(analyticsUtil, "clickStreamData", analyticsUtil.createAnalyticsPayload(jSONObject3), (String) null, (String) null, 12, (Object) null);
    }

    private final void initAttribution() {
        int i = 0;
        try {
            isAttributionSent = false;
            AttributionProviderFactory.Companion companion = AttributionProviderFactory.Companion;
            KrakenApplication.Companion companion2 = KrakenApplication.Companion;
            AttributionController createInstance = companion.createInstance(companion2.getApplicationContext(), "nae");
            addPushTokenToNAE(createInstance);
            createInstance.setParam("distribution_medium", "PLAYSTORE");
            createInstance.setParam("channelId", "3");
            String str = Build.MODEL;
            Intrinsics.checkNotNullExpressionValue(str, "MODEL");
            createInstance.setParam("device_model", str);
            String str2 = Build.MANUFACTURER;
            Intrinsics.checkNotNullExpressionValue(str2, "MANUFACTURER");
            createInstance.setParam("device_manufacturer", str2);
            createInstance.setEnabled(RunTimeVarsUtility.INSTANCE.getIntRunTimeVar("IS_ATTRIBUTION_ENABLED", 1) == 1);
            createInstance.setParam("connection_type", JsonUtility.INSTANCE.getNetworkType(companion2.getApplicationContext()));
            RouterUtility routerUtility = RouterUtility.INSTANCE;
            createInstance.setParam("primary_language", routerUtility.getPrimaryLanguage());
            createInstance.setParam("secondary_language", String.valueOf(routerUtility.getSecondLanguages()));
            NativeUtil nativeUtil = NativeUtil.INSTANCE;
            String deviceArchitecture = nativeUtil.getDeviceArchitecture();
            String[] strArr = Build.SUPPORTED_32_BIT_ABIS;
            Intrinsics.checkNotNullExpressionValue(strArr, "SUPPORTED_32_BIT_ABIS");
            String valueOf = String.valueOf(strArr.length != 0);
            String[] strArr2 = Build.SUPPORTED_64_BIT_ABIS;
            Intrinsics.checkNotNullExpressionValue(strArr2, "SUPPORTED_64_BIT_ABIS");
            String valueOf2 = String.valueOf(strArr2.length != 0);
            FlavorManager flavorManager = FlavorManager.INSTANCE;
            if (flavorManager.isRCPrimaryFlavor()) {
                i = nativeUtil.is32BitBuild();
            } else if (!flavorManager.isRCPlaystoreFlavor() || nativeUtil.is64BitDevice() != 1) {
                i = 1;
            }
            createInstance.setParam("device_arch_info", deviceArchitecture);
            createInstance.setParam("device_os_32_bit_supported", valueOf);
            createInstance.setParam("device_os_64_bit_supported", valueOf2);
            createInstance.setParam("is32BitBuild", String.valueOf(i));
            initializeNAE(createInstance);
            NAEUtilityController.INSTANCE.isNaeControllerInitialized().set(true);
        } catch (Exception e) {
            if (isAttributionSent) {
                return;
            }
            e.printStackTrace();
            isAttributionSent = true;
            sendInitAttributionErrorEvent("Missing zk Json data. Please provide all zK config data for processing the NAE.");
        }
    }

    private final void initializeNAE(AttributionController attributionController) {
        try {
            if (!OEMUtils.INSTANCE.isOemStore() && !NativeUtil.INSTANCE.isRCLiteFlavour()) {
                JSONObject jSONObject = new JSONObject();
                RunTimeVarsUtility runTimeVarsUtility = RunTimeVarsUtility.INSTANCE;
                jSONObject.put("host_url", runTimeVarsUtility.getStringRunTimeVar("ATTRIBUTION_URL", "https://nae.rummycircle.com/hook/"));
                jSONObject.put("is_oem_store", false);
                Bundle bundle = new Bundle();
                bundle.putString("file_prefix", runTimeVarsUtility.getStringRunTimeVar("RC_ATTRIBUTION_FILE_PREFIX", "RummyCircle_"));
                bundle.putString("directory_prefix", runTimeVarsUtility.getStringRunTimeVar("RC_ATTRIBUTION_DIRECTORY_PREFIX", "rc-"));
                bundle.putString("file_suffix", runTimeVarsUtility.getStringRunTimeVar("ATTRIBUTION_FILE_SUFFIX", "_v.apk"));
                bundle.putString("directory_suffix", runTimeVarsUtility.getStringRunTimeVar("RC_ATTRIBUTION_DIRECTORY_PREFIX", ""));
                bundle.putString("directory_fingerprint_fallback", runTimeVarsUtility.getStringRunTimeVar("ATTRIBUTION_DIRECTORY_FINGERPRINT_IGNORE_STRING", "2a85c4f122ebcc8164f7de0e5f2f237cf6ae1b13"));
                bundle.putString("file_fingerprint_fallback", runTimeVarsUtility.getStringRunTimeVar("ATTRIBUTION_FILE_FINGERPRINT_IGNORE_STRING", ""));
                Unit unit = Unit.a;
                attributionController.initializeAttribution(jSONObject, this, bundle);
            }
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("host_url", RunTimeVarsUtility.INSTANCE.getStringRunTimeVar("ATTRIBUTION_URL", "https://nae.rummycircle.com/hook/"));
            jSONObject2.put("is_oem_store", true);
            attributionController.initializeAttribution(jSONObject2, this, new Bundle());
        } catch (Exception e) {
            if (isAttributionSent) {
                return;
            }
            e.printStackTrace();
            isAttributionSent = true;
            sendInitAttributionErrorEvent("Missing zk Json data. Please provide all zK config data for processing the NAE.");
        }
    }

    private final void prepareTrackingUrlForNAEFailure() {
        KrakenApplication applicationContext = KrakenApplication.Companion.getApplicationContext();
        AttributionProviderFactory.Companion companion = AttributionProviderFactory.Companion;
        AttributionController createInstance = companion.createInstance(applicationContext, "nae");
        AttributionController createInstance2 = companion.createInstance(applicationContext, "appsflyer");
        createInstance.setPersistantParam("connection_type", JsonUtility.INSTANCE.getNetworkType(applicationContext));
        if (!(!o.i(this.intentData))) {
            addPushTokenToNAE(createInstance);
            Bundle bundle = new Bundle();
            bundle.putString("appsflyerId", AppsFlyerLib.getInstance().getAppsFlyerUID(applicationContext));
            createInstance.sendEventWithBundle("appLaunch", bundle);
            createInstance2.sendEvent("appLaunch", (HashMap) null);
            return;
        }
        Bundle bundle2 = new Bundle();
        bundle2.putString("intentUrl", this.intentData);
        addPushTokenToNAE(createInstance);
        bundle2.putString("appsflyerId", AppsFlyerLib.getInstance().getAppsFlyerUID(applicationContext));
        createInstance.sendEventWithBundle("appLaunch", bundle2);
        createInstance2.sendEvent("appLaunch", (HashMap) null);
    }

    private final void prepareTrackingUrlForNAESuccess() {
        Logger logger = Logger.INSTANCE;
        Logger.d$default(logger, TAG, "prepareTrackingUrlForNAESuccess", false, 4, (Object) null);
        KrakenApplication applicationContext = KrakenApplication.Companion.getApplicationContext();
        AttributionProviderFactory.Companion companion = AttributionProviderFactory.Companion;
        AttributionController createInstance = companion.createInstance(applicationContext, "nae");
        AttributionController createInstance2 = companion.createInstance(applicationContext, "appsflyer");
        JsonUtility jsonUtility = JsonUtility.INSTANCE;
        createInstance.setPersistantParam("connection_type", jsonUtility.getNetworkType(applicationContext));
        RouterUtility routerUtility = RouterUtility.INSTANCE;
        createInstance.setParam("primary_language", routerUtility.getPrimaryLanguage());
        createInstance.setParam("secondary_language", String.valueOf(routerUtility.getSecondLanguages()));
        String str = Build.MODEL;
        Intrinsics.checkNotNullExpressionValue(str, "MODEL");
        createInstance.setParam("device_model", str);
        String str2 = Build.MANUFACTURER;
        Intrinsics.checkNotNullExpressionValue(str2, "MANUFACTURER");
        createInstance.setParam("device_manufacturer", str2);
        if (!o.i(this.intentData)) {
            Bundle bundle = new Bundle();
            String[] strArr = (String[]) new Regex("\\?").e(this.intentData).toArray(new String[0]);
            bundle.putString("intentUrl", this.intentData);
            if (strArr.length > 1) {
                bundle.putString("intentObject", jsonUtility.convertBundleToJson(NativeUtils.INSTANCE.convertStrToBundle(strArr[1])).toString());
            }
            addPushTokenToNAE(createInstance);
            bundle.putString("appsflyerId", AppsFlyerLib.getInstance().getAppsFlyerUID(applicationContext));
            Logger.d$default(logger, TAG, "NAE event sent ATTRIBUTION_EVENT_APP_LAUNCH", false, 4, (Object) null);
            createInstance.sendEventWithBundle("appLaunch", bundle);
            createInstance2.sendEvent("appLaunch", (HashMap) null);
            fireTrackingForAppLaunch(this.intentData, bundle.getBundle("intentObject"));
        } else {
            addPushTokenToNAE(createInstance);
            Logger.d$default(logger, TAG, "NAE event sent ATTRIBUTION_EVENT_APP_LAUNCH", false, 4, (Object) null);
            Bundle bundle2 = new Bundle();
            bundle2.putString("appsflyerId", AppsFlyerLib.getInstance().getAppsFlyerUID(applicationContext));
            createInstance.sendEventWithBundle("appLaunch", bundle2);
            createInstance2.sendEvent("appLaunch", (HashMap) null);
            Bundle bundle3 = new Bundle();
            bundle3.putString("app_launch", "rc");
            FirebaseAnalyticsUtility.INSTANCE.logCustomEvent("rc_app_open", bundle3);
            fireTrackingForAppLaunch(null, null);
        }
        createInstance.getAttributionData();
    }

    private final void sendInitAttributionErrorEvent(String str) {
        PreferenceManager.Companion.getInstance().setBafComplete(Boolean.TRUE);
        ComplexLayerCommInterface complexLayerCommInterface = this.communicationInterface;
        if (complexLayerCommInterface == null) {
            Intrinsics.q("communicationInterface");
            throw null;
        }
        EventInfo eventInfo = clientEventInfo;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("isSuccess", false);
        jSONObject.put("result", "{}");
        jSONObject.put("errorMsg", str);
        Unit unit = Unit.a;
        String jSONObject2 = jSONObject.toString();
        Intrinsics.checkNotNullExpressionValue(jSONObject2, "JSONObject().apply {\n   …             }.toString()");
        ComplexLayerCommInterface.DefaultImpls.onRouterResponse$default(complexLayerCommInterface, new PGEvent(eventInfo, jSONObject2, new EventInfo(OnBoardingComplexEvents.RC_INIT_ATTRIBUTION, "onboarding_native_callback", (String) null, (String) null, 12, (DefaultConstructorMarker) null)), false, false, 4, (Object) null);
    }

    private final void sendInitAttributionSuccessEvent(org.json.JSONObject r17) {
        throw new UnsupportedOperationException("Method not decompiled: com.games24x7.onboarding.communication.complex.routers.initattribution.RCInitAttributionRouter.sendInitAttributionSuccessEvent(org.json.JSONObject):void");
    }

    private final void sendResponseEvent(String str) {
        ComplexLayerCommInterface complexLayerCommInterface = this.communicationInterface;
        if (complexLayerCommInterface == null) {
            Intrinsics.q("communicationInterface");
            throw null;
        }
        EventInfo eventInfo = clientEventInfo;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("isSuccess", true);
        jSONObject.put("result", str);
        Unit unit = Unit.a;
        String jSONObject2 = jSONObject.toString();
        Intrinsics.checkNotNullExpressionValue(jSONObject2, "JSONObject().apply {\n   …             }.toString()");
        ComplexLayerCommInterface.DefaultImpls.onRouterResponse$default(complexLayerCommInterface, new PGEvent(eventInfo, jSONObject2, new EventInfo(OnBoardingComplexEvents.RC_INIT_ATTRIBUTION, "onboarding_native_callback", (String) null, (String) null, 12, (DefaultConstructorMarker) null)), true, false, 4, (Object) null);
    }

    private final void setModuleConfig(ComplexLayerCommInterface complexLayerCommInterface) {
        Logger.d$default(Logger.INSTANCE, TAG, "setModuleConfig", false, 4, (Object) null);
        CookieConfig cookieConfig = new CookieConfig((String) null, (String) null, (ArrayList) null, (String) null, (List) null, (List) null, 63, (DefaultConstructorMarker) null);
        UrlUtility urlUtility = UrlUtility.INSTANCE;
        cookieConfig.setMainUrl(urlUtility.getMrcUrl());
        cookieConfig.setReplicatedCookieUrl(urlUtility.getMy11circleUrl());
        String[] strArr = {urlUtility.getMy11circleUrl(), urlUtility.getPokerBaseurl()};
        cookieConfig.setReplicateUrlDataList(q.b(new ReplicateUrlData(".rummycircle.com", ".my11circle.com", urlUtility.getMy11circleUrl(), new String[]{".my11circle.com", ".pokercircle.co.in"}, strArr)));
        cookieConfig.setExcludeEndPoints(NativeUtil.INSTANCE.getExcludeList());
        complexLayerCommInterface.setConfig("network", "setcookieconfig", cookieConfig);
        complexLayerCommInterface.setConfig("network", "setcommonheader", RouterUtility.INSTANCE.getCommonHeaderHashMap());
    }

    public void onAttributionResponse(@NotNull JSONObject jSONObject) {
        Intrinsics.checkNotNullParameter(jSONObject, "result");
        Logger.d$default(Logger.INSTANCE, TAG, "onAttributionResponse::action:: " + jSONObject.optString("action"), false, 4, (Object) null);
        String optString = jSONObject.optString("action");
        if (optString != null) {
            switch (optString.hashCode()) {
                case -1248764669:
                    if (optString.equals("getNaeAttribution")) {
                        sendInitAttributionSuccessEvent(jSONObject);
                        break;
                    }
                    break;
                case -325042890:
                    if (optString.equals("on_Param_Error")) {
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put("errorMsg", jSONObject.optString("data"));
                        String jSONObject3 = jSONObject2.toString();
                        Intrinsics.checkNotNullExpressionValue(jSONObject3, "JSONObject().apply {\n   …             }.toString()");
                        sendInitAttributionErrorEvent(jSONObject3);
                        break;
                    }
                    break;
                case 476237917:
                    if (optString.equals("on_Nae_Attribution_Failure")) {
                        PreferenceManager companion = PreferenceManager.Companion.getInstance();
                        Boolean bool = Boolean.TRUE;
                        companion.setBafComplete(bool);
                        if (!RunTimeVarsUtility.INSTANCE.getBooleanRunTimeVar("isNaeResponseReceived", false)) {
                            KrakenApplication.Companion.updateRuntimeVar("isNaeResponseReceived", bool);
                            prepareTrackingUrlForNAEFailure();
                            JSONObject jSONObject4 = new JSONObject();
                            jSONObject4.put("errorMsg", "ON_NAE_ATTRIBUTION_FAILURE");
                            String jSONObject5 = jSONObject4.toString();
                            Intrinsics.checkNotNullExpressionValue(jSONObject5, "JSONObject().apply {\n   …             }.toString()");
                            sendInitAttributionErrorEvent(jSONObject5);
                            break;
                        }
                    }
                    break;
                case 1515924574:
                    if (optString.equals("on_Nae_Attribution_Completed")) {
                        if (!RunTimeVarsUtility.INSTANCE.getBooleanRunTimeVar("isNaeResponseReceived", false)) {
                            KrakenApplication.Companion.updateRuntimeVar("isNaeResponseReceived", Boolean.TRUE);
                            prepareTrackingUrlForNAESuccess();
                        }
                        PreferenceManager.Companion.getInstance().setBafComplete(Boolean.TRUE);
                        break;
                    }
                    break;
            }
        }
    }

    public final void route(@NotNull ComplexLayerCommInterface complexLayerCommInterface, @NotNull PGEvent pGEvent) {
        Intrinsics.checkNotNullParameter(complexLayerCommInterface, "commInterface");
        Intrinsics.checkNotNullParameter(pGEvent, "pgEvent");
        Logger logger = Logger.INSTANCE;
        Logger.d$default(logger, TAG, "route", false, 4, (Object) null);
        this.communicationInterface = complexLayerCommInterface;
        if (!Intrinsics.a(pGEvent.getEventData().getName(), OnBoardingComplexEvents.RC_INIT_ATTRIBUTION) || IS_APP_LAUNCH_EVENT_FIRED) {
            return;
        }
        IS_APP_LAUNCH_EVENT_FIRED = true;
        Logger.d$default(logger, TAG, OnBoardingComplexEvents.RC_INIT_ATTRIBUTION, false, 4, (Object) null);
        EventInfo callbackData = pGEvent.getCallbackData();
        if (callbackData == null) {
            callbackData = clientEventInfo;
        }
        clientEventInfo = callbackData;
        this.intentData = pGEvent.getPayloadInfo();
        setModuleConfig(complexLayerCommInterface);
        initAttribution();
    }
}