Idle Tower v2.48版本的 MD5 值为:56f20496f6a85726b376356ed2ecee23
以下内容为反编译后的 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 androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.lifecycle.ProcessLifecycleOwner;
import com.google.android.exoplayer2.C;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.vungle.warren.VungleApiClient;
import com.yandex.metrica.plugins.PluginErrorDetails;
import com.yodo1.mas.Yodo1Mas;
import com.yodo1.mas.Yodo1MasLog;
import com.yodo1.mas.analytics.Yodo1MasDataAnalytics;
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.debugger.main.Yodo1MasDebuggerItem;
import com.yodo1.mas.error.Yodo1MasError;
import com.yodo1.mas.event.Yodo1MasAdEvent;
import com.yodo1.mas.helper.Yodo1MasPrivacyDialogHelper;
import com.yodo1.mas.helper.Yodo1MasUMPHelper;
import com.yodo1.mas.helper.model.Yodo1MasAdBuildConfig;
import com.yodo1.mas.helper.model.Yodo1MasAdTimesSetting;
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.reportad.Yodo1MasAdReportHelper;
import com.yodo1.mas.utils.Yodo1MasBannerUtil;
import com.yodo1.mas.utils.Yodo1MasInitCacheUtil;
import com.yodo1.mas.utils.Yodo1MasTrackCustomSDKUtil;
import com.yodo1.mas.utils.Yodo1MasUtils;
import java.io.IOException;
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 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 implements LifecycleObserver {
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_DEBUGLOG_ENABLE_ONSERVER = "YODO1_ENABLEDEBUGLOG_ONSERVER";
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_NETWORK_INIT_TIME = "YODO1_NETWORK_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_UMP_ENABLE_ONSERVER = "YODO1_ENABLEUMP_ONSERVER";
private static final String KEY_USER_AGE = "YODO1_USER_AGE";
public static final String SDKTYPE_CUSTOM = "mas_sdk";
private static final String TAG = "[Yodo1MasHelper]";
public static final long YODO1_AD_LOAD_TIME_LIMIT = 10000;
private static Yodo1MasHelper helper;
private Yodo1MasAdBuildConfig adBuildConfig;
private String appKey;
private Yodo1Mas.AppStatusListener appStatusListener;
private Application application;
private Yodo1Mas.BannerListener bannerListener;
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();
private final HashMap<String, JSONObject> networkInitResultMap = new HashMap<>();
private final HashMap<String, Long> networkInitTimeMap = new HashMap<>();
public boolean isUseNewApi = false;
boolean keepCheckingV1 = false;
private Yodo1MasBannerAdView bannerAdView = null;
private boolean debug = false;
private boolean isRequesting = false;
private boolean isInit = false;
private int initCount = 0;
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");
}
}
};
private boolean isInitFromCache = false;
@Deprecated
public boolean isBannerAdvertLoaded() {
return true;
}
public static Yodo1MasHelper getInstance() {
if (helper == null) {
synchronized (Yodo1MasHelper.class) {
if (helper == null) {
helper = new Yodo1MasHelper();
}
}
}
return helper;
}
public 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();
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
ProcessLifecycleOwner.get().getLifecycle().addObserver(Yodo1MasHelper.this);
}
});
Yodo1MasUtils.getMetaData((Context) activity, "com.yodo1.mas.verbose_logging", true);
Yodo1MasLog.enableDebugLog(getEnableDebugLogValue());
preInitSDK_(activity, str, initListener);
}
private void preInitSDK_(final Activity activity, final String str, final Yodo1Mas.InitListener initListener) {
Yodo1MasDataAnalytics.initWithAppKey(activity, str, this.offsetTime, this.needCalibrateTime);
Yodo1MasAdBuildConfig yodo1MasAdBuildConfig = this.adBuildConfig;
boolean z = yodo1MasAdBuildConfig != null && yodo1MasAdBuildConfig.isEnableUserPrivacyDialog();
Yodo1MasLog.d(TAG, "initSDK: adBuildConfig=" + this.adBuildConfig + " isEnableUserPrivacyDialog=" + z);
if (z) {
int userAge = getUserAge();
if (userAge > 0) {
Yodo1MasLog.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) {
Yodo1MasLog.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)) {
if (initListener != null) {
initListener.onMasInitFailed(new Yodo1MasError(Yodo1MasError.CODE_APP_ID_ILLEGAL, "appKey is invalid"));
}
} else {
this.appKey = str;
Yodo1MasDataAnalytics.trackPrivacy(z, Yodo1MasPrivacy.getInstance().getGDPRUserConsentString(), Yodo1MasPrivacy.getInstance().getCOPPAAgeRestrictedString(), Yodo1MasPrivacy.getInstance().getCCPADoNotSellString(), Yodo1MasPrivacy.getInstance().getGDPRUserConsent(), Yodo1MasPrivacy.getInstance().getCOPPAAgeRestricted(), Yodo1MasPrivacy.getInstance().getCCPADoNotSell());
umpPrivacyBeforeDoInitInfo(activity, str, initListener);
}
}
private void umpPrivacyBeforeDoInitInfo(final Activity activity, final String str, final Yodo1Mas.InitListener initListener) {
if (isUmpEanbleOnServer()) {
Yodo1MasUMPHelper.getInstance().checkUMPGDPRPrivacy(activity, new Yodo1MasUMPHelper.UmpPrivacyCheckListener() {
@Override
public void onCompleted(Yodo1MasUMPHelper.UMPError uMPError) {
if (uMPError != null) {
Yodo1MasLog.d(Yodo1MasHelper.TAG, "UMP check onCompleted errorCode: " + uMPError.getCode() + " errorMessage: " + uMPError.getMsg());
} else {
Yodo1MasLog.d(Yodo1MasHelper.TAG, "UMP check onCompleted");
}
Yodo1MasHelper.this.doInitInfo(activity, str, initListener);
}
});
} else {
doInitInfo(activity, str, initListener);
}
}
public 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 -1081287861:
if (sdkType.equals("mas_cn")) {
c = 4;
break;
}
break;
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 839829850:
if (sdkType.equals(SDKTYPE_CUSTOM)) {
c = 5;
break;
}
break;
case 1898666138:
if (sdkType.equals("mas_gp_family")) {
c = 2;
break;
}
break;
}
String str2 = c != 0 ? c != 1 ? c != 2 ? c != 3 ? c != 4 ? c != 5 ? null : "Mas" : "Cn" : "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, false);
getSettingConfigFromServer(activity, str);
Yodo1MasAdReportHelper.getInstance().retrySendReport();
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
Yodo1MasHelper.this.registerReceiver(activity, str, initListener);
}
}, C.DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS);
}
public void registerReceiver(final Activity activity, final String str, final Yodo1Mas.InitListener initListener) {
activity.getApplication().registerReceiver(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.getInitConfigFromServer(activity, str, initListener, true);
}
}
}, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
activity.getApplication().unregisterActivityLifecycleCallbacks(this.lifecycleCallback);
activity.getApplication().registerActivityLifecycleCallbacks(this.lifecycleCallback);
}
private void doInit(Activity activity, String str, Yodo1Mas.InitListener initListener, boolean z) {
if (this.isInit) {
return;
}
boolean isInitConfigCacheAvaliable = Yodo1MasInitCacheUtil.isInitConfigCacheAvaliable(activity);
this.isInitFromCache = isInitConfigCacheAvaliable;
if (isInitConfigCacheAvaliable) {
doInitFromCache(activity, str, initListener);
}
getInitConfigFromServer(activity, str, initListener, z);
}
private void doInitFromCache(Activity activity, String str, Yodo1Mas.InitListener initListener) {
dealWithGetAdConfigResponse(activity, Yodo1MasInitCacheUtil.readInitConfigCache(activity), Yodo1MasUtils.getMetaData((Context) activity, "com.yodo1.mas.DEBUG", false), Yodo1MasUtils.getMetaData((Context) activity, "com.yodo1.mas.Config", false), initListener, getPackageName(activity));
}
public void getInitConfigFromServer(final Activity activity, String str, final Yodo1Mas.InitListener initListener, final boolean z) {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) activity.getSystemService("connectivity")).getActiveNetworkInfo();
if (!(activeNetworkInfo != null && activeNetworkInfo.isConnected()) || this.isRequesting) {
return;
}
this.isRequesting = true;
final boolean metaData = Yodo1MasUtils.getMetaData((Context) activity, "com.yodo1.mas.DEBUG", false);
final 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 Callback() {
@Override
public void onFailure(Call call, IOException iOException) {
Yodo1MasHelper.this.trackInitEnd(false, 0, iOException.getMessage(), null, metaData, metaData2, activity, z);
Yodo1MasHelper.this.isRequesting = false;
if (Yodo1MasHelper.this.isInitFromCache) {
return;
}
Yodo1MasHelper.this.handleSDKInitFailedLogic(activity, initListener, Yodo1MasError.CODE_CONFIG_NETWORK, "Init failed (Error Code: " + Yodo1MasError.CODE_CONFIG_NETWORK + ", " + iOException.getMessage() + ")");
}
@Override
public void onResponse(Call call, Response response) throws IOException {
Yodo1MasLog.d(Yodo1MasHelper.TAG, "onResponse - code:" + response.code());
int code = response.code();
ResponseBody body = response.body();
String string = (code != 200 || body == null) ? null : body.string();
Yodo1MasHelper.this.trackInitEnd(true, code, response.message(), string, metaData, metaData2, activity, z);
Yodo1MasHelper.this.isRequesting = false;
if (code != 200) {
if (Yodo1MasHelper.this.isInitFromCache) {
return;
}
Yodo1MasHelper.this.handleSDKInitFailedLogic(activity, initListener, Yodo1MasError.CODE_CONFIG_GET, "Init failed (Error Code: " + Yodo1MasError.CODE_CONFIG_GET + ", response code:" + code + " response message:" + response.message() + ")");
return;
}
if (body != null) {
if (!Yodo1MasHelper.this.isInitFromCache) {
Yodo1MasHelper yodo1MasHelper = Yodo1MasHelper.this;
Activity activity2 = activity;
yodo1MasHelper.dealWithGetAdConfigResponse(activity2, string, metaData, metaData2, initListener, yodo1MasHelper.getPackageName(activity2));
}
Yodo1MasInitCacheUtil.updateInitConfigCache(activity, string);
return;
}
if (Yodo1MasHelper.this.isInitFromCache) {
return;
}
Yodo1MasHelper.this.handleSDKInitFailedLogic(activity, initListener, Yodo1MasError.CODE_CONFIG_GET, "Init failed (Error Code: " + Yodo1MasError.CODE_CONFIG_GET + ", body is null");
}
});
}
public void handleSDKInitFailedLogic(Activity activity, final Yodo1Mas.InitListener initListener, int i, String str) {
this.appInfo.put(KEY_INIT_STATUS, false);
this.appInfo.put(KEY_INIT_MSG, str);
printInitLog();
if (initListener != null) {
final Yodo1MasError yodo1MasError = new Yodo1MasError(i, str);
activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
Yodo1Mas.InitListener.this.onMasInitFailed(yodo1MasError);
}
});
}
}
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(Yodo1MasDebuggerItem.KEY_APP_VERSION, 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 getSettingConfigFromServer(Activity activity, String str) {
new OkHttpClient.Builder().build().newCall(getRequest(activity, "https://sdk-mas.yodo1.com/v1/config/" + str)).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException iOException) {
Yodo1MasLog.d(Yodo1MasHelper.TAG, "getSettingConfigFromServer onFailure error: " + iOException.getMessage());
}
@Override
public void onResponse(Call call, Response response) throws IOException {
ResponseBody body = response.body();
if (body != null) {
String string = body.string();
Yodo1MasLog.d(Yodo1MasHelper.TAG, "getSettingConfigFromServer result: " + string);
try {
JSONObject jSONObject = new JSONObject(string);
if (jSONObject.has("debug_log")) {
boolean z = true;
boolean z2 = !Yodo1MasHelper.this.getSharedPreferences(Yodo1MasHelper.this.application).contains(Yodo1MasHelper.KEY_DEBUGLOG_ENABLE_ONSERVER);
int i = jSONObject.getInt("debug_log");
Yodo1MasHelper yodo1MasHelper = Yodo1MasHelper.this;
if (i != 1) {
z = false;
}
yodo1MasHelper.setDebuglogEnableOnServer(z);
if (z2) {
Yodo1MasLog.enableDebugLog(Yodo1MasHelper.this.getEnableDebugLogValue());
}
}
if (jSONObject.has("ump_enabled")) {
Yodo1MasHelper.this.setUmpEnableOnServer(jSONObject.getBoolean("ump_enabled"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
});
}
public void dealWithGetAdConfigResponse(final Activity activity, final String str, boolean z, boolean z2, final Yodo1Mas.InitListener initListener, String str2) {
Yodo1MasLog.d(TAG, "Get config successful - " + str);
Yodo1MasInitData formatInitDataFromJson = Yodo1MasUtils.formatInitDataFromJson(activity, str, z, z2);
if (formatInitDataFromJson != null) {
if ("null".equals(formatInitDataFromJson.bundle_id) || str2 == null || str2.equals(formatInitDataFromJson.bundle_id)) {
if (formatInitDataFromJson.test_mode.intValue() == 1) {
this.appInfo.put(KEY_TEST_DEVICE, "On");
this.appInfo.put(KEY_TEST_MODE, isTestMode(formatInitDataFromJson.init_config) ? "On" : "Off");
} else {
this.appInfo.put(KEY_TEST_MODE, "Off");
this.appInfo.put(KEY_TEST_DEVICE, "Off");
}
this.initConfig = formatInitDataFromJson.init_config;
this.networkConfig = formatInitDataFromJson.ad_network_config;
this.isInit = true;
activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
Yodo1MasHelper.this.lambda$dealWithGetAdConfigResponse$2$Yodo1MasHelper(activity, initListener, str);
}
});
return;
}
this.isRequesting = false;
handleSDKInitFailedLogic(activity, initListener, Yodo1MasError.CODE_APP_ID_UNVERIFIED, "Init failed (Error Code: " + Yodo1MasError.CODE_APP_ID_UNVERIFIED + ",Bundle ID not match please check your app profile)");
return;
}
this.isRequesting = false;
handleSDKInitFailedLogic(activity, initListener, Yodo1MasError.CODE_CONFIG_GET, "Init failed (Error Code: " + Yodo1MasError.CODE_CONFIG_GET + ", config is null");
}
public void lambda$dealWithGetAdConfigResponse$2$Yodo1MasHelper(Activity activity, Yodo1Mas.InitListener initListener, String str) {
doInitAdapter(activity, initListener);
Yodo1MasAdConfigCheckHelper.getInstance().saveAdConfig(str);
activity.sendBroadcast(new Intent(ACTION_SDK_INITIALIZED));
if (initListener != null) {
initListener.onMasInitSuccessful();
}
}
private boolean isTestMode(Yodo1MasInitConfig yodo1MasInitConfig) {
if (yodo1MasInitConfig == null || yodo1MasInitConfig.ad_network_list == null || yodo1MasInitConfig.ad_network_list.isEmpty()) {
return false;
}
Iterator<Yodo1MasInitNetworkInfo> it = yodo1MasInitConfig.ad_network_list.iterator();
while (it.hasNext()) {
if ("yodo1".equals(it.next().ad_network_name)) {
return true;
}
}
return false;
}
private void trackInitStart() {
this.appInfo.put(KEY_INIT_TIME, Long.valueOf(System.currentTimeMillis() / 1000));
}
public void trackInitEnd(boolean z, int i, String str, String str2, boolean z2, boolean z3, Context context, boolean z4) {
Object obj = this.appInfo.get(KEY_INIT_TIME);
long longValue = obj != null ? ((Long) obj).longValue() : System.currentTimeMillis() / 1000;
Yodo1MasDataAnalytics.trackAdInit(z, i, str, (System.currentTimeMillis() / 1000) - longValue, z ? Yodo1MasUtils.formatInitDataFromJson(context, str2, z2, z3) : null, z4, this.isUseNewApi ? "v2" : "v1");
}
private void trackNetworkInitStart() {
this.appInfo.put(KEY_NETWORK_INIT_TIME, Long.valueOf(System.currentTimeMillis()));
}
public void trackNetworkInitEnd() {
if ((this.initConfig.mediation_list == null || this.initConfig.mediation_list.isEmpty()) && (this.initConfig.ad_network_list == null || this.initConfig.ad_network_list.isEmpty())) {
return;
}
Object obj = this.appInfo.get(KEY_NETWORK_INIT_TIME);
long currentTimeMillis = System.currentTimeMillis() - (obj != null ? ((Long) obj).longValue() : System.currentTimeMillis());
Yodo1MasLog.d(TAG, "trackNetworkInitEnd: duration millis: " + currentTimeMillis);
this.networkInitTimeMap.clear();
Yodo1MasDataAnalytics.trackAdNetworkInit(currentTimeMillis, this.networkInitResultMap);
}
public void recordNetworkInitResult(String str, boolean z, Yodo1MasError yodo1MasError) {
if (TextUtils.isEmpty(str) || !this.networkInitTimeMap.containsKey(str)) {
return;
}
long currentTimeMillis = System.currentTimeMillis() - this.networkInitTimeMap.get(str).longValue();
Yodo1MasLog.d(TAG, "recordNetworkInitResult: " + str + " duration: " + currentTimeMillis);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("name", str);
jSONObject.put(IronSourceConstants.EVENTS_RESULT, (z ? Yodo1MasDataAnalytics.AdResult.SUCCESS : Yodo1MasDataAnalytics.AdResult.FAIL).name);
jSONObject.put(IronSourceConstants.EVENTS_DURATION, currentTimeMillis);
if (yodo1MasError != null && yodo1MasError.getMessage() != null) {
jSONObject.put("errorMessage", yodo1MasError.getMessage());
}
} catch (JSONException e) {
e.printStackTrace();
}
this.networkInitResultMap.put(str, jSONObject);
}
private 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");
}
String sdkType = Yodo1MasUtils.getSdkType(this.application.getApplicationContext());
if (!TextUtils.equals(sdkType, "mas_cn")) {
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");
}
boolean metaData = Yodo1MasUtils.getMetaData((Context) this.application, "com.yodo1.mas.DisableSensitiveLogs", false);
if (isDebuglogEnableOnServer() || !metaData) {
if (TextUtils.equals(sdkType, "mas_cn")) {
sb.append("\"Disabled Personalized State\"");
sb.append(Yodo1MasPrivacy.getInstance().getPersonalizedStatePrintValue());
sb.append("\n");
} else {
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("******************************************");
Yodo1MasLog.i(TAG, sb.toString());
}
private void doInitAdapter(Activity activity, Yodo1Mas.InitListener initListener) {
Yodo1MasLog.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("gam_google", "gam.Yodo1MasGoogleAdManagerAdapter");
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("mintegral", "mintegral.Yodo1MasMintegralAdapter");
hashMap2.put("mytarget", "mytarget.Yodo1MasMyTargetAdapter");
hashMap2.put("tapjoy", "tapjoy.Yodo1MasTapjoyAdapter");
hashMap2.put(PluginErrorDetails.Platform.UNITY, "unityads.Yodo1MasUnityAdsAdapter");
hashMap2.put("vungle", "vungle.Yodo1MasVungleAdapter");
hashMap2.put("yandex", "yandex.Yodo1MasYandexAdapter");
hashMap2.put("tencent", "tencent.Yodo1MasTencentAdapter");
hashMap2.put("csj", "csj.Yodo1MasCsjAdapter");
if (isTestAd()) {
hashMap2.put("yodo1", "yodo1.Yodo1MasYodo1Adapter");
}
trackNetworkInitStart();
if (this.initConfig.mediation_list != null && !this.initConfig.mediation_list.isEmpty()) {
Yodo1MasLog.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 {
Yodo1MasLog.d(TAG, "The mediation config is empty");
}
if (this.initConfig.ad_network_list != null && !this.initConfig.ad_network_list.isEmpty()) {
Yodo1MasLog.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 {
Yodo1MasLog.d(TAG, "The network config is empty");
}
if ((this.initConfig.mediation_list != null && !this.initConfig.mediation_list.isEmpty()) || (this.initConfig.ad_network_list != null && !this.initConfig.ad_network_list.isEmpty())) {
doInitSuccessful(activity, initListener);
Yodo1MasTrackCustomSDKUtil.trackCustomSDKNetworks(this.application);
}
Yodo1MasLog.d(TAG, "The initialization of adapters is end");
}
public void lambda$doInitSuccessful$3$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(Activity activity, final String str, String str2, String str3, String str4, 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);
this.networkInitTimeMap.put(str, Long.valueOf(System.currentTimeMillis()));
yodo1MasAdapterBase.initSDK(activity, config, new Yodo1MasAdapterBase.InitCallback() {
@Override
public void onAdapterInitSuccessful(String str6) {
Yodo1MasHelper.this.recordNetworkInitResult(str, true, null);
Yodo1MasHelper.this.trackNetworkInitEnd();
Yodo1MasLog.d(Yodo1MasHelper.TAG, "adapter init successful - " + str + ":" + str5);
}
@Override
public void onAdapterInitFailed(String str6, Yodo1MasError yodo1MasError) {
Yodo1MasHelper.this.recordNetworkInitResult(str, false, yodo1MasError);
Yodo1MasHelper.this.trackNetworkInitEnd();
Yodo1MasLog.d(Yodo1MasHelper.TAG, "adapter init failed - " + str + ":" + str5 + "," + yodo1MasError.getMessage());
}
});
return;
}
if (obj == null) {
Yodo1MasLog.d(TAG, "adapter class not found - " + str5);
return;
}
Yodo1MasLog.d(TAG, "Yodo1MasAdapterBase - " + str5);
return;
}
Yodo1MasLog.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);
}
if (this.networkConfig.rewardinter != null) {
doInitAdvert(activity, this.networkConfig.rewardinter, Yodo1Mas.AdType.RewardedInterstitial, str);
}
if (this.networkConfig.openads != null) {
doInitAdvert(activity, this.networkConfig.openads, Yodo1Mas.AdType.AppOpen, 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) {
yodo1MasAdapterBase2.mediationName = str2;
switch (AnonymousClass11.$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[adType.ordinal()]) {
case 1:
yodo1MasAdapterBase2.rewardAdIds.clear();
yodo1MasAdapterBase2.rewardAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
break;
case 2:
yodo1MasAdapterBase2.interstitialAdIds.clear();
yodo1MasAdapterBase2.interstitialAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
break;
case 3:
yodo1MasAdapterBase2.bannerAdIds.clear();
yodo1MasAdapterBase2.bannerAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
break;
case 4:
yodo1MasAdapterBase2.nativeAdIds.clear();
yodo1MasAdapterBase2.nativeAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
break;
case 5:
yodo1MasAdapterBase2.rewardedInterstitialAdIds.clear();
yodo1MasAdapterBase2.rewardedInterstitialAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
break;
case 6:
yodo1MasAdapterBase2.appOpenAdIds.clear();
yodo1MasAdapterBase2.appOpenAdIds.add(new Yodo1MasAdapterBase.AdId(str3, null));
break;
}
}
}
}
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) {
yodo1MasAdapterBase.mediationName = "Yodo1";
switch (AnonymousClass11.$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[adType.ordinal()]) {
case 1:
yodo1MasAdapterBase.rewardAdIds.clear();
for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement : list) {
yodo1MasAdapterBase.rewardAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement.network_code, yodo1MasNetworkPlacement));
}
Collections.sort(yodo1MasAdapterBase.rewardAdIds);
break;
case 2:
yodo1MasAdapterBase.interstitialAdIds.clear();
for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement2 : list) {
yodo1MasAdapterBase.interstitialAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement2.network_code, yodo1MasNetworkPlacement2));
}
Collections.sort(yodo1MasAdapterBase.interstitialAdIds);
break;
case 3:
yodo1MasAdapterBase.bannerAdIds.clear();
for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement3 : list) {
yodo1MasAdapterBase.bannerAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement3.network_code, yodo1MasNetworkPlacement3));
}
Collections.sort(yodo1MasAdapterBase.bannerAdIds);
break;
case 4:
yodo1MasAdapterBase.nativeAdIds.clear();
for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement4 : list) {
yodo1MasAdapterBase.nativeAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement4.network_code, yodo1MasNetworkPlacement4));
}
Collections.sort(yodo1MasAdapterBase.nativeAdIds);
break;
case 5:
yodo1MasAdapterBase.rewardedInterstitialAdIds.clear();
for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement5 : list) {
yodo1MasAdapterBase.rewardedInterstitialAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement5.network_code, yodo1MasNetworkPlacement5));
}
Collections.sort(yodo1MasAdapterBase.rewardedInterstitialAdIds);
break;
case 6:
yodo1MasAdapterBase.appOpenAdIds.clear();
for (Yodo1MasNetworkPlacement yodo1MasNetworkPlacement6 : list) {
yodo1MasAdapterBase.appOpenAdIds.add(new Yodo1MasAdapterBase.AdId(yodo1MasNetworkPlacement6.network_code, yodo1MasNetworkPlacement6));
}
Collections.sort(yodo1MasAdapterBase.appOpenAdIds);
break;
}
}
}
}
}
public static class AnonymousClass11 {
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) {
}
try {
$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[Yodo1Mas.AdType.RewardedInterstitial.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[Yodo1Mas.AdType.AppOpen.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
}
}
private void doInitSuccessful(Activity activity, Yodo1Mas.InitListener initListener) {
if (!this.isUseNewApi) {
List<Yodo1MasAdapterBase> adaptersForReward = getInstance().getAdaptersForReward();
if (adaptersForReward != null && !adaptersForReward.isEmpty()) {
loadRewardAdvert(activity);
}
List<Yodo1MasAdapterBase> adaptersForInterstitial = getInstance().getAdaptersForInterstitial();
if (adaptersForInterstitial != null && !adaptersForInterstitial.isEmpty()) {
loadInterstitialAdvert(activity);
}
}
this.appInfo.put(KEY_INIT_STATUS, true);
this.appInfo.put(KEY_INIT_MSG, "Init successfully (AppKey & Bundle ID Verified)");
printInitLog();
activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
Yodo1MasHelper.this.lambda$doInitSuccessful$3$Yodo1MasHelper();
}
});
}
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 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 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 void setPersonalizedState(boolean z) {
Yodo1MasPrivacy.getInstance().setPersonalizedState(Boolean.valueOf(z));
Iterator<Yodo1MasAdapterBase> it = this.mediationMap.values().iterator();
while (it.hasNext()) {
it.next().updatePrivacy();
}
}
public boolean getPersonalizedState() {
return Yodo1MasPrivacy.getInstance().getPersonalizedState().booleanValue();
}
public boolean isDebug() {
return this.debug;
}
public void setDebug(boolean z) {
this.debug = z;
}
public boolean isDebuglogEnableOnServer() {
return getSharedPreferences(this.application).getBoolean(KEY_DEBUGLOG_ENABLE_ONSERVER, false);
}
public void setDebuglogEnableOnServer(boolean z) {
SharedPreferences.Editor edit = getSharedPreferences(this.application).edit();
edit.putBoolean(KEY_DEBUGLOG_ENABLE_ONSERVER, z);
edit.apply();
}
public boolean isUmpEanbleOnServer() {
return getSharedPreferences(this.application).getBoolean(KEY_UMP_ENABLE_ONSERVER, false);
}
public void setUmpEnableOnServer(boolean z) {
SharedPreferences.Editor edit = getSharedPreferences(this.application).edit();
edit.putBoolean(KEY_UMP_ENABLE_ONSERVER, z);
edit.apply();
}
public boolean isInit() {
return this.isInit;
}
public String getAppKey() {
return this.appKey;
}
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(Context context) {
String stringValueFromAppInfo = getStringValueFromAppInfo(KEY_APP_BUNDLE_ID);
return stringValueFromAppInfo != null ? stringValueFromAppInfo : context.getPackageName();
}
public String getAppkey() {
return getStringValueFromAppInfo(KEY_APP_KEY);
}
public String getGaid() {
return getStringValueFromAppInfo(KEY_GAID);
}
public boolean isTestDevice() {
return "On".equals(this.appInfo.get(KEY_TEST_DEVICE));
}
public boolean isTestMode() {
return "On".equals(this.appInfo.get(KEY_TEST_MODE));
}
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);
Yodo1MasLog.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 {
Class.forName("com.google.android.gms.ads.identifier.AdvertisingIdClient", false, getClass().getClassLoader());
return AdvertisingIdClient.getAdvertisingIdInfo(context);
} catch (ClassNotFoundException e) {
Yodo1MasLog.d(TAG, "getAdvertisingId error : " + e.getMessage());
return null;
} catch (Exception e2) {
e2.printStackTrace();
return null;
}
}
public void setAppStatusListener(Yodo1Mas.AppStatusListener appStatusListener) {
this.appStatusListener = appStatusListener;
}
@OnLifecycleEvent(Lifecycle.Event.ON_START)
public void onApplicationEnterForeground() {
Yodo1Mas.AppStatusListener appStatusListener = this.appStatusListener;
if (appStatusListener == null || !this.isInit) {
return;
}
appStatusListener.onApplicationEnterForeground();
}
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 {
Yodo1MasLog.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 {
Yodo1MasLog.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();
}
public List<Yodo1MasAdapterBase> getAdaptersForRewardedInterstitial() {
Yodo1MasNetworkConfig yodo1MasNetworkConfig = this.networkConfig;
if (yodo1MasNetworkConfig != null && yodo1MasNetworkConfig.rewardinter != null) {
return getAdapters(this.networkConfig.rewardinter);
}
return new ArrayList();
}
public List<Yodo1MasAdapterBase> getAdaptersForAppOpenAd() {
Yodo1MasNetworkConfig yodo1MasNetworkConfig = this.networkConfig;
if (yodo1MasNetworkConfig != null && yodo1MasNetworkConfig.openads != null) {
return getAdapters(this.networkConfig.openads);
}
return new ArrayList();
}
public Yodo1MasAdTimesSetting getAdTimesSetting(Yodo1Mas.AdType adType) {
Yodo1MasAdTimesSetting yodo1MasAdTimesSetting;
if (this.networkConfig == null) {
return null;
}
int i = AnonymousClass11.$SwitchMap$com$yodo1$mas$Yodo1Mas$AdType[adType.ordinal()];
if (i == 1) {
if (this.networkConfig.reward == null) {
return null;
}
yodo1MasAdTimesSetting = this.networkConfig.reward.times_setting;
} else {
if (i != 2 || this.networkConfig.interstitial == null) {
return null;
}
yodo1MasAdTimesSetting = this.networkConfig.interstitial.times_setting;
}
return yodo1MasAdTimesSetting;
}
@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 = AnonymousClass11.$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;
} else if (i == 5) {
yodo1MasNetworkAdvert = this.networkConfig.rewardinter;
} else if (i == 6) {
yodo1MasNetworkAdvert = this.networkConfig.openads;
}
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();
}
private boolean isTestAd() {
return "On".equals(this.appInfo.get(KEY_TEST_MODE)) && "On".equals(this.appInfo.get(KEY_TEST_DEVICE));
}
public boolean getEnableDebugLogValue() {
boolean metaData = Yodo1MasUtils.getMetaData((Context) this.application, "com.yodo1.mas.EnableDebugLogging", false);
boolean isDebuglogEnableOnServer = isDebuglogEnableOnServer();
Yodo1MasLog.d(TAG, "enableDebugLogOnLocal:" + metaData + " enableDebugLogOnServer:" + isDebuglogEnableOnServer);
return isDebuglogEnableOnServer || metaData;
}
}