Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f

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


package com.ironsource.adapters.ironsource;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
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.C2047d;
import com.ironsource.mediationsdk.ISBannerSize;
import com.ironsource.mediationsdk.IronSourceBannerLayout;
import com.ironsource.mediationsdk.LoadWhileShowSupportState;
import com.ironsource.mediationsdk.demandOnly.ISDemandOnlyBannerLayout;
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.g;
import com.ironsource.mediationsdk.utils.ErrorBuilder;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.ironsource.mediationsdk.utils.IronSourceUtils;
import com.ironsource.mediationsdk.utils.n;
import com.ironsource.mediationsdk.y;
import com.ironsource.sdk.IronSourceNetwork;
import com.ironsource.sdk.a;
import com.ironsource.sdk.b;
import com.ironsource.sdk.c;
import com.ironsource.sdk.j.d;
import com.ironsource.sdk.j.e;
import com.ironsource.sdk.utils.SDKUtils;
import com.mbridge.msdk.MBridgeConstans;
import com.startapp.sdk.adsbase.model.AdPreferences;
import com.vungle.warren.model.ReportDBAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
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, g, 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.3.0.1";
    private static AtomicBoolean mDidInitSdk = new AtomicBoolean(false);
    private final String ADM_KEY;
    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;
    final ConcurrentHashMap<String, BannerSmashListener> mDemandSourceToBNSmash;
    ConcurrentHashMap<String, ArrayList<b>> mDemandSourceToBnAd;
    ConcurrentHashMap<String, b> mDemandSourceToISAd;
    ConcurrentHashMap<String, InterstitialSmashListener> mDemandSourceToISSmash;
    ConcurrentHashMap<String, b> mDemandSourceToRvAd;
    ConcurrentHashMap<String, RewardedVideoSmashListener> mDemandSourceToRvSmash;
    private com.ironsource.mediationsdk.sdk.e 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.ADM_KEY = "adm";
        this.DEMAND_SOURCE_NAME = "demandSourceName";
        this.OW_PLACEMENT_ID = ReportDBAdapter.ReportColumns.COLUMN_PLACEMENT_ID;
        this.OW_CLIENT_SIDE_CALLBACKS = "useClientSideCallbacks";
        this.LWS_SUPPORT_STATE = "isSupportedLWS";
        this.mDemandSourceToRvAd = new ConcurrentHashMap<>();
        this.mDemandSourceToRvSmash = new ConcurrentHashMap<>();
        this.mDemandSourceToISAd = new ConcurrentHashMap<>();
        this.mDemandSourceToISSmash = new ConcurrentHashMap<>();
        this.mDemandSourceToBnAd = new ConcurrentHashMap<>();
        this.mDemandSourceToBNSmash = new ConcurrentHashMap<>();
        ContextProvider.getInstance().registerLifeCycleListener(this);
    }

    private a convertBannerSize(Context context, ISBannerSize iSBannerSize) {
        String description = iSBannerSize.getDescription();
        description.hashCode();
        char c11 = 65535;
        switch (description.hashCode()) {
            case -387072689:
                if (description.equals("RECTANGLE")) {
                    c11 = 0;
                    break;
                }
                break;
            case 72205083:
                if (description.equals("LARGE")) {
                    c11 = 1;
                    break;
                }
                break;
            case 79011241:
                if (description.equals("SMART")) {
                    c11 = 2;
                    break;
                }
                break;
            case 1951953708:
                if (description.equals(AdPreferences.TYPE_BANNER)) {
                    c11 = 3;
                    break;
                }
                break;
            case 1999208305:
                if (description.equals("CUSTOM")) {
                    c11 = 4;
                    break;
                }
                break;
        }
        int i11 = 90;
        int i12 = 320;
        switch (c11) {
            case 0:
                i12 = 300;
                i11 = 250;
                return new a(AdapterUtils.dpToPixels(context, i12), AdapterUtils.dpToPixels(context, i11), description);
            case 1:
                return new a(AdapterUtils.dpToPixels(context, i12), AdapterUtils.dpToPixels(context, i11), description);
            case 2:
                boolean isLargeScreen = AdapterUtils.isLargeScreen(context);
                if (isLargeScreen) {
                    i12 = 728;
                    break;
                }
                break;
            case 3:
                i11 = 50;
                return new a(AdapterUtils.dpToPixels(context, i12), AdapterUtils.dpToPixels(context, i11), description);
            case 4:
                int height = iSBannerSize.getHeight();
                if (height != 50 && height != 90) {
                    return null;
                }
                i11 = height;
                return new a(AdapterUtils.dpToPixels(context, i12), AdapterUtils.dpToPixels(context, i11), description);
            default:
                return null;
        }
    }

    private b createBannerAdInstance(String str, a aVar, JSONObject jSONObject, BannerSmashListener bannerSmashListener) {
        boolean z11;
        IronLog.ADAPTER_API.verbose("creating banner ad instance for " + str);
        IronSourceBannerListener ironSourceBannerListener = new IronSourceBannerListener(this, bannerSmashListener, str);
        boolean optBoolean = jSONObject.optBoolean("isOneFlow");
        if (jSONObject.optInt("instanceType", 2) == 2) {
            z11 = true;
        } else {
            z11 = false;
        }
        c cVar = new c(str, ironSourceBannerListener);
        cVar.f45379d = getInitParams();
        cVar.f45377b = z11;
        cVar.f45380e = optBoolean;
        cVar.f45378c = aVar;
        return cVar.a();
    }

    private HashMap<String, String> createBannerLoadParams(JSONObject jSONObject, String str) {
        HashMap<String, String> hashMap = new HashMap<>();
        if (str != null) {
            C2047d.a();
            hashMap.put("adm", C2047d.c(str));
            hashMap.put("isOneFlow", String.valueOf(jSONObject.optBoolean("isOneFlow")));
            C2047d.a();
            hashMap.putAll(C2047d.b(str));
        }
        return hashMap;
    }

    private String getDemandSourceName(JSONObject jSONObject) {
        if (!TextUtils.isEmpty(jSONObject.optString("demandSourceName"))) {
            return jSONObject.optString("demandSourceName");
        }
        return 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(y.a().f45283m)) {
            hashMap.put("sessionid", y.a().f45283m);
        }
        return hashMap;
    }

    private b getInterstitialAdInstance(String str, boolean z11, InterstitialSmashListener interstitialSmashListener) {
        b bVar = this.mDemandSourceToISAd.get(str);
        if (bVar == null) {
            IronLog.ADAPTER_API.verbose("creating ad instance for " + str + " isBidder=" + z11);
            c cVar = new c(str, new IronSourceInterstitialListener(interstitialSmashListener, str));
            cVar.f45379d = getInitParams();
            cVar.f45377b = z11;
            b a11 = cVar.a();
            this.mDemandSourceToISAd.put(str, a11);
            return a11;
        }
        return bVar;
    }

    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 b getRewardedVideoAdInstance(String str, boolean z11, boolean z12, RewardedVideoSmashListener rewardedVideoSmashListener) {
        b bVar = this.mDemandSourceToRvAd.get(str);
        if (bVar == null) {
            IronLog.ADAPTER_API.verbose("creating ad instance for " + str + " isDemandOnly=" + z11 + " isBidder=" + z12);
            c cVar = new c(str, new IronSourceRewardedVideoListener(rewardedVideoSmashListener, str, z11));
            cVar.f45379d = getInitParams();
            cVar.f45376a = true;
            cVar.f45377b = z12;
            b a11 = cVar.a();
            this.mDemandSourceToRvAd.put(str, a11);
            return a11;
        }
        return bVar;
    }

    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) {
        String str2;
        if (mDidInitSdk.compareAndSet(false, true)) {
            String mediationUserId = IronSourceUtils.getMediationUserId();
            int optInt = jSONObject.optInt("debugMode", 0);
            if (isAdaptersDebugEnabled()) {
                optInt = 3;
            }
            IronLog ironLog = IronLog.ADAPTER_API;
            ironLog.verbose("setting debug mode to " + optInt);
            SDKUtils.setDebugMode(optInt);
            SDKUtils.setControllerUrl(jSONObject.optString("controllerUrl"));
            ironLog.verbose("IronSourceNetwork setting controller url to " + jSONObject.optString("controllerUrl"));
            JSONObject optJSONObject = jSONObject.optJSONObject("controllerConfig");
            if (optJSONObject != null) {
                str2 = optJSONObject.toString();
            } else {
                str2 = "";
            }
            SDKUtils.setControllerConfig(str2);
            ironLog.verbose("IronSourceNetwork setting controller config to " + str2);
            HashMap<String, String> initParams = getInitParams();
            String str3 = y.a().f45271g;
            ironLog.verbose("with appKey=" + str3 + " 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.f45931b + " message:" + eVar.f45930a);
                }

                @Override
                public void onSuccess() {
                    IronLog.ADAPTER_API.verbose("OnNetworkSDKInitListener success");
                }
            });
            IronSourceNetwork.initSDK(ContextProvider.getInstance().getApplicationContext(), str3, mediationUserId, initParams);
        }
    }

    private void loadBannerInternal(ISBannerSize iSBannerSize, JSONObject jSONObject, BannerSmashListener bannerSmashListener, String str) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose("demandSourceName: " + demandSourceName);
        try {
            a convertBannerSize = convertBannerSize(ContextProvider.getInstance().getApplicationContext(), 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, bannerSmashListener), createBannerLoadParams);
        } catch (Exception e11) {
            bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildLoadFailedError("Banner Load Fail, " + getProviderName() + " - " + e11.getMessage()));
        }
    }

    private void loadInterstitialAdInternal(String str, String str2, boolean z11, InterstitialSmashListener interstitialSmashListener) {
        HashMap hashMap = new HashMap();
        if (str2 != null) {
            C2047d.a();
            hashMap.put("adm", C2047d.c(str2));
            C2047d.a();
            hashMap.putAll(C2047d.b(str2));
        }
        b interstitialAdInstance = getInterstitialAdInstance(str, z11, interstitialSmashListener);
        printInstanceExtraParams(hashMap);
        IronLog.ADAPTER_API.verbose("demandSourceName=" + interstitialAdInstance.f45354c);
        IronSourceNetwork.loadAd(ContextProvider.getInstance().getCurrentActiveActivity(), interstitialAdInstance, hashMap);
    }

    private void loadRewardedVideoAdInternal(String str, String str2, boolean z11, boolean z12, RewardedVideoSmashListener rewardedVideoSmashListener) {
        HashMap hashMap = new HashMap();
        if (str2 != null) {
            C2047d.a();
            hashMap.put("adm", C2047d.c(str2));
            C2047d.a();
            hashMap.putAll(C2047d.b(str2));
        }
        b rewardedVideoAdInstance = getRewardedVideoAdInstance(str, z11, z12, rewardedVideoSmashListener);
        printInstanceExtraParams(hashMap);
        IronLog.ADAPTER_API.verbose("demandSourceName=" + rewardedVideoAdInstance.f45354c);
        IronSourceNetwork.loadAd(ContextProvider.getInstance().getCurrentActiveActivity(), rewardedVideoAdInstance, hashMap);
    }

    private void printInstanceExtraParams(Map<String, String> map) {
        if (map != null && map.size() > 0) {
            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 i11) {
        int b11 = n.a().b(i11);
        HashMap hashMap = new HashMap();
        hashMap.put(IronSourceConstants.KEY_SESSION_DEPTH, String.valueOf(b11));
        IronLog.ADAPTER_API.verbose("demandSourceName=" + bVar.f45354c + " 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()");
        ArrayList<b> arrayList = this.mDemandSourceToBnAd.get(demandSourceName);
        if (arrayList != null) {
            try {
                Iterator<b> it = arrayList.iterator();
                while (it.hasNext()) {
                    IronSourceNetwork.destroyAd(it.next());
                }
                this.mDemandSourceToBnAd.remove(demandSourceName);
            } catch (Exception e11) {
                IronLog.ADAPTER_API.verbose("destroyBanner failed: " + e11.getMessage());
            }
        }
    }

    @Override
    public void earlyInit(String str, String str2, JSONObject jSONObject) {
        if (y.a().f45271g != null) {
            IronSourceUtils.sendAutomationLog(getDemandSourceName(jSONObject) + ": earlyInit");
            initSDK(y.a().f45271g, jSONObject);
            return;
        }
        IronLog.ADAPTER_API.error("Appkey is null for early init");
    }

    @Override
    public Map<String, Object> getBannerBiddingData(JSONObject jSONObject, JSONObject jSONObject2) {
        return getBiddingData();
    }

    public Map<String, Object> getBiddingData() {
        IronLog ironLog = IronLog.ADAPTER_API;
        ironLog.verbose();
        HashMap hashMap = new HashMap();
        String token = IronSourceNetwork.getToken(ContextProvider.getInstance().getApplicationContext());
        if (token != null) {
            hashMap.put("token", token);
        } else {
            ironLog.error("bidding token is null");
            hashMap.put("token", "");
        }
        return hashMap;
    }

    @Override
    public String getCoreSDKVersion() {
        return SDKUtils.getSDKVersion();
    }

    @Override
    public Map<String, Object> getInterstitialBiddingData(JSONObject jSONObject, JSONObject jSONObject2) {
        return getBiddingData();
    }

    @Override
    public LoadWhileShowSupportState getLoadWhileShowSupportState(JSONObject jSONObject) {
        LoadWhileShowSupportState loadWhileShowSupportState = this.mLWSSupportState;
        if (jSONObject != null && jSONObject.optBoolean("isSupportedLWS")) {
            return LoadWhileShowSupportState.LOAD_WHILE_SHOW_BY_INSTANCE;
        }
        return loadWhileShowSupportState;
    }

    @Override
    public void getOfferwallCredits() {
        IronLog.ADAPTER_API.verbose(getProviderName() + " getOfferwallCredits");
        try {
            IronSourceNetwork.getOfferWallCredits(this);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
        }
    }

    @Override
    public JSONObject getPlayerBiddingData() {
        JSONObject jSONObject;
        IronLog.ADAPTER_API.verbose();
        JSONObject jSONObject2 = new JSONObject();
        try {
            jSONObject = IronSourceNetwork.getRawToken(ContextProvider.getInstance().getApplicationContext());
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("getRawToken exception: " + e11.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, JSONObject jSONObject2) {
        return getBiddingData();
    }

    @Override
    public String getVersion() {
        return "7.3.0.1";
    }

    @Override
    public void initAndLoadRewardedVideo(String str, String str2, JSONObject jSONObject, JSONObject jSONObject2, RewardedVideoSmashListener rewardedVideoSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.INTERNAL.verbose(demandSourceName + ": demandSourceName=" + demandSourceName);
        initRewardedVideoInternal(str, jSONObject, rewardedVideoSmashListener, demandSourceName);
        loadRewardedVideo(jSONObject, jSONObject2, 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");
        AbstractAdapter.postOnUIThread(new Runnable() {
            @Override
            public void run() {
                try {
                    IronSourceNetwork.initOfferWall(IronSourceAdapter.this.getOfferwallExtraParams(), IronSourceAdapter.this);
                } catch (Exception e11) {
                    IronLog.ADAPTER_API.error(IronSourceAdapter.this.getProviderName() + ":initOfferwall " + e11);
                    IronSourceAdapter.this.mOfferwallListener.a(false, ErrorBuilder.buildInitFailedError("Adapter initialization failure - " + IronSourceAdapter.this.getProviderName() + " - " + e11.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));
        if (bVar != null && IronSourceNetwork.isAdAvailableForInstance(bVar)) {
            return true;
        }
        return false;
    }

    public boolean isOfferwallAvailable() {
        return true;
    }

    @Override
    public boolean isRewardedVideoAvailable(JSONObject jSONObject) {
        b bVar = this.mDemandSourceToRvAd.get(getDemandSourceName(jSONObject));
        if (bVar != null && IronSourceNetwork.isAdAvailableForInstance(bVar)) {
            return true;
        }
        return false;
    }

    @Override
    public void loadBannerForBidding(JSONObject jSONObject, JSONObject jSONObject2, String str, IronSourceBannerLayout ironSourceBannerLayout, BannerSmashListener bannerSmashListener) {
        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(JSONObject jSONObject, String str, ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout, BannerSmashListener bannerSmashListener) {
        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, JSONObject jSONObject2, InterstitialSmashListener interstitialSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose(demandSourceName);
        try {
            loadInterstitialAdInternal(demandSourceName, null, false, interstitialSmashListener);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
            interstitialSmashListener.onInterstitialAdLoadFailed(new IronSourceError(1000, e11.getMessage()));
        }
    }

    @Override
    public void loadInterstitialForBidding(JSONObject jSONObject, JSONObject jSONObject2, String str, InterstitialSmashListener interstitialSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose(demandSourceName);
        try {
            loadInterstitialAdInternal(demandSourceName, str, true, interstitialSmashListener);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("for bidding exception " + e11.getMessage());
            interstitialSmashListener.onInterstitialAdLoadFailed(new IronSourceError(1000, e11.getMessage()));
        }
    }

    @Override
    public void loadRewardedVideo(JSONObject jSONObject, JSONObject jSONObject2, RewardedVideoSmashListener rewardedVideoSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose(demandSourceName);
        try {
            loadRewardedVideoAdInternal(demandSourceName, null, false, false, rewardedVideoSmashListener);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
            RewardedVideoSmashListener rewardedVideoSmashListener2 = this.mDemandSourceToRvSmash.get(demandSourceName);
            if (rewardedVideoSmashListener2 != null) {
                IronLog.ADAPTER_API.error("exception " + e11.getMessage());
                rewardedVideoSmashListener2.onRewardedVideoLoadFailed(new IronSourceError(1002, e11.getMessage()));
                rewardedVideoSmashListener2.onRewardedVideoAvailabilityChanged(false);
            }
        }
    }

    @Override
    public void loadRewardedVideoForBidding(JSONObject jSONObject, JSONObject jSONObject2, String str, RewardedVideoSmashListener rewardedVideoSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose(demandSourceName);
        try {
            loadRewardedVideoAdInternal(demandSourceName, str, false, true, rewardedVideoSmashListener);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
            rewardedVideoSmashListener.onRewardedVideoLoadFailed(new IronSourceError(1002, e11.getMessage()));
            rewardedVideoSmashListener.onRewardedVideoAvailabilityChanged(false);
        }
    }

    @Override
    public void loadRewardedVideoForDemandOnly(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose(demandSourceName);
        try {
            loadRewardedVideoAdInternal(demandSourceName, null, true, false, rewardedVideoSmashListener);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
            rewardedVideoSmashListener.onRewardedVideoLoadFailed(new IronSourceError(1002, e11.getMessage()));
        }
    }

    @Override
    public void loadRewardedVideoForDemandOnlyForBidding(JSONObject jSONObject, String str, RewardedVideoSmashListener rewardedVideoSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose(demandSourceName);
        try {
            loadRewardedVideoAdInternal(demandSourceName, str, true, true, rewardedVideoSmashListener);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
            rewardedVideoSmashListener.onRewardedVideoLoadFailed(new IronSourceError(1002, e11.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());
        com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
        if (eVar != null) {
            eVar.onOfferwallClosed();
        }
    }

    @Override
    public boolean onOWAdCredited(int i11, int i12, boolean z11) {
        IronLog.ADAPTER_CALLBACK.verbose(getProviderName());
        com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
        if (eVar != null && eVar.onOfferwallAdCredited(i11, i12, z11)) {
            return true;
        }
        return false;
    }

    @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 + ")");
        com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
        if (eVar != null) {
            eVar.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());
        com.ironsource.mediationsdk.sdk.e eVar = this.mOfferwallListener;
        if (eVar != null) {
            eVar.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 setConsent(boolean z11) {
        String str;
        String str2;
        IronLog ironLog = IronLog.ADAPTER_API;
        StringBuilder sb2 = new StringBuilder("(");
        if (z11) {
            str = "true";
        } else {
            str = "false";
        }
        sb2.append(str);
        sb2.append(")");
        ironLog.verbose(sb2.toString());
        JSONObject jSONObject = new JSONObject();
        if (z11) {
            str2 = "1";
        } else {
            str2 = MBridgeConstans.ENDCARD_URL_TYPE_PL;
        }
        try {
            jSONObject.put("consent", str2);
            IronSourceNetwork.updateMetadata(jSONObject);
        } catch (JSONException e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
        }
    }

    @Override
    public void setInternalOfferwallListener(com.ironsource.mediationsdk.sdk.e eVar) {
        this.mOfferwallListener = eVar;
    }

    @Override
    public void setMetaData(String str, List<String> list) {
        if (list.isEmpty()) {
            return;
        }
        String str2 = list.get(0);
        if (!mDidInitSdk.get()) {
            IronLog ironLog = IronLog.ADAPTER_API;
            ironLog.verbose("key=" + str + ", value=" + str2);
            if (!MetaDataUtils.isValidCCPAMetaData(str, str2)) {
                ironLog.verbose("MetaData not valid");
                return;
            }
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put(str, str2);
                IronSourceNetwork.updateMetadata(jSONObject);
            } catch (JSONException e11) {
                IronLog.ADAPTER_API.error("error - " + e11);
                e11.printStackTrace();
            }
        }
    }

    @Override
    public void showInterstitial(JSONObject jSONObject, InterstitialSmashListener interstitialSmashListener) {
        String demandSourceName = getDemandSourceName(jSONObject);
        IronLog.ADAPTER_API.verbose(demandSourceName);
        try {
            showAdInternal(this.mDemandSourceToISAd.get(demandSourceName), 2);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
            interstitialSmashListener.onInterstitialAdShowFailed(new IronSourceError(1001, e11.getMessage()));
        }
    }

    @Override
    public void showOfferwall(String str, JSONObject jSONObject) {
        IronLog.ADAPTER_API.verbose(getProviderName() + " showOfferWall");
        try {
            HashMap<String, String> offerwallExtraParams = getOfferwallExtraParams();
            offerwallExtraParams.put(ReportDBAdapter.ReportColumns.COLUMN_PLACEMENT_ID, str);
            IronSourceNetwork.showOfferWall(ContextProvider.getInstance().getCurrentActiveActivity(), offerwallExtraParams);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
        }
    }

    @Override
    public void showRewardedVideo(JSONObject jSONObject, RewardedVideoSmashListener rewardedVideoSmashListener) {
        try {
            showAdInternal(this.mDemandSourceToRvAd.get(getDemandSourceName(jSONObject)), 1);
        } catch (Exception e11) {
            IronLog.ADAPTER_API.error("exception " + e11.getMessage());
            rewardedVideoSmashListener.onRewardedVideoAdShowFailed(new IronSourceError(1003, e11.getMessage()));
        }
    }
}