package com.fyber.inneractive.sdk.ui; import android.net.Uri; import android.os.Handler; import android.webkit.WebView; import com.fyber.inneractive.sdk.R; import com.fyber.inneractive.sdk.config.global.s; import com.fyber.inneractive.sdk.external.InneractiveAdRequest; import com.fyber.inneractive.sdk.external.InneractiveUnitController; import com.fyber.inneractive.sdk.measurement.a; import com.fyber.inneractive.sdk.mraid.f; import com.fyber.inneractive.sdk.mraid.g; import com.fyber.inneractive.sdk.mraid.i; import com.fyber.inneractive.sdk.mraid.k; import com.fyber.inneractive.sdk.mraid.l; import com.fyber.inneractive.sdk.mraid.m; import com.fyber.inneractive.sdk.mraid.n; import com.fyber.inneractive.sdk.mraid.o; import com.fyber.inneractive.sdk.mraid.p; import com.fyber.inneractive.sdk.mraid.q; import com.fyber.inneractive.sdk.mraid.r; 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.h; import com.fyber.inneractive.sdk.web.j; import com.mbridge.msdk.foundation.entity.CampaignEx; import java.net.URI; import java.util.LinkedHashMap; /* loaded from: classes2.dex */ public class IAmraidWebViewController extends j { public final a q0; public static class MraidVideoFailedToDisplayError extends InneractiveUnitController.AdDisplayError { public MraidVideoFailedToDisplayError() { super("an MRAID video has not started playing in a timely fashion"); } } public class a implements Runnable { public a() { } @Override // java.lang.Runnable public final void run() { h hVar = IAmraidWebViewController.this.b; if (hVar != null) { hVar.a("if (FyberMraidVideoController.getCurrentTime() < 0.2) { var ifr = document.createElement('iframe'); var container = document.body || document.documentElement; container.appendChild(ifr); ifr.setAttribute('sandbox', ''); ifr.setAttribute('style', 'position: fixed; bottom: -20px; border: none; visibility: hidden; height: 20px; z-index: -99999'); ifr.setAttribute('src','FyMraidVideo://fyMraidVideoAdPlaybackFailure'); console.log('dispatched closure event'); } else { console.log('video has progressed'); };"); } } } public IAmraidWebViewController(s sVar, com.fyber.inneractive.sdk.measurement.a aVar, j.d dVar, j.g gVar, j.h hVar, boolean z, boolean z2) { super(sVar, aVar, dVar, gVar, hVar, z); this.q0 = new a(); this.F = z2; this.b.setId(R.id.ia_inneractive_webview_mraid); } @Override // com.fyber.inneractive.sdk.web.f public final boolean a(String str, p0 p0Var) { com.fyber.inneractive.sdk.mraid.b cVar; com.fyber.inneractive.sdk.mraid.b bVar; h hVar; Uri parse = Uri.parse(str); String uri = parse.toString(); parse.getScheme(); if (uri.startsWith("iaadfinishedloading")) { if (uri.endsWith("success")) { IAlog.e("received iaadfinishedloading success", new Object[0]); if (!this.a && this.f != null && (hVar = this.b) != null) { hVar.b(); this.a = true; s(); } } return true; } String scheme = Uri.parse(str).getScheme(); h hVar2 = this.b; if (hVar2 != null && hVar2.isShown()) { if (!CampaignEx.JSON_KEY_MRAID.equals(scheme)) { return false; } URI create = URI.create(str); String host = create.getHost(); try { LinkedHashMap a2 = j.a(create); switch (f.a[g.a(host).ordinal()]) { case 1: cVar = new com.fyber.inneractive.sdk.mraid.c(a2, this, p0Var); bVar = cVar; break; case 2: cVar = new com.fyber.inneractive.sdk.mraid.e(a2, this, p0Var); bVar = cVar; break; case 3: cVar = new com.fyber.inneractive.sdk.mraid.s(a2, this, p0Var); bVar = cVar; break; case 4: cVar = new m(a2, this, p0Var); bVar = cVar; break; case 5: cVar = new o(a2, this, p0Var); bVar = cVar; break; case 6: cVar = new k(a2, this, p0Var); bVar = cVar; break; case 7: cVar = new q(a2, this, p0Var); bVar = cVar; break; case 8: cVar = new p(a2, this, p0Var); bVar = cVar; break; case 9: cVar = new n(a2, this, p0Var); bVar = cVar; break; case 10: cVar = new r(a2, this, p0Var); bVar = cVar; break; case 11: cVar = new com.fyber.inneractive.sdk.mraid.h(a2, this, p0Var); bVar = cVar; break; case 12: cVar = new i(a2, this, p0Var); bVar = cVar; break; case 13: cVar = new com.fyber.inneractive.sdk.mraid.j(a2, this, p0Var); bVar = cVar; break; case 14: cVar = new l(a2, this, p0Var); bVar = cVar; break; case 15: cVar = new com.fyber.inneractive.sdk.mraid.d(a2, this, p0Var); bVar = cVar; break; default: bVar = null; break; } if (bVar == null || ((bVar instanceof com.fyber.inneractive.sdk.mraid.e) && this.R == j.g.INTERSTITIAL)) { h hVar3 = this.b; if (hVar3 != null) { hVar3.a("window.mraidbridge.nativeCallComplete('" + host + "');"); } } else { bVar.a = host; IAlog.e("Processing MRaid command: %s", host); if (bVar instanceof com.fyber.inneractive.sdk.mraid.a) { a(new j.C0111j((com.fyber.inneractive.sdk.mraid.a) bVar)); } else { if (bVar.b()) { j(); } bVar.a(); } h hVar4 = this.b; if (hVar4 != null) { hVar4.a("window.mraidbridge.nativeCallComplete('" + host + "');"); } } } catch (Exception unused) { } } return true; } @Override // com.fyber.inneractive.sdk.web.f public final void d() { b(false); Handler handler = com.fyber.inneractive.sdk.util.p.b; handler.removeCallbacks(this.q0); handler.removeCallbacks(this.K); } @Override // com.fyber.inneractive.sdk.web.f public final a.InterfaceC0075a e() { return this.J; } /* JADX WARN: Can't wrap try/catch for region: R(28:0|1|(1:57)(1:7)|8|(1:10)(1:56)|11|(1:13)(1:55)|14|(4:18|19|20|(19:22|23|24|25|(14:27|28|29|30|(8:32|33|34|35|36|(1:43)|40|41)|46|33|34|35|36|(1:38)|43|40|41)|49|28|29|30|(0)|46|33|34|35|36|(0)|43|40|41))|54|23|24|25|(0)|49|28|29|30|(0)|46|33|34|35|36|(0)|43|40|41) */ /* JADX WARN: Code restructure failed: missing block: B:45:0x011b, code lost: r0 = ""; */ /* JADX WARN: Removed duplicated region for block: B:27:0x00e4 */ /* JADX WARN: Removed duplicated region for block: B:32:0x0109 */ /* JADX WARN: Removed duplicated region for block: B:38:0x0125 */ @Override // com.fyber.inneractive.sdk.web.g0 /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void m() { /* Method dump skipped, instructions count: 311 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.fyber.inneractive.sdk.ui.IAmraidWebViewController.m():void"); } public void setMuteMraidVideo(boolean z) { this.E = z; } @Override // com.fyber.inneractive.sdk.web.g0 public final void q() { h hVar; if (this.C && this.D && this.A && (hVar = this.b) != null) { hVar.a("FyberMraidVideoController.play()"); a aVar = this.q0; if (aVar != null) { com.fyber.inneractive.sdk.util.p.b.postDelayed(aVar, 5000L); } if (this.E) { this.b.a("FyberMraidVideoController.mute(true)"); } } } @Override // com.fyber.inneractive.sdk.web.j, com.fyber.inneractive.sdk.web.f, com.fyber.inneractive.sdk.web.g public final boolean a(WebView webView, String str) { s sVar; IAlog.a("IAmraidWebViewController: handleUrl = %s", str); if (this.b == null) { IAlog.a("handleUrl: web view already destroyed. Cannot handle url", new Object[0]); return false; } if (str != null && str.toLowerCase().startsWith("FyMraidVideo".toLowerCase())) { if (str.toLowerCase().endsWith("fyMraidVideoAd".toLowerCase())) { IAlog.e("Dispatching MRAID Video detection event", new Object[0]); com.fyber.inneractive.sdk.response.e eVar = this.t; if (eVar == null) { com.fyber.inneractive.sdk.flow.q qVar = this.s; eVar = qVar == null ? null : qVar.d(); } com.fyber.inneractive.sdk.network.r rVar = com.fyber.inneractive.sdk.network.r.MRAID_VIDEO_DETECTED; InneractiveAdRequest inneractiveAdRequest = this.r; com.fyber.inneractive.sdk.flow.q qVar2 = this.s; new s.a(rVar, inneractiveAdRequest, eVar, (qVar2 == null || (sVar = qVar2.c) == null) ? null : sVar.c()).a((String) null); this.D = true; q(); } else if (str.toLowerCase().endsWith("fyMraidVideoAdPlaybackFailure".toLowerCase())) { IAlog.b("MRAID Video has not started in a timely fashion, showing close button", new Object[0]); L l = this.g; if (l != 0) { this.Y = false; ((j.f) l).b(false); com.fyber.inneractive.sdk.network.q qVar3 = com.fyber.inneractive.sdk.network.q.MRAID_VIDEO_HAS_NOT_STARTED_PLAYING_IN_A_TIMELY_FASHION; InneractiveAdRequest inneractiveAdRequest2 = this.r; com.fyber.inneractive.sdk.flow.q qVar4 = this.s; com.fyber.inneractive.sdk.response.e d = qVar4 == null ? null : qVar4.d(); com.fyber.inneractive.sdk.flow.q qVar5 = this.s; new s.a(qVar3, inneractiveAdRequest2, d, qVar5 == null ? null : qVar5.c.c()).a("video_timeout_in_msecs", String.valueOf(5000)).a((String) null); } L l2 = this.g; if (l2 != 0) { ((j.f) l2).a(new MraidVideoFailedToDisplayError()); } } else if (str.toLowerCase().endsWith("fyMraidVideoAdCompleted".toLowerCase())) { L l3 = this.g; if (l3 instanceof j.k) { ((j.k) l3).b(); } } return true; } return super.a(webView, str); } @Override // com.fyber.inneractive.sdk.web.j, com.fyber.inneractive.sdk.web.f, com.fyber.inneractive.sdk.web.h.b public final void a(boolean z) { h hVar; super.a(z); if (this.D && this.C && this.A && (hVar = this.b) != null) { StringBuilder sb = new StringBuilder("FyberMraidVideoController."); sb.append(z ? "play" : CampaignEx.JSON_NATIVE_VIDEO_PAUSE); sb.append("();"); hVar.a(sb.toString()); } if (this.b == null || !z) { return; } Handler handler = com.fyber.inneractive.sdk.util.p.b; handler.postDelayed(new e(this), 1L); handler.postDelayed(new e(this), 100L); handler.postDelayed(new e(this), 250L); handler.postDelayed(new e(this), 1000L); } }