package com.igaworks.ssp.part.hybrid; import android.content.Context; import android.os.Handler; import android.os.Looper; import android.webkit.JavascriptInterface; import android.webkit.WebView; import com.igaworks.ssp.AdPopcornSSP; import com.igaworks.ssp.CustomAdType; import com.igaworks.ssp.SSPErrorCode; import com.igaworks.ssp.common.g; import com.igaworks.ssp.common.g.b; import com.igaworks.ssp.part.custom.AdPopcornSSPCustomAd; import com.igaworks.ssp.part.custom.listener.ICustomAdListener; import java.lang.ref.WeakReference; /* loaded from: classes2.dex */ public class AdPopcornSSPJsBridge { public static final String INTERFACE_NAME = "apssp"; /* renamed from: a, reason: collision with root package name */ private WeakReference f6992a; /* renamed from: b, reason: collision with root package name */ private WebView f6993b; class a implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ String f6994a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ String f6995b; a(String str, String str2) { this.f6994a = str; this.f6995b = str2; } @Override // java.lang.Runnable public void run() { AdPopcornSSPJsBridge.this.f6993b.evaluateJavascript("window.localStorage.setItem('" + this.f6994a + "','" + this.f6995b + "');", null); } } class b implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ String f6997a; b(String str) { this.f6997a = str; } @Override // java.lang.Runnable public void run() { AdPopcornSSPJsBridge.this.f6993b.loadUrl("javascript:" + this.f6997a); } } class c extends com.igaworks.ssp.common.o.c { class a implements Runnable { a() { } @Override // java.lang.Runnable public void run() { AdPopcornSSPJsBridge.this.setLocalStorage("apssp_adid", AdPopcornSSP.getADID()); } } c() { } @Override // com.igaworks.ssp.common.o.c public void a() { new Handler(Looper.getMainLooper()).post(new a()); } } class d implements ICustomAdListener { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ AdPopcornSSPCustomAd f7001a; d(AdPopcornSSPCustomAd adPopcornSSPCustomAd) { this.f7001a = adPopcornSSPCustomAd; } @Override // com.igaworks.ssp.part.custom.listener.ICustomAdListener public void OnCustomAdReceiveFailed(String str, SSPErrorCode sSPErrorCode) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdPopcornSSPJsBridge load failed, placementId : " + str + ", sspErrorCode : " + sSPErrorCode.getErrorCode()); AdPopcornSSPJsBridge.this.callJavascript("apsspads.renderAd('" + str + "'," + ((Object) null) + "," + ((Object) null) + "," + ((Object) null) + ")"); } /* JADX WARN: Removed duplicated region for block: B:43:0x0117 A[ADDED_TO_REGION] */ /* JADX WARN: Removed duplicated region for block: B:48:0x0151 */ /* JADX WARN: Removed duplicated region for block: B:50:0x0181 */ @Override // com.igaworks.ssp.part.custom.listener.ICustomAdListener /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public void OnCustomAdReceiveSuccess(java.lang.String r11, java.lang.String r12) { /* Method dump skipped, instructions count: 427 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: com.igaworks.ssp.part.hybrid.AdPopcornSSPJsBridge.d.OnCustomAdReceiveSuccess(java.lang.String, java.lang.String):void"); } } public AdPopcornSSPJsBridge(Context context, WebView webView) { this.f6992a = new WeakReference<>(context); this.f6993b = webView; } @JavascriptInterface public void callBid(String str, boolean z10) { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdPopcornSSPJsBridge callBid : " + str + ", isNative : " + z10); AdPopcornSSPCustomAd adPopcornSSPCustomAd = new AdPopcornSSPCustomAd(this.f6992a.get()); adPopcornSSPCustomAd.setPlacementId(str); adPopcornSSPCustomAd.setAdType(z10 ? CustomAdType.NATIVE_AD : CustomAdType.BANNER_300x250); adPopcornSSPCustomAd.setCustomAdEventCallbackListener(new d(adPopcornSSPCustomAd)); adPopcornSSPCustomAd.loadAd(); } catch (Exception unused) { } } public void callJavascript(String str) { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "callJavascript : " + str); WebView webView = this.f6993b; if (webView != null) { webView.post(new b(str)); } } catch (Exception unused) { } } @JavascriptInterface public void destroy() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdPopcornSSPJsBridge destroy"); AdPopcornSSP.destroy(); } catch (Exception unused) { } } @JavascriptInterface public void init() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdPopcornSSPJsBridge init"); AdPopcornSSP.init(this.f6992a.get()); if (g.e().i()) { setLocalStorage("apssp_adid", AdPopcornSSP.getADID()); } else { g.e().a(new c()); g e10 = g.e(); e10.getClass(); e10.new b(this.f6992a.get().getApplicationContext()).start(); } } catch (Exception unused) { } } public void setLocalStorage(String str, String str2) { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdPopcornSSPJsBridge setLocalStorage"); this.f6993b.post(new a(str, str2)); } catch (Exception unused) { } } }