Ice Scream Tycoon v1.0.4版本的 MD5 值为:f589390679eebf9f2a1d825e8c8a632e

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


package com.yodo1.mas.helper;

import android.app.Activity;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.gson.Gson;
import com.google.gson.b.a;
import com.tapjoy.TJAdUnitConstants;
import com.tapjoy.TapjoyConstants;
import com.vungle.warren.VungleApiClient;
import com.yodo1.mas.Yodo1Mas;
import com.yodo1.mas.analytics.Yodo1MasSensorHelper;
import com.yodo1.mas.banner.Yodo1MasBannerAdListener;
import com.yodo1.mas.banner.Yodo1MasBannerAdSize;
import com.yodo1.mas.banner.Yodo1MasBannerAdView;
import com.yodo1.mas.banner.Yodo1MasBannerHelper;
import com.yodo1.mas.error.Yodo1MasError;
import com.yodo1.mas.event.Yodo1MasAdEvent;
import com.yodo1.mas.helper.Yodo1MasHelper;
import com.yodo1.mas.helper.Yodo1MasPrivacyDialogHelper;
import com.yodo1.mas.helper.model.TestModeUtil;
import com.yodo1.mas.helper.model.Yodo1MasAdBuildConfig;
import com.yodo1.mas.helper.model.Yodo1MasInitConfig;
import com.yodo1.mas.helper.model.Yodo1MasInitData;
import com.yodo1.mas.helper.model.Yodo1MasInitMediationInfo;
import com.yodo1.mas.helper.model.Yodo1MasInitNetworkInfo;
import com.yodo1.mas.helper.model.Yodo1MasNetworkAdvert;
import com.yodo1.mas.helper.model.Yodo1MasNetworkConfig;
import com.yodo1.mas.helper.model.Yodo1MasNetworkMediation;
import com.yodo1.mas.helper.model.Yodo1MasNetworkPlacement;
import com.yodo1.mas.helper.model.Yodo1MasNetworkWaterfall;
import com.yodo1.mas.mediation.Yodo1MasAdapterBase;
import com.yodo1.mas.utils.Yodo1MasBannerUtil;
import com.yodo1.mas.utils.Yodo1MasUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Headers;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.json.JSONException;
import org.json.JSONObject;

public class Yodo1MasHelper {
    public static final String ACTION_SDK_INITIALIZED = "action_sdk_initialized";
    private static final String KEY_ADMO_ID = "YODO1_ADMOB_ID";
    private static final String KEY_APP_BUNDLE_ID = "YODO1_APP_BUNDLE_ID";
    private static final String KEY_APP_KEY = "YODO1_APP_KEY";
    private static final String KEY_APP_VERSION = "YODO1_APP_VERSION";
    private static final String KEY_GAID = "YODO1_GAID";
    private static final String KEY_INIT_MSG = "YODO1_INIT_MSG";
    private static final String KEY_INIT_STATUS = "YODO1_INIT_STATUS";
    private static final String KEY_INIT_TIME = "YODO1_INIT_TIME";
    private static final String KEY_SDK_TYPE = "YODO1_SDK_TYPE";
    private static final String KEY_SDK_VERSION = "YODO1_SDK_VERSION";
    private static final String KEY_TEST_DEVICE = "YODO1_TEST_DEVICE";
    private static final String KEY_TEST_MODE = "YODO1_TEST_MODE";
    private static final String KEY_USER_AGE = "YODO1_USER_AGE";
    private static final String TAG = "[Yodo1MasHelper]";
    private static Yodo1MasHelper helper;
    private Yodo1MasAdBuildConfig adBuildConfig;
    private Application application;
    private Yodo1Mas.BannerListener bannerListener;
    private BroadcastReceiver broadcastReceiver;
    private Activity currentActivity;
    private Yodo1MasInitConfig initConfig;
    private volatile boolean isFullScreenAdShowing;
    private boolean needCalibrateTime;
    private Yodo1MasNetworkConfig networkConfig;
    private long offsetTime;
    private SharedPreferences sharedPreferences;
    private int userAge;
    private final Map<String, Yodo1MasAdapterBase> mediationMap = new HashMap();
    private final Map<String, Object> appInfo = new HashMap();
    boolean keepCheckingV1 = false;
    private Yodo1MasBannerAdView bannerAdView = null;
    private boolean debug = false;
    public boolean isUseNewApi = false;
    private boolean isRequesting = false;
    private boolean isInit = false;
    private int initCount = 0;
    private boolean isDataTimeVerifyOn = false;
    private final Application.ActivityLifecycleCallbacks lifecycleCallback = new Application.ActivityLifecycleCallbacks() {
        @Override
        public void onActivityCreated(Activity activity, Bundle bundle) {
        }

        @Override
        public void onActivityDestroyed(Activity activity) {
        }

        @Override
        public void onActivityPaused(Activity activity) {
        }

        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
        }

        @Override
        public void onActivityStopped(Activity activity) {
        }

        @Override
        public void onActivityStarted(Activity activity) {
            Yodo1MasHelper.this.currentActivity = activity;
        }

        @Override
        public void onActivityResumed(Activity activity) {
            if (Yodo1MasHelper.this.isInit) {
                Yodo1MasAdConfigCheckHelper.getInstance().checkTheNewAdConfig(activity, " lifecycle onResume");
            }
        }
    };

    @Deprecated
    public boolean isBannerAdvertLoaded() {
        return true;
    }

    static int access$1312(Yodo1MasHelper yodo1MasHelper, int i) {
        int i2 = yodo1MasHelper.initCount + i;
        yodo1MasHelper.initCount = i2;
        return i2;
    }

    public static Yodo1MasHelper getInstance() {
        if (helper == null) {
            synchronized (Yodo1MasHelper.class) {
                if (helper == null) {
                    helper = new Yodo1MasHelper();
                }
            }
        }
        return helper;
    }

    private SharedPreferences getSharedPreferences(Application application) {
        SharedPreferences sharedPreferences = this.sharedPreferences;
        if (sharedPreferences != null) {
            return sharedPreferences;
        }
        if (application == null) {
            try {
                Class<?> cls = Class.forName("android.app.ActivityThread");
                application = (Application) cls.getMethod("getApplication", new Class[0]).invoke(cls.getMethod("currentActivityThread", new Class[0]).invoke(null, (Object[]) null), (Object[]) null);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        SharedPreferences sharedPreferences2 = application.getSharedPreferences("Yodo1Mas", 0);
        this.sharedPreferences = sharedPreferences2;
        return sharedPreferences2;
    }

    public void initSDK(Activity activity, String str, Yodo1Mas.InitListener initListener) {
        if (this.currentActivity != null) {
            return;
        }
        this.currentActivity = activity;
        if (this.application == null) {
            this.application = activity.getApplication();
        }
        if (this.isDataTimeVerifyOn) {
            getServerConfig(activity, str, initListener);
        } else {
            preInitSDK_(activity, str, initListener);
        }
    }

    public void preInitSDK_(final Activity activity, final String str, final Yodo1Mas.InitListener initListener) {
        Yodo1MasSensorHelper.initWithAppKey(activity, str, this.offsetTime, this.needCalibrateTime);
        Yodo1MasAdBuildConfig yodo1MasAdBuildConfig = this.adBuildConfig;
        boolean z = yodo1MasAdBuildConfig != null && yodo1MasAdBuildConfig.isEnableUserPrivacyDialog();
        Log.d(TAG, "initSDK: adBuildConfig=" + this.adBuildConfig + " isEnableUserPrivacyDialog=" + z);
        if (z) {
            int userAge = getUserAge();
            if (userAge > 0) {
                Log.d(TAG, "Privacy compliance has been agreed, the player's age is " + userAge);
                Yodo1MasPrivacy.getInstance().setPrivacyWithAge(userAge);
                initSDK_(activity, str, true, initListener);
                return;
            }
            Yodo1MasPrivacyDialogHelper.getInstance().showPrivacyDialog(activity, userAge, this.adBuildConfig.getUserAgreementUrl(), this.adBuildConfig.getPrivacyPolicyUrl(), this.adBuildConfig.getAgePopBuildConfig(), new Yodo1MasPrivacyDialogHelper.Yodo1MasPrivacyCallback() {
                @Override
                public void onResult(int i) {
                    Log.d(Yodo1MasHelper.TAG, "The player's age is " + i);
                    Yodo1MasHelper.this.setUserAge(i);
                    Yodo1MasPrivacy.getInstance().setPrivacyWithAge(i);
                    Yodo1MasHelper.this.initSDK_(activity, str, true, initListener);
                }
            });
            return;
        }
        initSDK_(activity, str, false, initListener);
    }

    public void initSDK_(Activity activity, String str, boolean z, Yodo1Mas.InitListener initListener) {
        if (!TextUtils.isEmpty(str)) {
            Yodo1MasSensorHelper.trackPrivacy(z, Yodo1MasPrivacy.getInstance().getGDPRUserConsentString(), Yodo1MasPrivacy.getInstance().getCOPPAAgeRestrictedString(), Yodo1MasPrivacy.getInstance().getCCPADoNotSellString(), Yodo1MasPrivacy.getInstance().getGDPRUserConsent(), Yodo1MasPrivacy.getInstance().getCOPPAAgeRestricted(), Yodo1MasPrivacy.getInstance().getCCPADoNotSell());
            doInitInfo(activity, str, initListener);
        } else if (initListener != null) {
            initListener.onMasInitFailed(new Yodo1MasError(Yodo1MasError.CODE_APP_ID_ILLEGAL, "appKey is invalid"));
        }
    }

    private void doInitInfo(final Activity activity, final String str, final Yodo1Mas.InitListener initListener) {
        new Thread(new Runnable() {
            @Override
            public final void run() {
                Yodo1MasHelper.this.lambda$doInitInfo$0$Yodo1MasHelper(activity, str, initListener);
            }
        }).start();
    }

    public void lambda$doInitInfo$0$Yodo1MasHelper(final Activity activity, final String str, final Yodo1Mas.InitListener initListener) {
        AdvertisingIdClient.Info advertisingId;
        if (this.appInfo.get(KEY_SDK_VERSION) == null) {
            String metaData = Yodo1MasUtils.getMetaData(activity.getApplicationContext(), "MAS_SDK_VERSION_NAME", "");
            if (TextUtils.isEmpty(metaData)) {
                metaData = Yodo1MasUtils.getSdkVersion();
            }
            this.appInfo.put(KEY_SDK_VERSION, metaData);
        }
        if (this.appInfo.get(KEY_SDK_TYPE) == null) {
            String sdkType = Yodo1MasUtils.getSdkType(this.application.getApplicationContext());
            if (!TextUtils.isEmpty(sdkType)) {
                char c = 65535;
                switch (sdkType.hashCode()) {
                    case -1081287735:
                        if (sdkType.equals("mas_gp")) {
                            c = 1;
                            break;
                        }
                        break;
                    case 699200837:
                        if (sdkType.equals("mas_gp_full")) {
                            c = 0;
                            break;
                        }
                        break;
                    case 699368292:
                        if (sdkType.equals("mas_gp_lite")) {
                            c = 3;
                            break;
                        }
                        break;
                    case 1898666138:
                        if (sdkType.equals("mas_gp_family")) {
                            c = 2;
                            break;
                        }
                        break;
                }
                String str2 = c != 0 ? c != 1 ? c != 2 ? c != 3 ? null : "Lite" : "GooglePolicy" : "Standard" : "Full";
                if (!TextUtils.isEmpty(str2)) {
                    this.appInfo.put(KEY_SDK_TYPE, str2);
                }
            }
        }
        if (this.appInfo.get(KEY_APP_KEY) == null) {
            this.appInfo.put(KEY_APP_KEY, str);
        }
        if (this.appInfo.get(KEY_APP_VERSION) == null) {
            this.appInfo.put(KEY_APP_VERSION, Yodo1MasUtils.getAppVersion(activity));
        }
        if (this.appInfo.get(KEY_APP_BUNDLE_ID) == null) {
            this.appInfo.put(KEY_APP_BUNDLE_ID, activity.getPackageName());
        }
        if (this.appInfo.get(KEY_GAID) == null && !isCOPPAAgeRestricted() && (advertisingId = getAdvertisingId(activity)) != null) {
            this.appInfo.put(KEY_GAID, advertisingId.getId());
        }
        if (this.appInfo.get(KEY_ADMO_ID) == null) {
            String metaData2 = Yodo1MasUtils.getMetaData(activity.getApplicationContext(), "com.google.android.gms.ads.APPLICATION_ID", "");
            if (!TextUtils.isEmpty(metaData2)) {
                this.appInfo.put(KEY_ADMO_ID, metaData2);
            }
        }
        doInit(activity, str, initListener);
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public void run() {
                Yodo1MasHelper.this.registerReceiver(activity, str, initListener);
            }
        }, 3000L);
    }

    public void registerReceiver(final Activity activity, final String str, final Yodo1Mas.InitListener initListener) {
        this.broadcastReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                if (Yodo1MasHelper.this.isInit) {
                    return;
                }
                NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
                if ((activeNetworkInfo != null && activeNetworkInfo.isConnected()) && !Yodo1MasHelper.this.isRequesting) {
                    Yodo1MasHelper.this.doInit(activity, str, initListener);
                }
            }
        };
        activity.getApplication().registerReceiver(this.broadcastReceiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
        activity.getApplication().unregisterActivityLifecycleCallbacks(this.lifecycleCallback);
        activity.getApplication().registerActivityLifecycleCallbacks(this.lifecycleCallback);
    }

    public void doInit(Activity activity, String str, Yodo1Mas.InitListener initListener) {
        NetworkInfo activeNetworkInfo = ((ConnectivityManager) activity.getSystemService("connectivity")).getActiveNetworkInfo();
        boolean z = activeNetworkInfo != null && activeNetworkInfo.isConnected();
        if (this.isInit || !z || this.isRequesting) {
            if (!this.isInit || initListener == null) {
                return;
            }
            initListener.onMasInitSuccessful();
            return;
        }
        this.isRequesting = true;
        boolean metaData = Yodo1MasUtils.getMetaData((Context) activity, "com.yodo1.mas.DEBUG", false);
        boolean metaData2 = Yodo1MasUtils.getMetaData((Context) activity, "com.yodo1.mas.Config", false);
        String metaData3 = Yodo1MasUtils.getMetaData(activity, "com.yodo1.mas.API", "https://sdk.mas.yodo1.me/v1/init/");
        StringBuilder sb = new StringBuilder();
        if (metaData) {
            sb.append(metaData3);
        } else {
            sb.append("https://sdk.mas.yodo1.com/v1/init/");
        }
        sb.append(str);
        if (metaData) {
            sb.append("?country=");
            sb.append(Locale.getDefault().getCountry());
        }
        OkHttpClient okHttpClient = new OkHttpClient();
        Request request = getRequest(activity, sb.toString());
        trackInitStart();
        okHttpClient.newCall(request).enqueue(new AnonymousClass5(initListener, activity, metaData, metaData2));
    }

    public class AnonymousClass5 implements Callback {
        final Activity val$activity;
        final Yodo1Mas.InitListener val$callback;
        final boolean val$debug;
        final boolean val$debugConfig;

        AnonymousClass5(Yodo1Mas.InitListener initListener, Activity activity, boolean z, boolean z2) {
            this.val$callback = initListener;
            this.val$activity = activity;
            this.val$debug = z;
            this.val$debugConfig = z2;
        }

        @Override
        public void onFailure(Call call, IOException iOException) {
            Yodo1MasHelper.this.trackInitEnd(false, 0, iOException.getLocalizedMessage());
            Yodo1MasHelper.this.isRequesting = false;
            Yodo1MasHelper.this.appInfo.put(Yodo1MasHelper.KEY_INIT_STATUS, false);
            Yodo1MasHelper.this.appInfo.put(Yodo1MasHelper.KEY_INIT_MSG, "Init failed (Error Code: " + Yodo1MasError.CODE_CONFIG_NETWORK + ", " + iOException.getLocalizedMessage() + ")");
            Yodo1MasHelper.this.printInitLog();
            if (this.val$callback != null) {
                final Yodo1MasError yodo1MasError = new Yodo1MasError(Yodo1MasError.CODE_CONFIG_NETWORK, iOException.getMessage());
                Activity activity = this.val$activity;
                final Yodo1Mas.InitListener initListener = this.val$callback;
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        Yodo1Mas.InitListener.this.onMasInitFailed(yodo1MasError);
                    }
                });
            }
        }

        @Override
        public void onResponse(Call call, Response response) throws IOException {
            Log.d(Yodo1MasHelper.TAG, "onResponse - code:" + response.code());
            Yodo1MasHelper.this.trackInitEnd(true, response.code(), response.message());
            if (response.code() != 200) {
                Yodo1MasHelper.this.isRequesting = false;
                String str = "Init failed (Error Code: -100501, response code:" + response.code() + " response message:" + response.message() + ")";
                Yodo1MasHelper.this.appInfo.put(Yodo1MasHelper.KEY_INIT_STATUS, false);
                Yodo1MasHelper.this.appInfo.put(Yodo1MasHelper.KEY_INIT_MSG, str);
                Yodo1MasHelper.this.printInitLog();
                if (this.val$callback != null) {
                    final Yodo1MasError yodo1MasError = new Yodo1MasError(Yodo1MasError.CODE_CONFIG_GET, str);
                    Activity activity = this.val$activity;
                    final Yodo1Mas.InitListener initListener = this.val$callback;
                    activity.runOnUiThread(new Runnable() {
                        @Override
                        public final void run() {
                            Yodo1Mas.InitListener.this.onMasInitFailed(yodo1MasError);
                        }
                    });
                    return;
                }
                return;
            }
            ResponseBody body = response.body();
            if (body == null) {
                Yodo1MasHelper.this.isRequesting = false;
                Yodo1MasHelper.this.appInfo.put(Yodo1MasHelper.KEY_INIT_STATUS, false);
                Yodo1MasHelper.this.appInfo.put(Yodo1MasHelper.KEY_INIT_MSG, "Init failed (Error Code: -100501, body is null");
                Yodo1MasHelper.this.printInitLog();
                if (this.val$callback != null) {
                    final Yodo1MasError yodo1MasError2 = new Yodo1MasError(Yodo1MasError.CODE_CONFIG_GET, "Init failed (Error Code: -100501, body is null");
                    Activity activity2 = this.val$activity;
                    final Yodo1Mas.InitListener initListener2 = this.val$callback;
                    activity2.runOnUiThread(new Runnable() {
                        @Override
                        public final void run() {
                            Yodo1Mas.InitListener.this.onMasInitFailed(yodo1MasError2);
                        }
                    });
                    return;
                }
                return;
            }
            Yodo1MasHelper.this.dealWithGetAdConfigResponse(this.val$activity, body.string(), this.val$debug, this.val$debugConfig, this.val$callback, Yodo1MasHelper.this.getPackageName(this.val$activity));
        }
    }

    private Request getRequest(Activity activity, String str) {
        String sdkVersion = getSdkVersion();
        String appVersion = getAppVersion(activity);
        Headers.Builder builder = new Headers.Builder();
        builder.add("sdk-version", sdkVersion);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("sdk_version", sdkVersion);
            jSONObject.put(TapjoyConstants.TJC_APP_VERSION_NAME, appVersion);
            String gaid = getGaid();
            if (!TextUtils.isEmpty(gaid) && !getInstance().isCOPPAAgeRestricted()) {
                jSONObject.put(VungleApiClient.GAID, gaid);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        RequestBody create = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), jSONObject.toString());
        trackInitStart();
        Request.Builder builder2 = new Request.Builder();
        builder2.url(str);
        builder2.headers(builder.build());
        builder2.post(create);
        return builder2.build();
    }

    public void getServerConfig(Activity activity, String str, Yodo1Mas.InitListener initListener) {
        new OkHttpClient.Builder().connectTimeout(2L, TimeUnit.SECONDS).readTimeout(1L, TimeUnit.SECONDS).build().newCall(getRequest(activity, "https://sdk-mas.yodo1.com/v1/config/" + str)).enqueue(new AnonymousClass6(activity, str, initListener, System.currentTimeMillis()));
    }

    public class AnonymousClass6 implements Callback {
        final Activity val$activity;
        final String val$appKey;
        final Yodo1Mas.InitListener val$callback;
        final long val$strtTime;

        AnonymousClass6(Activity activity, String str, Yodo1Mas.InitListener initListener, long j) {
            this.val$activity = activity;
            this.val$appKey = str;
            this.val$callback = initListener;
            this.val$strtTime = j;
        }

        @Override
        public void onFailure(Call call, final IOException iOException) {
            final Activity activity = this.val$activity;
            final String str = this.val$appKey;
            final Yodo1Mas.InitListener initListener = this.val$callback;
            final long j = this.val$strtTime;
            activity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    Yodo1MasHelper.AnonymousClass6.this.lambda$onFailure$0$Yodo1MasHelper$6(activity, str, initListener, j, iOException);
                }
            });
        }

        public void lambda$onFailure$0$Yodo1MasHelper$6(Activity activity, String str, Yodo1Mas.InitListener initListener, long j, IOException iOException) {
            Yodo1MasHelper.this.preInitSDK_(activity, str, initListener);
            Yodo1MasHelper.this.trackGetServerConfigEnd(j, System.currentTimeMillis(), false, 0, iOException.getLocalizedMessage(), 0L, Yodo1MasHelper.this.offsetTime, Yodo1MasHelper.this.needCalibrateTime);
        }

        @Override
        public void onResponse(Call call, final Response response) throws IOException {
            Log.d(Yodo1MasHelper.TAG, "getServerConfig onResponse - code:" + response.code());
            final long currentTimeMillis = System.currentTimeMillis();
            ResponseBody body = response.body();
            if (body != null) {
                try {
                    JSONObject jSONObject = new JSONObject(body.string());
                    if (jSONObject.has("system")) {
                        JSONObject jSONObject2 = jSONObject.getJSONObject("system");
                        long j = jSONObject2.has("timestamp") ? jSONObject2.getLong("timestamp") : 0L;
                        r4 = jSONObject2.has(TJAdUnitConstants.String.INTERVAL) ? jSONObject2.getLong(TJAdUnitConstants.String.INTERVAL) : 0L;
                        Yodo1MasHelper.this.dealServerTime(j, r4);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            final long j2 = r4;
            final Activity activity = this.val$activity;
            final String str = this.val$appKey;
            final Yodo1Mas.InitListener initListener = this.val$callback;
            final long j3 = this.val$strtTime;
            activity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    Yodo1MasHelper.AnonymousClass6.this.lambda$onResponse$1$Yodo1MasHelper$6(activity, str, initListener, j3, currentTimeMillis, response, j2);
                }
            });
        }

        public void lambda$onResponse$1$Yodo1MasHelper$6(Activity activity, String str, Yodo1Mas.InitListener initListener, long j, long j2, Response response, long j3) {
            Yodo1MasHelper.this.preInitSDK_(activity, str, initListener);
            Yodo1MasHelper.this.trackGetServerConfigEnd(j, j2, true, response.code(), response.message(), j3, Yodo1MasHelper.this.offsetTime, Yodo1MasHelper.this.needCalibrateTime);
        }
    }

    public void dealServerTime(long j, long j2) {
        if (j <= 0 || j2 <= 0) {
            return;
        }
        long currentTimeMillis = j - System.currentTimeMillis();
        if (Math.abs(currentTimeMillis) > j2) {
            this.offsetTime = currentTimeMillis;
            this.needCalibrateTime = true;
        }
    }

    public void dealWithGetAdConfigResponse(final Activity activity, final String str, boolean z, boolean z2, final Yodo1Mas.InitListener initListener, String str2) {
        if (z && z2) {
            StringBuilder sb = new StringBuilder();
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(activity.getAssets().open("Yodo1MasConfig.json")));
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    } else {
                        sb.append(readLine);
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (!TextUtils.isEmpty(sb)) {
                str = sb.toString();
            }
        }
        Yodo1MasInitData yodo1MasInitData = (Yodo1MasInitData) new Gson().fromJson(str, new a<Yodo1MasInitData>() {
        }.getType());
        if (yodo1MasInitData != null && yodo1MasInitData.init_config != null && yodo1MasInitData.ad_network_config != null) {
            Log.d(TAG, "Get config successful - " + new Gson().toJson(yodo1MasInitData));
            if ("null".equals(yodo1MasInitData.bundle_id) || str2 == null || str2.equals(yodo1MasInitData.bundle_id)) {
                this.initConfig = yodo1MasInitData.init_config;
                this.networkConfig = yodo1MasInitData.ad_network_config;
                if (yodo1MasInitData.test_mode.intValue() == 1) {
                    TestModeUtil.dealWithTestModel(yodo1MasInitData);
                    this.appInfo.put(KEY_TEST_MODE, "On");
                    this.appInfo.put(KEY_TEST_DEVICE, "On");
                } else {
                    this.appInfo.put(KEY_TEST_MODE, "Off");
                    this.appInfo.put(KEY_TEST_DEVICE, "Off");
                }
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        Yodo1MasHelper.this.lambda$dealWithGetAdConfigResponse$1$Yodo1MasHelper(activity, initListener, str);
                    }
                });
                return;
            }
            this.isRequesting = false;
            this.appInfo.put(KEY_INIT_STATUS, false);
            this.appInfo.put(KEY_INIT_MSG, "Init failed (Error Code: -400001,AppKey Bundle ID AdMob ID not match please check your app profile)");
            printInitLog();
            if (initListener != null) {
                final Yodo1MasError yodo1MasError = new Yodo1MasError(Yodo1MasError.CODE_APP_ID_UNVERIFIED, "Init failed (Error Code: -400001,AppKey Bundle ID AdMob ID not match please check your app profile)");
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        Yodo1Mas.InitListener.this.onMasInitFailed(yodo1MasError);
                    }
                });
                return;
            }
            return;
        }
        this.isRequesting = false;
        this.appInfo.put(KEY_INIT_STATUS, false);
        this.appInfo.put(KEY_INIT_MSG, "Init failed (Error Code: -100501, config is null");
        printInitLog();
        if (initListener != null) {
            final Yodo1MasError yodo1MasError2 = new Yodo1MasError(Yodo1MasError.CODE_CONFIG_GET, "Init failed (Error Code: -100501, config is null");
            activity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    Yodo1Mas.InitListener.this.onMasInitFailed(yodo1MasError2);
                }
            });
        }
    }

    public void lambda$dealWithGetAdConfigResponse$1$Yodo1MasHelper(Activity activity, Yodo1Mas.InitListener initListener, String str) {
        doInitAdapter(activity, initListener);
        Yodo1MasAdConfigCheckHelper.getInstance().saveAdConfig(str);
    }

    private void trackInitStart() {
        this.appInfo.put(KEY_INIT_TIME, Long.valueOf(System.currentTimeMillis() / 1000));
    }

    public void trackInitEnd(boolean z, int i, String str) {
        Object obj = this.appInfo.get(KEY_INIT_TIME);
        Yodo1MasSensorHelper.trackAdInit(z, i, str, (System.currentTimeMillis() / 1000) - (obj != null ? ((Long) obj).longValue() : System.currentTimeMillis() / 1000));
    }

    public void trackGetServerConfigEnd(long j, long j2, boolean z, int i, String str, long j3, long j4, boolean z2) {
        double divisionForDouble = Yodo1MasUtils.divisionForDouble(j2 - j, 1000.0d);
        double divisionForDouble2 = Yodo1MasUtils.divisionForDouble(j4, 1000.0d);
        Yodo1MasSensorHelper.trackDataTimerVerify(z, i, str, divisionForDouble, j3, divisionForDouble2, z2 ? divisionForDouble2 : 0.0d);
    }

    public void printInitLog() {
        StringBuilder sb = new StringBuilder();
        sb.append("\n******************************************\n");
        sb.append("Yodo1MasSDK\n");
        sb.append("MAS SDK Version: ");
        sb.append(this.appInfo.get(KEY_SDK_VERSION));
        sb.append("-");
        sb.append(this.appInfo.get(KEY_SDK_TYPE));
        sb.append("\n");
        sb.append("AppKey: ");
        sb.append(this.appInfo.get(KEY_APP_KEY));
        sb.append("\n");
        sb.append("Bundle ID: ");
        sb.append(this.appInfo.get(KEY_APP_BUNDLE_ID));
        sb.append("\n");
        if (this.appInfo.get(KEY_INIT_STATUS) != null) {
            sb.append("Init Status: ");
            sb.append(this.appInfo.get(KEY_INIT_MSG));
            sb.append("\n");
        } else {
            sb.append("Init Status: ");
            sb.append("None");
            sb.append("\n");
        }
        if (this.appInfo.get(KEY_GAID) != null && !isCOPPAAgeRestricted()) {
            sb.append("GAID is: ");
            sb.append(this.appInfo.get(KEY_GAID));
            sb.append(" (use this for test devices)\n");
        }
        if (this.appInfo.get(KEY_ADMO_ID) != null) {
            sb.append("AdMobId is: ");
            sb.append(this.appInfo.get(KEY_ADMO_ID));
            sb.append("\n");
        } else {
            sb.append("AdMobId is: ");
            sb.append("None(please fill correct AdMobId)");
            sb.append("\n");
        }
        if (this.appInfo.get(KEY_TEST_DEVICE) != null) {
            sb.append("Test Device: ");
            sb.append(this.appInfo.get(KEY_TEST_DEVICE));
            sb.append("\n");
        } else {
            sb.append("Test Device: ");
            sb.append("None");
            sb.append("\n");
        }
        if (this.appInfo.get(KEY_TEST_MODE) != null) {
            sb.append("Test Ad: ");
            sb.append(this.appInfo.get(KEY_TEST_MODE));
            sb.append("\n");
        } else {
            sb.append("Test Ad: ");
            sb.append("None");
            sb.append("\n");
        }
        sb.append("Age Restricted User");
        sb.append(Yodo1MasPrivacy.getInstance().getCOPPAAgeRestrictedPrintValue());
        sb.append("\n");
        sb.append("Has User Consent");
        sb.append(Yodo1MasPrivacy.getInstance().getGDPRUserConsentPrintValue());
        sb.append("\n");
        sb.append("\"Do Not Sell\"");
        sb.append(Yodo1MasPrivacy.getInstance().getCCPADoNotSellPrintValue());
        sb.append("\n");
        sb.append("******************************************");
        Log.d(TAG, sb.toString());
    }

    private void doInitAdapter(Activity activity, Yodo1Mas.InitListener initListener) {
        Log.d(TAG, "The initialization of adapters is start...");
        HashMap hashMap = new HashMap();
        hashMap.put("ADMOB", "admob.Yodo1MasAdMobMaxAdapter");
        hashMap.put("APPLOVIN", "applovin.Yodo1MasAppLovinMaxAdapter");
        hashMap.put("IRONSOURCE", "ironsource.Yodo1MasIronSourceMaxAdapter");
        HashMap hashMap2 = new HashMap();
        hashMap2.put("admob", "admob.Yodo1MasAdMobAdapter");
        hashMap2.put("applovin", "applovin.Yodo1MasAppLovinAdapter");
        hashMap2.put("facebook", "facebook.Yodo1MasFacebookAdapter");
        hashMap2.put("fyber", "fyber.Yodo1MasFyberAdapter");
        hashMap2.put("inmobi", "inmobi.Yodo1MasInMobiAdapter");
        hashMap2.put("ironsource", "ironsource.Yodo1MasIronSourceAdapter");
        hashMap2.put("mytarget", "mytarget.Yodo1MasMyTargetAdapter");
        hashMap2.put("tapjoy", "tapjoy.Yodo1MasTapjoyAdapter");
        hashMap2.put("unity", "unityads.Yodo1MasUnityAdsAdapter");
        hashMap2.put("vungle", "vungle.Yodo1MasVungleAdapter");
        hashMap2.put("yandex", "yandex.Yodo1MasYandexAdapter");
        hashMap2.put("yodo1", "yodo1.Yodo1MasYodo1Adapter");
        if (this.initConfig.mediation_list != null && !this.initConfig.mediation_list.isEmpty()) {
            Log.d(TAG, "Initializing the mediation adapter...");
            for (Yodo1MasInitMediationInfo yodo1MasInitMediationInfo : this.initConfig.mediation_list) {
                String str = yodo1MasInitMediationInfo.name;
                doInitAdapter(activity, str, (String) hashMap.get(str), yodo1MasInitMediationInfo.app_id, yodo1MasInitMediationInfo.app_key, initListener);
            }
        } else {
            Log.d(TAG, "The mediation config is empty");
        }
        if (this.initConfig.ad_network_list != null && !this.initConfig.ad_network_list.isEmpty()) {
            Log.d(TAG, "Initializing the network adapter...");
            for (Yodo1MasInitNetworkInfo yodo1MasInitNetworkInfo : this.initConfig.ad_network_list) {
                String str2 = yodo1MasInitNetworkInfo.ad_network_name;
                doInitAdapter(activity, str2, (String) hashMap2.get(str2), yodo1MasInitNetworkInfo.ad_network_app_id, yodo1MasInitNetworkInfo.ad_network_app_key, initListener);
            }
        } else {
            Log.d(TAG, "The network config is empty");
        }
        Log.d(TAG, "The initialization of adapters is end");
    }

    public void lambda$doInitSuccessful$4$Yodo1MasHelper() {
        if (this.keepCheckingV1) {
            this.keepCheckingV1 = false;
            reShowBannerAdvert();
        } else {
            if (!Yodo1MasBannerHelper.getInstance().isKeepCheckingV2() || this.keepCheckingV1) {
                return;
            }
            Yodo1MasBannerHelper.getInstance().setKeepCheckingV2(false);
            Yodo1MasBannerHelper.getInstance().checkingLoadBannerAd();
        }
    }

    private void doInitAdapter(final Activity activity, final String str, String str2, String str3, String str4, final Yodo1Mas.InitListener initListener) {
        if (!TextUtils.isEmpty(str2)) {
            final String str5 = "com.yodo1.mas.mediation." + str2;
            Object obj = null;
            try {
                obj = Class.forName(str5).newInstance();
            } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
                e.printStackTrace();
            }
            if (obj instanceof Yodo1MasAdapterBase) {
                Yodo1MasAdapterBase.Config config = new Yodo1MasAdapterBase.Config(str, str3, str4);
                Yodo1MasAdapterBase yodo1MasAdapterBase = (Yodo1MasAdapterBase) obj;
                this.mediationMap.put(str, yodo1MasAdapterBase);
                doInitAdvert(activity, str);
                yodo1MasAdapterBase.initSDK(activity, config, new Yodo1MasAdapterBase.InitCallback() {
                    @Override
                    public void onAdapterInitSuccessful(String str6) {
                        Yodo1MasHelper.access$1312(Yodo1MasHelper.this, 1);
                        if (Yodo1MasHelper.this.initCount >= Yodo1MasHelper.this.mediationMap.size()) {
                            Yodo1MasHelper.this.doInitSuccessful(activity, initListener);
                        }
                        Log.d(Yodo1MasHelper.TAG, "adapter init successful - " + str + ":" + str5);
                    }

                    @Override
                    public void onAdapterInitFailed(String str6, Yodo1MasError yodo1MasError) {
                        Yodo1MasHelper.access$1312(Yodo1MasHelper.this, 1);
                        if (Yodo1MasHelper.this.initCount >= Yodo1MasHelper.this.mediationMap.size()) {
                            Yodo1MasHelper.this.doInitSuccessful(activity, initListener);
                        }
                        Log.d(Yodo1MasHelper.TAG, "adapter init failed - " + str + ":" + str5 + "," + yodo1MasError.getMessage());
                    }
                });
                return;
            }
            if (obj == null) {
                Log.d(TAG, "adapter class not found - " + str5);
                return;
            }
            Log.d(TAG, "Yodo1MasAdapterBase - " + str5);
            return;
        }
        Log.d(TAG, "adapter init - adapter not found,sdk version is too low:" + str);
    }

    private void doInitAdvert(Activity activity, String str) {
        Yodo1MasNetworkConfig yodo1MasNetworkConfig = this.networkConfig;
        if (yodo1MasNetworkConfig == null) {
            return;
        }
        if (yodo1MasNetworkConfig.reward != null) {
            doInitAdvert(activity, this.networkConfig.reward, Yodo1Mas.AdType.Reward, str);
        }
        if (this.networkConfig.interstitial != null) {
            doInitAdvert(activity, this.networkConfig.interstitial, Yodo1Mas.AdType.Interstitial, str);
        }
        if (this.networkConfig.banner != null) {
            doInitAdvert(activity, this.networkConfig.banner, Yodo1Mas.AdType.Banner, str);
        }
        if (this.networkConfig.nativeads != null) {
            doInitAdvert(activity, this.networkConfig.nativeads, Yodo1Mas.AdType.Native, str);
        }
    }

    private void doInitAdvert(Activity activity, Yodo1MasNetworkAdvert yodo1MasNetworkAdvert, Yodo1Mas.AdType adType, String str) {
        Yodo1MasAdapterBase yodo1MasAdapterBase;
        Yodo1MasAdapterBase yodo1MasAdapterBase2;
        if (yodo1MasNetworkAdvert.mediation_list != null && !yodo1MasNetworkAdvert.mediation_list.isEmpty()) {
            for (Yodo1MasNetworkMediation yodo1MasNetworkMediation : yodo1MasNetworkAdvert.mediation_list) {
                String str2 = yodo1MasNetworkMediation.name;
                String str3 = yodo1MasNetworkMediation.unit_id;
                if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3) && str2.equals(str) && (yodo1MasAdapterBase2 = this.mediationMap.get(str2)) != null) {
                    int i = AnonymousClass10.$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[adType.ordinal()];
                    if (i == 1) {
                        yodo1MasAdapterBase2.rewardAdIds.clear();
                        yodo1MasAdapterBase2.rewardAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
                    } else if (i == 2) {
                        yodo1MasAdapterBase2.interstitialAdIds.clear();
                        yodo1MasAdapterBase2.interstitialAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
                    } else if (i == 3) {
                        yodo1MasAdapterBase2.bannerAdIds.clear();
                        yodo1MasAdapterBase2.bannerAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
                    } else if (i == 4) {
                        yodo1MasAdapterBase2.nativeAdIds.clear();
                        yodo1MasAdapterBase2.nativeAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
                    }
                }
            }
        }
        if (yodo1MasNetworkAdvert.fallback_waterfall != null) {
            for (Yodo1MasNetworkWaterfall yodo1MasNetworkWaterfall : yodo1MasNetworkAdvert.fallback_waterfall) {
                List<Yodo1MasNetworkPlacement> list = yodo1MasNetworkWaterfall.placements;
                String str4 = yodo1MasNetworkWaterfall.network;
                if (!TextUtils.isEmpty(str4) && list != null && !list.isEmpty() && str4.equals(str) && (yodo1MasAdapterBase = this.mediationMap.get(str4)) != null) {
                    int i2 = AnonymousClass10.$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[adType.ordinal()];
                    if (i2 == 1) {
                        yodo1MasAdapterBase.rewardAdIds.clear();
                        for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement : list) {
                            yodo1MasAdapterBase.rewardAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement.network_code, yodo1MasNetworkPlacement));
                        }
                        Collections.sort(yodo1MasAdapterBase.rewardAdIds);
                    } else if (i2 == 2) {
                        yodo1MasAdapterBase.interstitialAdIds.clear();
                        for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement2 : list) {
                            yodo1MasAdapterBase.interstitialAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement2.network_code, yodo1MasNetworkPlacement2));
                        }
                        Collections.sort(yodo1MasAdapterBase.interstitialAdIds);
                    } else if (i2 == 3) {
                        yodo1MasAdapterBase.bannerAdIds.clear();
                        for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement3 : list) {
                            yodo1MasAdapterBase.bannerAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement3.network_code, yodo1MasNetworkPlacement3));
                        }
                        Collections.sort(yodo1MasAdapterBase.bannerAdIds);
                    } else if (i2 == 4) {
                        yodo1MasAdapterBase.nativeAdIds.clear();
                        for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement4 : list) {
                            yodo1MasAdapterBase.nativeAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement4.network_code, yodo1MasNetworkPlacement4));
                        }
                        Collections.sort(yodo1MasAdapterBase.nativeAdIds);
                    }
                }
            }
        }
    }

    public static class AnonymousClass10 {
        static final int[] $SwitchMap$com$yodo1$mas$Yodo1Mas$AdType;

        static {
            int[] iArr = new int[Yodo1Mas.AdType.values().length];
            $SwitchMap$com$yodo1$mas$Yodo1Mas$AdType = iArr;
            try {
                iArr[Yodo1Mas.AdType.Reward.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[Yodo1Mas.AdType.Interstitial.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[Yodo1Mas.AdType.Banner.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[Yodo1Mas.AdType.Native.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    public void doInitSuccessful(Activity activity, final Yodo1Mas.InitListener initListener) {
        if (!this.isUseNewApi) {
            loadRewardAdvert(activity);
            loadInterstitialAdvert(activity);
        }
        this.isRequesting = false;
        this.isInit = true;
        this.appInfo.put(KEY_INIT_STATUS, true);
        this.appInfo.put(KEY_INIT_MSG, "Init successfully (AppKey & Bundle ID Verified)");
        printInitLog();
        activity.sendBroadcast(new Intent(ACTION_SDK_INITIALIZED));
        if (initListener != null) {
            Objects.requireNonNull(initListener);
            activity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    Yodo1Mas.InitListener.this.onMasInitSuccessful();
                }
            });
        }
        activity.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Yodo1MasHelper.this.lambda$doInitSuccessful$4$Yodo1MasHelper();
            }
        });
    }

    public void setUserAge(int i) {
        this.userAge = i;
        if (i > 0) {
            SharedPreferences.Editor edit = getSharedPreferences(this.application).edit();
            edit.putString(KEY_USER_AGE, String.valueOf(i));
            edit.commit();
        }
    }

    public int getUserAge() {
        if (this.userAge <= 0) {
            String string = getSharedPreferences(this.application).getString(KEY_USER_AGE, null);
            this.userAge = string != null ? Integer.parseInt(string) : 0;
        }
        return this.userAge;
    }

    public void setGDPR(boolean z) {
        Yodo1MasPrivacy.getInstance().setGDPRUserConsent(z);
        Iterator<Yodo1MasAdapterBase> it = this.mediationMap.values().iterator();
        while (it.hasNext()) {
            it.next().updatePrivacy();
        }
    }

    public boolean isGDPRUserConsent() {
        return Yodo1MasPrivacy.getInstance().getGDPRUserConsent();
    }

    public void setCOPPA(boolean z) {
        Yodo1MasPrivacy.getInstance().setCOPPAAgeRestricted(z);
        Iterator<Yodo1MasAdapterBase> it = this.mediationMap.values().iterator();
        while (it.hasNext()) {
            it.next().updatePrivacy();
        }
    }

    public boolean isCOPPAAgeRestricted() {
        return Yodo1MasPrivacy.getInstance().getCOPPAAgeRestricted();
    }

    public void setCCPA(boolean z) {
        Yodo1MasPrivacy.getInstance().setCCPADoNotSell(z);
        Iterator<Yodo1MasAdapterBase> it = this.mediationMap.values().iterator();
        while (it.hasNext()) {
            it.next().updatePrivacy();
        }
    }

    public boolean isCCPADoNotSell() {
        return Yodo1MasPrivacy.getInstance().getCCPADoNotSell();
    }

    public boolean isDebug() {
        return this.debug;
    }

    public void setDebug(boolean z) {
        this.debug = z;
    }

    public boolean isInit() {
        return this.isInit;
    }

    public String getSdkVersion() {
        String stringValueFromAppInfo = getStringValueFromAppInfo(KEY_SDK_VERSION);
        return stringValueFromAppInfo != null ? stringValueFromAppInfo : Yodo1MasUtils.getSdkVersion();
    }

    public String getAppVersion(Activity activity) {
        String stringValueFromAppInfo = getStringValueFromAppInfo(KEY_APP_VERSION);
        return stringValueFromAppInfo != null ? stringValueFromAppInfo : Yodo1MasUtils.getAppVersion(activity);
    }

    public String getPackageName(Activity activity) {
        String stringValueFromAppInfo = getStringValueFromAppInfo(KEY_APP_BUNDLE_ID);
        return stringValueFromAppInfo != null ? stringValueFromAppInfo : activity.getPackageName();
    }

    public String getAppkey() {
        return getStringValueFromAppInfo(KEY_APP_KEY);
    }

    public String getGaid() {
        return getStringValueFromAppInfo(KEY_GAID);
    }

    public void setRewardListener(Yodo1Mas.RewardListener rewardListener) {
        Yodo1MasRewardHelper.getInstance().setRewardListener(rewardListener);
    }

    public void setInterstitialListener(Yodo1Mas.InterstitialListener interstitialListener) {
        Yodo1MasInterstitialHelper.getInstance().setInterstitialListener(interstitialListener);
    }

    public void setBannerListener(Yodo1Mas.BannerListener bannerListener) {
        this.bannerListener = bannerListener;
    }

    public Yodo1MasAdBuildConfig getAdBuildConfig() {
        return this.adBuildConfig;
    }

    public void setAdBuildConfig(Yodo1MasAdBuildConfig yodo1MasAdBuildConfig) {
        StringBuilder sb = new StringBuilder();
        sb.append("setAdBuildConfig: adBuildConfig= ");
        sb.append(yodo1MasAdBuildConfig);
        sb.append("  isEnableUserPrivacyDialog= ");
        sb.append(yodo1MasAdBuildConfig != null ? Boolean.valueOf(yodo1MasAdBuildConfig.isEnableUserPrivacyDialog()) : null);
        Log.d(TAG, sb.toString());
        this.adBuildConfig = yodo1MasAdBuildConfig;
    }

    public Activity getCurrentActivity() {
        return this.currentActivity;
    }

    public Application getApplication() {
        return this.application;
    }

    public AdvertisingIdClient.Info getAdvertisingId(Context context) {
        try {
            return AdvertisingIdClient.getAdvertisingIdInfo(context);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    private List<Yodo1MasAdapterBase> getAdapters(Yodo1MasNetworkAdvert yodo1MasNetworkAdvert) {
        ArrayList arrayList = new ArrayList();
        if (yodo1MasNetworkAdvert.mediation_list != null && !yodo1MasNetworkAdvert.mediation_list.isEmpty()) {
            Iterator<Yodo1MasNetworkMediation> it = yodo1MasNetworkAdvert.mediation_list.iterator();
            while (it.hasNext()) {
                String str = it.next().name;
                if (!TextUtils.isEmpty(str)) {
                    Yodo1MasAdapterBase yodo1MasAdapterBase = this.mediationMap.get(str);
                    if (yodo1MasAdapterBase != null && !arrayList.contains(yodo1MasAdapterBase)) {
                        yodo1MasAdapterBase.nativeAdSize = yodo1MasNetworkAdvert.size;
                        arrayList.add(yodo1MasAdapterBase);
                    } else {
                        Log.d(TAG, "mediation adapter uninitialized - " + str);
                    }
                }
            }
        }
        if (yodo1MasNetworkAdvert.fallback_waterfall != null) {
            Iterator<Yodo1MasNetworkWaterfall> it2 = yodo1MasNetworkAdvert.fallback_waterfall.iterator();
            while (it2.hasNext()) {
                String str2 = it2.next().network;
                if (!TextUtils.isEmpty(str2)) {
                    Yodo1MasAdapterBase yodo1MasAdapterBase2 = this.mediationMap.get(str2);
                    if (yodo1MasAdapterBase2 != null && !arrayList.contains(yodo1MasAdapterBase2)) {
                        yodo1MasAdapterBase2.nativeAdSize = yodo1MasNetworkAdvert.size;
                        arrayList.add(yodo1MasAdapterBase2);
                    } else {
                        Log.d(TAG, "network adapter uninitialized - " + str2);
                    }
                }
            }
        }
        return arrayList;
    }

    public List<Yodo1MasAdapterBase> getAdaptersForReward() {
        Yodo1MasNetworkConfig yodo1MasNetworkConfig = this.networkConfig;
        if (yodo1MasNetworkConfig != null && yodo1MasNetworkConfig.reward != null) {
            return getAdapters(this.networkConfig.reward);
        }
        return new ArrayList();
    }

    public List<Yodo1MasAdapterBase> getAdaptersForInterstitial() {
        Yodo1MasNetworkConfig yodo1MasNetworkConfig = this.networkConfig;
        if (yodo1MasNetworkConfig != null && yodo1MasNetworkConfig.interstitial != null) {
            return getAdapters(this.networkConfig.interstitial);
        }
        return new ArrayList();
    }

    public List<Yodo1MasAdapterBase> getAdaptersForNative() {
        Yodo1MasNetworkConfig yodo1MasNetworkConfig = this.networkConfig;
        if (yodo1MasNetworkConfig != null && yodo1MasNetworkConfig.nativeads != null) {
            return getAdapters(this.networkConfig.nativeads);
        }
        return new ArrayList();
    }

    public List<Yodo1MasAdapterBase> getAdaptersForBanner() {
        Yodo1MasNetworkConfig yodo1MasNetworkConfig = this.networkConfig;
        if (yodo1MasNetworkConfig != null && yodo1MasNetworkConfig.banner != null) {
            return getAdapters(this.networkConfig.banner);
        }
        return new ArrayList();
    }

    @Deprecated
    public boolean isRewardAdvertLoaded() {
        return Yodo1MasRewardHelper.getInstance().isAdLoaded();
    }

    @Deprecated
    private void loadRewardAdvert(Activity activity) {
        Yodo1MasRewardHelper.getInstance().loadAd(activity);
    }

    @Deprecated
    public void showRewardAdvert(Activity activity) {
        Yodo1MasRewardHelper.getInstance().showAd(activity);
    }

    @Deprecated
    public void showRewardAdvert(Activity activity, String str) {
        Yodo1MasRewardHelper.getInstance().showAd(activity, str);
    }

    @Deprecated
    public void dismissRewardAdvert() {
        Yodo1MasRewardHelper.getInstance().dismiss();
    }

    @Deprecated
    public boolean isInterstitialAdvertLoaded() {
        return Yodo1MasInterstitialHelper.getInstance().isAdLoaded();
    }

    @Deprecated
    private void loadInterstitialAdvert(Activity activity) {
        Yodo1MasInterstitialHelper.getInstance().loadAd(activity);
    }

    @Deprecated
    public void showInterstitialAdvert(Activity activity) {
        Yodo1MasInterstitialHelper.getInstance().showAd(activity);
    }

    @Deprecated
    public void showInterstitialAdvert(Activity activity, String str) {
        Yodo1MasInterstitialHelper.getInstance().showAd(activity, str);
    }

    @Deprecated
    public void dismissInterstitialAdvert() {
        Yodo1MasInterstitialHelper.getInstance().dismiss();
    }

    @Deprecated
    public void showBannerAdvert(Activity activity) {
        showBannerAdvert(activity, null, 34, 0, 0);
    }

    @Deprecated
    public void showBannerAdvert(Activity activity, String str) {
        showBannerAdvert(activity, str, 34, 0, 0);
    }

    @Deprecated
    public void showBannerAdvert(Activity activity, int i) {
        showBannerAdvert(activity, null, i, 0, 0);
    }

    @Deprecated
    public void showBannerAdvert(Activity activity, int i, int i2, int i3) {
        showBannerAdvert(activity, null, i, i2, i3);
    }

    @Deprecated
    public void showBannerAdvert(Activity activity, String str, int i, int i2, int i3) {
        if (this.bannerAdView == null) {
            this.bannerAdView = new Yodo1MasBannerAdView(activity);
            Yodo1MasAdBuildConfig yodo1MasAdBuildConfig = this.adBuildConfig;
            if (yodo1MasAdBuildConfig != null && yodo1MasAdBuildConfig.isEnableAdaptiveBanner()) {
                this.bannerAdView.setAdSize(Yodo1MasBannerAdSize.AdaptiveBanner);
            } else {
                this.bannerAdView.setAdSize(Yodo1MasBannerAdSize.Banner);
            }
            if (!TextUtils.isEmpty(str)) {
                this.bannerAdView.setAdPlacement(str);
            }
            this.bannerAdView.setAdListener(new Yodo1MasBannerAdListener() {
                @Override
                public void onBannerAdLoaded(Yodo1MasBannerAdView yodo1MasBannerAdView) {
                }

                @Override
                public void onBannerAdFailedToLoad(Yodo1MasBannerAdView yodo1MasBannerAdView, Yodo1MasError yodo1MasError) {
                    if (Yodo1MasHelper.this.bannerListener != null) {
                        Yodo1MasHelper.this.bannerListener.onAdError(new Yodo1MasAdEvent(1004, Yodo1Mas.AdType.Banner, yodo1MasError), yodo1MasError);
                    }
                }

                @Override
                public void onBannerAdOpened(Yodo1MasBannerAdView yodo1MasBannerAdView) {
                    if (Yodo1MasHelper.this.bannerListener != null) {
                        Yodo1MasHelper.this.bannerListener.onAdOpened(new Yodo1MasAdEvent(1001, Yodo1Mas.AdType.Banner));
                    }
                }

                @Override
                public void onBannerAdFailedToOpen(Yodo1MasBannerAdView yodo1MasBannerAdView, Yodo1MasError yodo1MasError) {
                    if (Yodo1MasHelper.this.bannerListener != null) {
                        Yodo1MasHelper.this.bannerListener.onAdError(new Yodo1MasAdEvent(1005, Yodo1Mas.AdType.Banner, yodo1MasError), yodo1MasError);
                    }
                }

                @Override
                public void onBannerAdClosed(Yodo1MasBannerAdView yodo1MasBannerAdView) {
                    if (Yodo1MasHelper.this.bannerListener != null) {
                        Yodo1MasHelper.this.bannerListener.onAdClosed(new Yodo1MasAdEvent(1002, Yodo1Mas.AdType.Banner));
                    }
                }
            });
            if (this.isInit) {
                this.bannerAdView.loadAd();
            } else {
                this.keepCheckingV1 = true;
            }
        }
        Yodo1MasBannerUtil.addBannerView(activity, this.bannerAdView, i, i2, i3);
    }

    @Deprecated
    private void reShowBannerAdvert() {
        Yodo1MasBannerAdView yodo1MasBannerAdView = this.bannerAdView;
        if (yodo1MasBannerAdView != null) {
            yodo1MasBannerAdView.loadAd();
        }
    }

    @Deprecated
    public void dismissBannerAdvert() {
        Yodo1MasBannerAdView yodo1MasBannerAdView = this.bannerAdView;
        if (yodo1MasBannerAdView != null) {
            Yodo1MasBannerUtil.removeBannerView(yodo1MasBannerAdView);
        }
    }

    @Deprecated
    public void dismissBannerAdvert(boolean z) {
        this.keepCheckingV1 = false;
        Yodo1MasBannerAdView yodo1MasBannerAdView = this.bannerAdView;
        if (yodo1MasBannerAdView != null) {
            Yodo1MasBannerUtil.removeBannerView(yodo1MasBannerAdView);
            if (z) {
                this.bannerAdView.destroy();
                this.bannerAdView = null;
            }
        }
    }

    public boolean isAdsConfigured(Yodo1Mas.AdType adType) {
        Yodo1MasNetworkAdvert yodo1MasNetworkAdvert;
        if (this.networkConfig != null) {
            int i = AnonymousClass10.$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[adType.ordinal()];
            if (i == 1) {
                yodo1MasNetworkAdvert = this.networkConfig.reward;
            } else if (i == 2) {
                yodo1MasNetworkAdvert = this.networkConfig.interstitial;
            } else if (i == 3) {
                yodo1MasNetworkAdvert = this.networkConfig.banner;
            }
            return yodo1MasNetworkAdvert == null;
        }
        yodo1MasNetworkAdvert = null;
        if (yodo1MasNetworkAdvert == null) {
        }
    }

    private String getStringValueFromAppInfo(String str) {
        Object obj;
        if (!this.appInfo.containsKey(str) || (obj = this.appInfo.get(str)) == null) {
            return null;
        }
        return obj.toString();
    }

    public boolean isFullScreenAdShowing() {
        return this.isFullScreenAdShowing;
    }

    public void updateFullScreenAdState(Activity activity, boolean z) {
        this.isFullScreenAdShowing = z;
        if (z || !Yodo1MasAdConfigCheckHelper.getInstance().isWaitingForRest()) {
            return;
        }
        Yodo1MasAdConfigCheckHelper.getInstance().resetAdsAfterAdShowEnd(activity);
    }

    public void resetAllAdsAdapters() {
        if (this.mediationMap.size() == 0) {
            return;
        }
        Iterator<Map.Entry<String, Yodo1MasAdapterBase>> it = this.mediationMap.entrySet().iterator();
        while (it.hasNext()) {
            Yodo1MasAdapterBase value = it.next().getValue();
            if (value != null) {
                value.resetAds();
            }
        }
        this.mediationMap.clear();
    }
}