package com.fyber.inneractive.sdk.flow; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import com.fyber.inneractive.sdk.R; import com.fyber.inneractive.sdk.activities.InneractiveInternalBrowserActivity; import com.fyber.inneractive.sdk.click.f; import com.fyber.inneractive.sdk.click.l; import com.fyber.inneractive.sdk.config.IAConfigManager; import com.fyber.inneractive.sdk.config.enums.UnitDisplayType; import com.fyber.inneractive.sdk.external.ImpressionData; import com.fyber.inneractive.sdk.external.InneractiveAdRenderer; import com.fyber.inneractive.sdk.external.InneractiveAdRequest; import com.fyber.inneractive.sdk.external.InneractiveAdSpot; import com.fyber.inneractive.sdk.external.InneractiveAdViewEventsListenerWithImpressionData; import com.fyber.inneractive.sdk.external.InneractiveFullscreenAdEventsListenerWithImpressionData; import com.fyber.inneractive.sdk.external.InneractiveUnitController; import com.fyber.inneractive.sdk.external.InneractiveUnitController.EventsListener; import com.fyber.inneractive.sdk.external.OnGlobalImpressionDataListener; import com.fyber.inneractive.sdk.external.WebViewRendererProcessHasGoneError; import com.fyber.inneractive.sdk.flow.q; import com.fyber.inneractive.sdk.network.j0; import com.fyber.inneractive.sdk.network.q0; import com.fyber.inneractive.sdk.network.s; import com.fyber.inneractive.sdk.util.IAlog; import com.fyber.inneractive.sdk.util.p0; import com.fyber.inneractive.sdk.web.u; import java.util.ArrayList; import org.json.JSONArray; /* loaded from: classes2.dex */ public abstract class r implements InneractiveAdRenderer, InneractiveInternalBrowserActivity.InternalBrowserListener, f.a, u.d { public InneractiveAdSpot a; public AdContent b; public EventsListener c; public boolean d = false; public boolean e = false; public boolean f = true; public Runnable g; public com.fyber.inneractive.sdk.click.l h; public a i; public View j; public class a implements l.b { public final /* synthetic */ p0 a; public final /* synthetic */ com.fyber.inneractive.sdk.util.h b; public a(p0 p0Var, com.fyber.inneractive.sdk.util.h hVar) { this.a = p0Var; this.b = hVar; } @Override // com.fyber.inneractive.sdk.click.l.b public final void a(com.fyber.inneractive.sdk.click.b bVar) { r rVar = r.this; rVar.getClass(); IAlog.a("%s super click result: %s", IAlog.a(rVar), bVar); r rVar2 = r.this; if (rVar2.h == null) { IAlog.a("%s click handler is null. Probably cancelled", IAlog.a(rVar2)); return; } rVar2.h = null; rVar2.i = null; rVar2.F(); if (bVar != null) { r rVar3 = r.this; p0 p0Var = this.a; com.fyber.inneractive.sdk.util.h hVar = this.b; rVar3.getClass(); l.d dVar = bVar.a; if (dVar == l.d.OPEN_IN_EXTERNAL_APPLICATION || dVar == l.d.OPEN_GOOGLE_STORE) { IAlog.a("InneractiveAdRendererImpl: handleOpenResult - opened in external application", new Object[0]); ArrayList arrayList = bVar.f; com.fyber.inneractive.sdk.click.i iVar = (com.fyber.inneractive.sdk.click.i) arrayList.get(arrayList.size() - 1); l.d dVar2 = iVar.c; if (dVar2 == l.d.OPENED_IN_EXTERNAL_BROWSER) { rVar3.a(iVar.a, dVar2); } if (rVar3.c != null) { rVar3.E(); } } else if (dVar == l.d.OPENED_IN_INTERNAL_BROWSER) { IAlog.a("InneractiveAdRendererImpl: handleOpenResult - opened in internal browser", new Object[0]); rVar3.d = true; InneractiveInternalBrowserActivity.setInternalBrowserListener(rVar3); } else if (dVar == l.d.OPENED_USING_CHROME_NAVIGATE || dVar == l.d.OPENED_IN_EXTERNAL_BROWSER) { IAlog.a("InneractiveAdRendererImpl: handleOpenResult - opened in external browser", new Object[0]); rVar3.a(bVar.d, bVar.a); if (rVar3.c != null) { rVar3.E(); } } if (rVar3.j() == com.fyber.inneractive.sdk.ignite.l.NONE || !(TextUtils.isEmpty(bVar.c) || bVar.c.equals("IgniteGooglePlay"))) { rVar3.b(bVar, p0Var, hVar); } } } } public int A() { return -1; } public boolean B() { return false; } public void F() { View y = y(); if (y == null || this.j == null || y.getParent() == null || !(y.getParent() instanceof ViewGroup)) { return; } y.getLayoutParams(); ((ViewGroup) y.getParent()).removeView(this.j); c(this.j); this.j = null; } public final void G() { AdContent adcontent = this.b; if (adcontent == null || adcontent.d() == null) { return; } String str = this.b.d().o; if (TextUtils.isEmpty(str)) { return; } IAlog.e("%sfiring rewarded completion!", IAlog.a(this)); j0.b(str); } public void b(View view) { } public final void b(com.fyber.inneractive.sdk.response.e eVar) { String str = eVar.k; if (str == null || str.trim().length() <= 0) { return; } IAlog.e("%sfiring impression!", IAlog.a(this)); j0.b(str); } public void c(View view) { } @Override // com.fyber.inneractive.sdk.external.InneractiveAdRenderer public boolean canRefreshAd() { return true; } public final com.fyber.inneractive.sdk.ignite.l j() { AdContent adcontent = this.b; return (adcontent == null || !adcontent.f() || this.b.d() == null) ? com.fyber.inneractive.sdk.ignite.l.NONE : this.b.d().F; } @Override // com.fyber.inneractive.sdk.activities.InneractiveInternalBrowserActivity.InternalBrowserListener public final void onApplicationInBackground() { E(); } @Override // com.fyber.inneractive.sdk.activities.InneractiveInternalBrowserActivity.InternalBrowserListener public final void onInternalBrowserDismissed() { IAlog.a("onInternalBrowserDismissed callback called", new Object[0]); if (this.d) { this.d = false; InneractiveInternalBrowserActivity.setInternalBrowserListener(null); } if (this.c != null) { IAlog.a("%sCalling external interface onAdWillCloseInternalBrowser", IAlog.a(this)); this.c.onAdWillCloseInternalBrowser(this.a); } } public void x() { View y = y(); if (y == null || y.getParent() == null || !(y.getParent() instanceof ViewGroup) || this.j != null) { return; } View inflate = View.inflate(y.getContext(), R.layout.ia_layout_click_overlay, null); this.j = inflate; if (inflate != null) { ((ViewGroup) y.getParent()).addView(this.j, y.getLayoutParams()); b(this.j); } } public abstract View y(); public int z() { return -1; } @Override // com.fyber.inneractive.sdk.external.InneractiveAdRenderer public void destroy() { if (this.d) { InneractiveInternalBrowserActivity.setInternalBrowserListener(null); this.d = false; } Runnable runnable = this.g; if (runnable != null) { com.fyber.inneractive.sdk.util.p.b.removeCallbacks(runnable); this.g = null; } this.b = null; this.c = null; this.a = null; if (this.h != null) { F(); q0 q0Var = this.h.g; if (q0Var != null) { q0Var.a = true; } this.h = null; this.i = null; } } public void C() { com.fyber.inneractive.sdk.response.e d; if (this.c != null) { IAlog.a("%sCalling external interface onAdClicked", IAlog.a(this)); this.c.onAdClicked(this.a); } AdContent adcontent = this.b; if (adcontent == null || (d = adcontent.d()) == null) { return; } IAConfigManager.L.w.a(d.n, "LAST_CLICKED", "1"); } public final void D() { com.fyber.inneractive.sdk.response.e d; if (this.e || this.c == null) { return; } IAlog.a("%sCalling external interface onAdImpression", IAlog.a(this)); this.c.onAdImpression(this.a); AdContent adcontent = this.b; if (adcontent != null && (d = adcontent.d()) != null) { IAConfigManager iAConfigManager = IAConfigManager.L; com.fyber.inneractive.sdk.config.i0 i0Var = iAConfigManager.w; if (i0Var != null) { UnitDisplayType unitDisplayType = d.n; ImpressionData impressionData = d.r; i0Var.a(unitDisplayType, "LAST_DOMAIN_SHOWED", impressionData != null ? impressionData.getAdvertiserDomain() : null); i0Var.a(unitDisplayType, "LAST_APP_BUNDLE_ID", d.y); if (this.b.isVideoAd()) { i0Var.a(unitDisplayType, "LAST_VAST_SKIPED", "0"); i0Var.a(unitDisplayType, "LAST_VAST_CLICKED_TYPE", "0"); } i0Var.a(unitDisplayType, "LAST_CLICKED", "0"); } com.fyber.inneractive.sdk.util.j0 j0Var = iAConfigManager.z; com.fyber.inneractive.sdk.config.f0 f0Var = this.b.d; ImpressionData impressionData2 = d.r; if (f0Var != null) { OnGlobalImpressionDataListener onGlobalImpressionDataListener = j0Var.a; if (onGlobalImpressionDataListener != null) { com.fyber.inneractive.sdk.config.e0 e0Var = (com.fyber.inneractive.sdk.config.e0) f0Var; onGlobalImpressionDataListener.onImpression(e0Var.b, e0Var.a, impressionData2); } } else { j0Var.getClass(); } EventsListener eventslistener = this.c; if (eventslistener instanceof InneractiveFullscreenAdEventsListenerWithImpressionData) { ((InneractiveFullscreenAdEventsListenerWithImpressionData) eventslistener).onAdImpression(this.a, d.r); } else if (eventslistener instanceof InneractiveAdViewEventsListenerWithImpressionData) { ((InneractiveAdViewEventsListenerWithImpressionData) eventslistener).onAdImpression(this.a, d.r); } } this.e = true; } public final void E() { if (this.c != null) { IAlog.a("%sCalling external interface onAdWillOpenExternalApp", IAlog.a(this)); this.c.onAdWillOpenExternalApp(this.a); } } /* JADX WARN: Removed duplicated region for block: B:43:0x00cc */ /* JADX WARN: Removed duplicated region for block: B:46:0x00dd */ /* JADX WARN: Removed duplicated region for block: B:50:0x00f3 */ /* JADX WARN: Removed duplicated region for block: B:59:0x010e */ /* JADX WARN: Removed duplicated region for block: B:62:0x014f */ /* JADX WARN: Removed duplicated region for block: B:64:0x0158 */ /* JADX WARN: Removed duplicated region for block: B:67:0x015e */ /* JADX WARN: Removed duplicated region for block: B:72:0x016d */ /* JADX WARN: Removed duplicated region for block: B:77:0x0180 */ /* JADX WARN: Removed duplicated region for block: B:85:0x0155 */ /* JADX WARN: Removed duplicated region for block: B:86:0x00e0 */ /* JADX WARN: Removed duplicated region for block: B:89:0x00d5 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final com.fyber.inneractive.sdk.util.a0.a a(android.content.Context r14, java.lang.String r15, com.fyber.inneractive.sdk.util.p0 r16, com.fyber.inneractive.sdk.util.h r17) { /* Method dump skipped, instructions count: 455 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.fyber.inneractive.sdk.flow.r.a(android.content.Context, java.lang.String, com.fyber.inneractive.sdk.util.p0, com.fyber.inneractive.sdk.util.h):com.fyber.inneractive.sdk.util.a0$a"); } @Override // com.fyber.inneractive.sdk.external.InneractiveAdRenderer public void initialize(InneractiveAdSpot inneractiveAdSpot) { this.a = inneractiveAdSpot; this.b = (AdContent) inneractiveAdSpot.getAdContent(); this.c = (EventsListener) inneractiveAdSpot.getSelectedUnitController().getEventsListener(); } /* JADX WARN: Code restructure failed: missing block: B:92:0x01b2, code lost: if (r10.a(true, "show_cta") != false) goto L103; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void b(com.fyber.inneractive.sdk.click.b r9, com.fyber.inneractive.sdk.util.p0 r10, com.fyber.inneractive.sdk.util.h r11) { /* Method dump skipped, instructions count: 456 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.fyber.inneractive.sdk.flow.r.b(com.fyber.inneractive.sdk.click.b, com.fyber.inneractive.sdk.util.p0, com.fyber.inneractive.sdk.util.h):void"); } public static void a(com.fyber.inneractive.sdk.response.e eVar) { String str = eVar.l; if (str == null || str.trim().length() <= 0) { return; } j0.b(str); } @Override // com.fyber.inneractive.sdk.click.f.a public final void a(com.fyber.inneractive.sdk.click.b bVar, p0 p0Var, com.fyber.inneractive.sdk.util.h hVar) { b(bVar, p0Var, hVar); } public final void a(String str, l.d dVar) { com.fyber.inneractive.sdk.response.e eVar; JSONArray jSONArray; InneractiveAdRequest inneractiveAdRequest; AdContent adcontent = this.b; if (adcontent != null) { eVar = adcontent.d(); AdContent adcontent2 = this.b; inneractiveAdRequest = adcontent2.a; com.fyber.inneractive.sdk.config.global.s sVar = adcontent2.c; jSONArray = sVar != null ? sVar.c() : null; } else { eVar = null; jSONArray = null; inneractiveAdRequest = null; } s.a a2 = new s.a(com.fyber.inneractive.sdk.network.r.EXTERNAL_BROWSER_OPENED, inneractiveAdRequest, eVar, jSONArray).a("url", str); Object[] objArr = new Object[2]; objArr[0] = "fallback"; objArr[1] = (dVar == l.d.OPENED_USING_CHROME_NAVIGATE || dVar == l.d.OPENED_IN_EXTERNAL_BROWSER) ? "chrome" : "na"; a2.a(objArr).a((String) null); } public final void a(WebViewRendererProcessHasGoneError webViewRendererProcessHasGoneError) { String simpleName = webViewRendererProcessHasGoneError.getClass().getSimpleName(); String message = webViewRendererProcessHasGoneError.getMessage(); AdContent adcontent = this.b; com.fyber.inneractive.sdk.network.t.a(simpleName, message, adcontent != null ? adcontent.a : null, adcontent != null ? adcontent.d() : null); if (this.c != null) { IAlog.a("%sCalling external interface onAdEnteredErrorState: %s", IAlog.a(this), webViewRendererProcessHasGoneError.getMessage()); this.c.onAdEnteredErrorState(this.a, webViewRendererProcessHasGoneError); } } public static void a(com.fyber.inneractive.sdk.cache.session.enums.a aVar, com.fyber.inneractive.sdk.cache.session.enums.b bVar) { com.fyber.inneractive.sdk.cache.session.d dVar = IAConfigManager.L.w.a; if (dVar != null) { com.fyber.inneractive.sdk.util.p.a(new com.fyber.inneractive.sdk.cache.session.c(dVar, aVar, bVar)); } } }