Driving Zone: Germany v1.22.4版本的 MD5 值为:2b6e2d8e8733a3104dcc306c5770286c
以下内容为反编译后的 IronSourceAdapter.java 源代码,内容仅作参考
package com.ironsource.adapters.ironsource;
import android.app.Activity;
import android.text.TextUtils;
import com.facebook.internal.ServerProtocol;
import com.ironsource.adapters.supersonicads.SupersonicConfig;
import com.ironsource.environment.ContextProvider;
import com.ironsource.mediationsdk.AbstractAdapter;
import com.ironsource.mediationsdk.AdapterUtils;
import com.ironsource.mediationsdk.C1555f;
import com.ironsource.mediationsdk.ISBannerSize;
import com.ironsource.mediationsdk.ISDemandOnlyBannerLayout;
import com.ironsource.mediationsdk.IronSourceBannerLayout;
import com.ironsource.mediationsdk.L;
import com.ironsource.mediationsdk.LoadWhileShowSupportState;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.ironsource.mediationsdk.metadata.MetaDataUtils;
import com.ironsource.mediationsdk.sdk.BannerSmashListener;
import com.ironsource.mediationsdk.sdk.InterstitialSmashListener;
import com.ironsource.mediationsdk.sdk.RewardedVideoSmashListener;
import com.ironsource.mediationsdk.sdk.f;
import com.ironsource.mediationsdk.sdk.j;
import com.ironsource.mediationsdk.utils.ErrorBuilder;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.ironsource.mediationsdk.utils.IronSourceUtils;
import com.ironsource.mediationsdk.utils.o;
import com.ironsource.sdk.IronSourceNetwork;
import com.ironsource.sdk.b;
import com.ironsource.sdk.c;
import com.ironsource.sdk.c.a;
import com.ironsource.sdk.j.d;
import com.ironsource.sdk.j.e;
import com.ironsource.sdk.utils.SDKUtils;
import com.unity3d.mediation.unityadsadapter.unity.UnityKeys;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
public class IronSourceAdapter extends AbstractAdapter implements ContextProvider.a, j, e {
public static final String IRONSOURCE_BIDDING_TOKEN_KEY = "token";
public static final String IRONSOURCE_ONE_FLOW_KEY = "isOneFlow";
private static final int IS_LOAD_EXCEPTION = 1000;
private static final int IS_SHOW_EXCEPTION = 1001;
private static final int RV_LOAD_EXCEPTION = 1002;
private static final int RV_SHOW_EXCEPTION = 1003;
private static final String VERSION = "7.2.4.1";
private static AtomicBoolean mDidInitSdk = new AtomicBoolean(false);
private static String mediationSegment;
private final String ADM_KEY;
private final String CUSTOM_SEGMENT;
private final String DEMAND_SOURCE_NAME;
private final String DYNAMIC_CONTROLLER_CONFIG;
private final String DYNAMIC_CONTROLLER_DEBUG_MODE;
private final String DYNAMIC_CONTROLLER_URL;
private final String LWS_SUPPORT_STATE;
private final String OW_CLIENT_SIDE_CALLBACKS;
private final String OW_PLACEMENT_ID;
private final String SDK_PLUGIN_TYPE;
private final String SESSION_ID;
a mBannerAdContainer;
final ConcurrentHashMap<String, BannerSmashListener> mDemandSourceToBNSmash;
ConcurrentHashMap<String, b> mDemandSourceToISAd;
ConcurrentHashMap<String, InterstitialSmashListener> mDemandSourceToISSmash;
ConcurrentHashMap<String, b> mDemandSourceToRvAd;
ConcurrentHashMap<String, RewardedVideoSmashListener> mDemandSourceToRvSmash;
private f mOfferwallListener;
private IronSourceAdapter(String str) {
super(str);
this.DYNAMIC_CONTROLLER_URL = "controllerUrl";
this.DYNAMIC_CONTROLLER_DEBUG_MODE = "debugMode";
this.DYNAMIC_CONTROLLER_CONFIG = "controllerConfig";
this.SESSION_ID = "sessionid";
this.SDK_PLUGIN_TYPE = "SDKPluginType";
this.CUSTOM_SEGMENT = "custom_Segment";
this.ADM_KEY = UnityKeys.PARAMETER_ADM_KEY;
this.DEMAND_SOURCE_NAME = "demandSourceName";
this.OW_PLACEMENT_ID = "placementId";
this.OW_CLIENT_SIDE_CALLBACKS = "useClientSideCallbacks";
this.LWS_SUPPORT_STATE = "isSupportedLWS";
this.mBannerAdContainer = null;
this.mDemandSourceToRvAd = new ConcurrentHashMap<>();
this.mDemandSourceToRvSmash = new ConcurrentHashMap<>();
this.mDemandSourceToISAd = new ConcurrentHashMap<>();
this.mDemandSourceToISSmash = new ConcurrentHashMap<>();
this.mDemandSourceToBNSmash = new ConcurrentHashMap<>();
mediationSegment = null;
ContextProvider.getInstance().registerLifeCycleListener(this);
}
private com.ironsource.sdk.a convertBannerSize(Activity activity, ISBannerSize iSBannerSize) {
char c;
String description = iSBannerSize.getDescription();
switch (description.hashCode()) {
case -387072689:
if (description.equals("RECTANGLE")) {
c = 4;
break;
}
c = 65535;
break;
case 72205083:
if (description.equals("LARGE")) {
c = 1;
break;
}
c = 65535;
break;
case 79011241:
if (description.equals("SMART")) {
c = 2;
break;
}
c = 65535;
break;
case 1951953708:
if (description.equals("BANNER")) {
c = 0;
break;
}
c = 65535;
break;
case 1999208305:
if (description.equals("CUSTOM")) {
c = 3;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
int i = 90;
if (c != 0) {
if (c != 1) {
if (c == 2) {
boolean isLargeScreen = AdapterUtils.isLargeScreen(activity);
r8 = isLargeScreen ? 728 : 320;
} else if (c == 3) {
int height = iSBannerSize.getHeight();
if (height != 50 && height != 90) {
return null;
}
i = height;
} else {
if (c != 4) {
return null;
}
r8 = 300;
i = 250;
}
}
return new com.ironsource.sdk.a(AdapterUtils.dpToPixels(activity, r8), AdapterUtils.dpToPixels(activity, i), description);
}
i = 50;
return new com.ironsource.sdk.a(AdapterUtils.dpToPixels(activity, r8), AdapterUtils.dpToPixels(activity, i), description);
}
private b createBannerAdInstance(String str, com.ironsource.sdk.a aVar, JSONObject jSONObject) {
IronLog.ADAPTER_API.verbose("creating banner ad instance for " + str);
IronSourceBannerListener ironSourceBannerListener = new IronSourceBannerListener(this, this.mDemandSourceToBNSmash.get(str), str);
boolean optBoolean = jSONObject.optBoolean("isOneFlow");
boolean z = jSONObject.optInt("instanceType", 2) == 2;
c cVar = new c(str, ironSourceBannerListener);
cVar.d = getInitParams();
cVar.b = z;
cVar.e = optBoolean;
cVar.c = aVar;
return cVar.a();
}
private HashMap<String, String> createBannerLoadParams(JSONObject jSONObject, String str) {
HashMap<String, String> hashMap = new HashMap<>();
if (str != null) {
C1555f.a();
hashMap.put(UnityKeys.PARAMETER_ADM_KEY, C1555f.c(str));
hashMap.put("isOneFlow", String.valueOf(jSONObject.optBoolean("isOneFlow")));
C1555f.a();
hashMap.putAll(C1555f.b(str));
}
return hashMap;
}
private b getAdInstance(String str, boolean z, boolean z2, boolean z3) {
c cVar;
b bVar = (z3 ? this.mDemandSourceToRvAd : this.mDemandSourceToISAd).get(str);
if (bVar == null) {
IronLog.ADAPTER_API.verbose("creating ad instance for " + str + " isDemandOnlyForRv=" + z + " isBidder=" + z2 + " isRewarded=" + z3);
if (z3) {
cVar = new c(str, new IronSourceRewardedVideoListener(this.mDemandSourceToRvSmash.get(str), str, z));
cVar.d = getInitParams();
cVar.f4962a = true;
} else {
cVar = new c(str, new IronSourceInterstitialListener(this.mDemandSourceToISSmash.get(str), str));
cVar.d = getInitParams();
}
cVar.b = z2;
bVar = cVar.a();
(z3 ? this.mDemandSourceToRvAd : this.mDemandSourceToISAd).put(str, bVar);
}
return bVar;
}
private String getDemandSourceName(JSONObject jSONObject) {
return !TextUtils.isEmpty(jSONObject.optString("demandSourceName")) ? jSONObject.optString("demandSourceName") : getProviderName();
}
private HashMap<String, String> getInitParams() {
HashMap<String, String> hashMap = new HashMap<>();
String pluginType = getPluginType();
if (!TextUtils.isEmpty(pluginType)) {
hashMap.put("SDKPluginType", pluginType);
}
if (!TextUtils.isEmpty(mediationSegment)) {
hashMap.put("custom_Segment", mediationSegment);
}
if (!TextUtils.isEmpty(L.a().p)) {
hashMap.put("sessionid", L.a().p);
}
return hashMap;
}
public HashMap<String, String> getOfferwallExtraParams() {
HashMap<String, String> initParams = getInitParams();
initParams.put("useClientSideCallbacks", String.valueOf(SupersonicConfig.getConfigObj().getClientSideCallbacks()));
Map<String, String> offerwallCustomParams = SupersonicConfig.getConfigObj().getOfferwallCustomParams();
if (offerwallCustomParams != null && !offerwallCustomParams.isEmpty()) {
initParams.putAll(offerwallCustomParams);
}
return initParams;
}
private void initInterstitialInternal(String str, JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener, String str2) {
initSDK(str, jSONObject);
this.mDemandSourceToISSmash.put(str2, interstitialSmashListener);
interstitialSmashListener.onInterstitialInitSuccess();
}
private void initRewardedVideoInternal(String str, JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener, String str2) {
initSDK(str, jSONObject);
this.mDemandSourceToRvSmash.put(str2, rewardedVideoSmashListener);
}
private void initSDK(String str, JSONObject jSONObject) {
if (mDidInitSdk.compareAndSet(false, true)) {
String mediationUserId = IronSourceUtils.getMediationUserId();
int optInt = jSONObject.optInt("debugMode", 0);
if (isAdaptersDebugEnabled()) {
optInt = 3;
}
IronLog.ADAPTER_API.verbose("setting debug mode to " + optInt);
SDKUtils.setDebugMode(optInt);
SDKUtils.setControllerUrl(jSONObject.optString("controllerUrl"));
IronLog.ADAPTER_API.verbose("IronSourceNetwork setting controller url to " + jSONObject.optString("controllerUrl"));
JSONObject optJSONObject = jSONObject.optJSONObject("controllerConfig");
String jSONObject2 = optJSONObject != null ? optJSONObject.toString() : "";
SDKUtils.setControllerConfig(jSONObject2);
IronLog.ADAPTER_API.verbose("IronSourceNetwork setting controller config to " + jSONObject2);
HashMap<String, String> initParams = getInitParams();
String str2 = L.a().j;
IronLog.ADAPTER_API.verbose("with appKey=" + str2 + " userId=" + mediationUserId + " parameters " + initParams);
IronSourceNetwork.setInitListener(new d() {
@Override
public void onFail(com.ironsource.sdk.g.e eVar) {
IronLog.ADAPTER_API.verbose("OnNetworkSDKInitListener fail - code:" + eVar.b + " message:" + eVar.f5138a);
}
@Override
public void onSuccess() {
IronLog.ADAPTER_API.verbose("OnNetworkSDKInitListener success");
}
});
IronSourceNetwork.initSDK(ContextProvider.getInstance().getApplicationContext(), str2, mediationUserId, initParams);
}
}
private boolean isValidMetaData(String str, String str2) {
if (str.equals("do_not_sell")) {
return MetaDataUtils.isValidCCPAMetaData(str, str2);
}
return true;
}
private void loadAdInternal(String str, String str2, boolean z, boolean z2, boolean z3) {
HashMap hashMap = new HashMap();
if (str2 != null) {
C1555f.a();
hashMap.put(UnityKeys.PARAMETER_ADM_KEY, C1555f.c(str2));
C1555f.a();
hashMap.putAll(C1555f.b(str2));
}
b adInstance = getAdInstance(str, z, z2, z3);
printInstanceExtraParams(hashMap);
IronLog.ADAPTER_API.verbose("demandSourceName=" + adInstance.c);
IronSourceNetwork.loadAd(ContextProvider.getInstance().getCurrentActiveActivity(), adInstance, hashMap);
}
private void loadBannerInternal(ISBannerSize iSBannerSize, JSONObject jSONObject, BannerSmashListener bannerSmashListener, String str) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.ADAPTER_API.verbose("demandSourceName: " + demandSourceName);
try {
com.ironsource.sdk.a convertBannerSize = convertBannerSize(ContextProvider.getInstance().getCurrentActiveActivity(), iSBannerSize);
if (convertBannerSize == null) {
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.unsupportedBannerSize(getProviderName()));
return;
}
HashMap<String, String> createBannerLoadParams = createBannerLoadParams(jSONObject, str);
printInstanceExtraParams(createBannerLoadParams);
IronSourceNetwork.loadAd(ContextProvider.getInstance().getCurrentActiveActivity(), createBannerAdInstance(demandSourceName, convertBannerSize, jSONObject), createBannerLoadParams);
} catch (Exception e) {
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildLoadFailedError("Banner Load Fail, " + getProviderName() + " - " + e.getMessage()));
}
}
private void printInstanceExtraParams(Map<String, String> map) {
if (map == null || map.size() <= 0) {
return;
}
IronLog.ADAPTER_API.verbose("instance extra params:");
for (String str : map.keySet()) {
IronLog.ADAPTER_API.verbose(str + "=" + map.get(str));
}
}
private void showAdInternal(b bVar, int i) {
int b = o.a().b(i);
HashMap hashMap = new HashMap();
hashMap.put(IronSourceConstants.KEY_SESSION_DEPTH, String.valueOf(b));
IronLog.ADAPTER_API.verbose("demandSourceName=" + bVar.c + " showParams=" + hashMap);
IronSourceNetwork.showAd(bVar, hashMap);
}
public static IronSourceAdapter startAdapter(String str) {
return new IronSourceAdapter(str);
}
@Override
public void destroyBanner(JSONObject jSONObject) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.ADAPTER_API.verbose(demandSourceName + ": destroyBanner()");
a aVar = this.mBannerAdContainer;
if (aVar != null) {
try {
} catch (Exception e) {
IronLog.ADAPTER_API.verbose("destroyBanner failed: " + e.getMessage());
}
if (aVar.f4963a == null || aVar.f4963a.d == null) {
throw new Exception("mAdPresenter or mAdPresenter.getAdViewLogic() are null");
}
aVar.a();
this.mBannerAdContainer = null;
}
}
@Override
public void earlyInit(String str, String str2, JSONObject jSONObject) {
if (L.a().j == null) {
IronLog.ADAPTER_API.error("Appkey is null for early init");
return;
}
IronSourceUtils.sendAutomationLog(getDemandSourceName(jSONObject) + ": earlyInit");
initSDK(L.a().j, jSONObject);
}
@Override
public void fetchRewardedVideoForAutomaticLoad(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.ADAPTER_API.verbose(demandSourceName);
try {
loadAdInternal(demandSourceName, null, false, false, true);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
RewardedVideoSmashListener rewardedVideoSmashListener2 = this.mDemandSourceToRvSmash.get(demandSourceName);
if (rewardedVideoSmashListener2 != null) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
rewardedVideoSmashListener2.onRewardedVideoLoadFailed(new IronSourceError(1002, e.getMessage()));
rewardedVideoSmashListener2.onRewardedVideoAvailabilityChanged(false);
}
}
}
@Override
public Map<String, Object> getBannerBiddingData(JSONObject jSONObject) {
return getBiddingData();
}
Map<String, Object> getBiddingData() {
IronLog.ADAPTER_API.verbose("");
HashMap hashMap = new HashMap();
String token = IronSourceNetwork.getToken(ContextProvider.getInstance().getApplicationContext());
if (token != null) {
hashMap.put(IRONSOURCE_BIDDING_TOKEN_KEY, token);
} else {
IronLog.ADAPTER_API.error("bidding token is null");
hashMap.put(IRONSOURCE_BIDDING_TOKEN_KEY, "");
}
return hashMap;
}
@Override
public String getCoreSDKVersion() {
return SDKUtils.getSDKVersion();
}
@Override
public Map<String, Object> getInterstitialBiddingData(JSONObject jSONObject) {
return getBiddingData();
}
@Override
public LoadWhileShowSupportState getLoadWhileShowSupportState(JSONObject jSONObject) {
LoadWhileShowSupportState loadWhileShowSupportState = this.mLWSSupportState;
return (jSONObject == null || !jSONObject.optBoolean("isSupportedLWS")) ? loadWhileShowSupportState : LoadWhileShowSupportState.LOAD_WHILE_SHOW_BY_INSTANCE;
}
@Override
public void getOfferwallCredits() {
IronLog.ADAPTER_API.verbose(getProviderName() + " getOfferwallCredits");
try {
IronSourceNetwork.getOfferWallCredits(this);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
}
}
@Override
public JSONObject getPlayerBiddingData() {
JSONObject jSONObject;
IronLog.ADAPTER_API.verbose("");
JSONObject jSONObject2 = new JSONObject();
try {
jSONObject = IronSourceNetwork.getRawToken(ContextProvider.getInstance().getApplicationContext());
} catch (Exception e) {
IronLog.ADAPTER_API.error("getRawToken exception: " + e.getLocalizedMessage());
jSONObject = null;
}
if (jSONObject != null) {
return jSONObject;
}
IronLog.ADAPTER_API.error("Player's bidding token is null");
return jSONObject2;
}
@Override
public Map<String, Object> getRewardedVideoBiddingData(JSONObject jSONObject) {
return getBiddingData();
}
@Override
public String getVersion() {
return "7.2.4.1";
}
@Override
public void initAndLoadRewardedVideo(String str, String str2, JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.INTERNAL.verbose(demandSourceName + ": demandSourceName=" + demandSourceName);
initRewardedVideoInternal(str, jSONObject, rewardedVideoSmashListener, demandSourceName);
fetchRewardedVideoForAutomaticLoad(jSONObject, rewardedVideoSmashListener);
}
@Override
public void initBannerForBidding(String str, String str2, JSONObject jSONObject, BannerSmashListener bannerSmashListener) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.ADAPTER_API.verbose("demandSourceName: " + demandSourceName);
initSDK(str, jSONObject);
this.mDemandSourceToBNSmash.put(demandSourceName, bannerSmashListener);
bannerSmashListener.onBannerInitSuccess();
}
@Override
public void initInterstitial(String str, String str2, JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.INTERNAL.verbose(demandSourceName + ": demandSourceName=" + demandSourceName);
initInterstitialInternal(str, jSONObject, interstitialSmashListener, demandSourceName);
}
@Override
public void initInterstitialForBidding(String str, String str2, JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.INTERNAL.verbose(demandSourceName + ": demandSourceName=" + demandSourceName);
initInterstitialInternal(str, jSONObject, interstitialSmashListener, demandSourceName);
}
@Override
public void initOfferwall(String str, String str2, JSONObject jSONObject) {
initSDK(str, jSONObject);
IronLog.ADAPTER_API.verbose(":initOfferwall");
postOnUIThread(new Runnable() {
@Override
public void run() {
try {
IronSourceNetwork.initOfferWall(IronSourceAdapter.this.getOfferwallExtraParams(), IronSourceAdapter.this);
} catch (Exception e) {
IronLog.ADAPTER_API.error(IronSourceAdapter.this.getProviderName() + ":initOfferwall " + e);
IronSourceAdapter.this.mOfferwallListener.a(false, ErrorBuilder.buildInitFailedError("Adapter initialization failure - " + IronSourceAdapter.this.getProviderName() + " - " + e.getMessage(), IronSourceConstants.OFFERWALL_AD_UNIT));
}
}
});
}
@Override
public void initRewardedVideoForDemandOnly(String str, String str2, JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.INTERNAL.verbose(demandSourceName + ": demandSourceName=" + demandSourceName);
initRewardedVideoInternal(str, jSONObject, rewardedVideoSmashListener, demandSourceName);
}
@Override
public void initRewardedVideoWithCallback(String str, String str2, JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
String demandSourceName = getDemandSourceName(jSONObject);
IronLog.INTERNAL.verbose(demandSourceName + ": demandSourceName=" + demandSourceName);
initRewardedVideoInternal(str, jSONObject, rewardedVideoSmashListener, demandSourceName);
rewardedVideoSmashListener.onRewardedVideoInitSuccess();
}
@Override
public boolean isInterstitialReady(JSONObject jSONObject) {
b bVar = this.mDemandSourceToISAd.get(getDemandSourceName(jSONObject));
return bVar != null && IronSourceNetwork.isAdAvailableForInstance(bVar);
}
public boolean isOfferwallAvailable() {
return true;
}
@Override
public boolean isRewardedVideoAvailable(JSONObject jSONObject) {
b bVar = this.mDemandSourceToRvAd.get(getDemandSourceName(jSONObject));
return bVar != null && IronSourceNetwork.isAdAvailableForInstance(bVar);
}
@Override
public void loadBannerForBidding(IronSourceBannerLayout ironSourceBannerLayout, JSONObject jSONObject, BannerSmashListener bannerSmashListener, String str) {
if (ironSourceBannerLayout != null) {
loadBannerInternal(ironSourceBannerLayout.getSize(), jSONObject, bannerSmashListener, str);
return;
}
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildLoadFailedError("Banner Load Fail, " + getProviderName() + " - banner is null"));
}
@Override
public void loadBannerForDemandOnlyForBidding(ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout, JSONObject jSONObject, BannerSmashListener bannerSmashListener, String str) {
if (iSDemandOnlyBannerLayout != null) {
loadBannerInternal(iSDemandOnlyBannerLayout.getSize(), jSONObject, bannerSmashListener, str);
return;
}
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildLoadFailedError("Banner Load Fail, " + getProviderName() + " - banner is null"));
}
@Override
public void loadInterstitial(JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener) {
IronLog.ADAPTER_API.verbose(getDemandSourceName(jSONObject));
try {
loadAdInternal(getDemandSourceName(jSONObject), null, false, false, false);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
interstitialSmashListener.onInterstitialAdLoadFailed(new IronSourceError(1000, e.getMessage()));
}
}
@Override
public void loadInterstitialForBidding(JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener, String str) {
IronLog.ADAPTER_API.verbose(getDemandSourceName(jSONObject));
try {
loadAdInternal(getDemandSourceName(jSONObject), str, false, true, false);
} catch (Exception e) {
IronLog.ADAPTER_API.error("for bidding exception " + e.getMessage());
interstitialSmashListener.onInterstitialAdLoadFailed(new IronSourceError(1000, e.getMessage()));
}
}
@Override
public void loadRewardedVideoForBidding(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener, String str) {
IronLog.ADAPTER_API.verbose(getDemandSourceName(jSONObject));
try {
loadAdInternal(getDemandSourceName(jSONObject), str, false, true, true);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
rewardedVideoSmashListener.onRewardedVideoLoadFailed(new IronSourceError(1002, e.getMessage()));
rewardedVideoSmashListener.onRewardedVideoAvailabilityChanged(false);
}
}
@Override
public void loadRewardedVideoForDemandOnly(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
IronLog.ADAPTER_API.verbose(getDemandSourceName(jSONObject));
try {
loadAdInternal(getDemandSourceName(jSONObject), null, true, false, true);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
rewardedVideoSmashListener.onRewardedVideoLoadFailed(new IronSourceError(1002, e.getMessage()));
}
}
@Override
public void loadRewardedVideoForDemandOnlyForBidding(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener, String str) {
IronLog.ADAPTER_API.verbose(getDemandSourceName(jSONObject));
try {
loadAdInternal(getDemandSourceName(jSONObject), str, true, true, true);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
rewardedVideoSmashListener.onRewardedVideoLoadFailed(new IronSourceError(1002, e.getMessage()));
}
}
@Override
public void onGetOWCreditsFailed(String str) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
if (this.mOfferwallListener != null) {
this.mOfferwallListener.onGetOfferwallCreditsFailed(ErrorBuilder.buildGenericError(str));
}
}
@Override
public void onOWAdClosed() {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
f fVar = this.mOfferwallListener;
if (fVar != null) {
fVar.onOfferwallClosed();
}
}
@Override
public boolean onOWAdCredited(int i, int i2, boolean z) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
f fVar = this.mOfferwallListener;
return fVar != null && fVar.onOfferwallAdCredited(i, i2, z);
}
@Override
public void onOWShowFail(String str) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
if (this.mOfferwallListener != null) {
this.mOfferwallListener.onOfferwallShowFailed(ErrorBuilder.buildGenericError(str));
}
}
@Override
public void onOWShowSuccess(String str) {
IronLog.ADAPTER_CALLBACK.verbose("onOWShowSuccess(placementId:" + str + ")");
f fVar = this.mOfferwallListener;
if (fVar != null) {
fVar.onOfferwallOpened();
}
}
@Override
public void onOfferwallEventNotificationReceived(String str, JSONObject jSONObject) {
if (jSONObject != null) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
}
}
@Override
public void onOfferwallInitFail(String str) {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
if (this.mOfferwallListener != null) {
this.mOfferwallListener.a(false, ErrorBuilder.buildGenericError(str));
}
}
@Override
public void onOfferwallInitSuccess() {
IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
f fVar = this.mOfferwallListener;
if (fVar != null) {
fVar.onOfferwallAvailable(true);
}
}
@Override
public void onPause(Activity activity) {
IronLog.ADAPTER_API.verbose("IronSourceNetwork.onPause");
IronSourceNetwork.onPause(activity);
}
@Override
public void onResume(Activity activity) {
IronLog.ADAPTER_API.verbose("IronSourceNetwork.onResume");
IronSourceNetwork.onResume(activity);
}
@Override
public void reloadBanner(IronSourceBannerLayout ironSourceBannerLayout, JSONObject jSONObject, BannerSmashListener bannerSmashListener) {
IronLog.ADAPTER_API.warning("unsupported method");
}
@Override
public void setConsent(boolean z) {
IronLog ironLog = IronLog.ADAPTER_API;
StringBuilder sb = new StringBuilder("(");
sb.append(z ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
sb.append(")");
ironLog.verbose(sb.toString());
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("consent", z ? "1" : "0");
IronSourceNetwork.updateMetadata(jSONObject);
} catch (JSONException e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
}
}
@Override
public void setInternalOfferwallListener(f fVar) {
this.mOfferwallListener = fVar;
}
@Override
public void setMediationSegment(String str) {
mediationSegment = str;
}
@Override
public void setMetaData(String str, String str2) {
if (mDidInitSdk.get()) {
return;
}
IronLog.ADAPTER_API.verbose("key=" + str + ", value=" + str2);
if (!isValidMetaData(str, str2)) {
IronLog.ADAPTER_API.verbose("MetaData not valid");
return;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(str, str2);
IronSourceNetwork.updateMetadata(jSONObject);
} catch (JSONException e) {
IronLog.ADAPTER_API.error("error - " + e);
e.printStackTrace();
}
}
@Override
public boolean shouldBindBannerViewOnReload() {
return true;
}
@Override
public void showInterstitial(JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener) {
IronLog.ADAPTER_API.verbose(getDemandSourceName(jSONObject));
try {
showAdInternal(this.mDemandSourceToISAd.get(getDemandSourceName(jSONObject)), 2);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
interstitialSmashListener.onInterstitialAdShowFailed(new IronSourceError(1001, e.getMessage()));
}
}
@Override
public void showOfferwall(String str, JSONObject jSONObject) {
IronLog.ADAPTER_API.verbose(getProviderName() + " showOfferWall");
try {
HashMap<String, String> offerwallExtraParams = getOfferwallExtraParams();
offerwallExtraParams.put("placementId", str);
IronSourceNetwork.showOfferWall(ContextProvider.getInstance().getCurrentActiveActivity(), offerwallExtraParams);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
}
}
@Override
public void showRewardedVideo(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
try {
showAdInternal(this.mDemandSourceToRvAd.get(getDemandSourceName(jSONObject)), 1);
} catch (Exception e) {
IronLog.ADAPTER_API.error("exception " + e.getMessage());
rewardedVideoSmashListener.onRewardedVideoAdShowFailed(new IronSourceError(1003, e.getMessage()));
}
}
}