package com.vungle.ads.internal.presenter; import android.content.Context; import android.view.MotionEvent; import android.webkit.WebView; import android.webkit.WebViewRenderProcess; import androidx.annotation.VisibleForTesting; import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode; import com.vungle.ads.AdConfig; import com.vungle.ads.AdNotLoadedCantPlay; import com.vungle.ads.AnalyticsClient; import com.vungle.ads.InternalError; import com.vungle.ads.ServiceLocator; import com.vungle.ads.SingleValueMetric; import com.vungle.ads.VungleError; import com.vungle.ads.internal.ClickCoordinateTracker; import com.vungle.ads.internal.ConfigManager; import com.vungle.ads.internal.Constants; import com.vungle.ads.internal.executor.Executors; import com.vungle.ads.internal.model.AdPayload; import com.vungle.ads.internal.model.BidPayload; import com.vungle.ads.internal.model.CommonRequestBody; import com.vungle.ads.internal.model.Placement; import com.vungle.ads.internal.network.Call; import com.vungle.ads.internal.network.Callback; import com.vungle.ads.internal.network.Response; import com.vungle.ads.internal.network.TpatSender; import com.vungle.ads.internal.network.VungleApiClient; import com.vungle.ads.internal.omsdk.OMTracker; import com.vungle.ads.internal.platform.Platform; import com.vungle.ads.internal.privacy.PrivacyManager; import com.vungle.ads.internal.protos.Sdk; import com.vungle.ads.internal.signals.SignalManager; import com.vungle.ads.internal.ui.VungleWebClient; import com.vungle.ads.internal.ui.view.MRAIDAdWidget; import com.vungle.ads.internal.ui.view.WebViewAPI; import com.vungle.ads.internal.util.HandlerScheduler; import com.vungle.ads.internal.util.Logger; import com.vungle.ads.internal.util.PathProvider; import com.vungle.ads.internal.util.SuspendableTimer; import java.io.File; import java.util.List; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; import kotlin.Lazy; import kotlin.LazyKt__LazyJVMKt; import kotlin.LazyThreadSafetyMode; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* loaded from: classes4.dex */ public final class MRAIDPresenter implements WebViewAPI.MraidDelegate, WebViewAPI.WebClientErrorHandler { private static final String ACTION = "action"; public static final String ACTION_WITH_VALUE = "actionWithValue"; public static final String CLOSE = "close"; public static final String CONSENT_ACTION = "consentAction"; public static final String CREATIVE_HEARTBEAT = "creativeHeartbeat"; public static final Companion Companion = new Companion(null); public static final String ERROR = "error"; public static final String GET_AVAILABLE_DISK_SPACE = "getAvailableDiskSpace"; private static final double HEARTBEAT_INTERVAL = 6.0d; public static final String OPEN = "open"; private static final String OPEN_NON_MRAID = "openNonMraid"; public static final String OPEN_PRIVACY = "openPrivacy"; public static final String SET_ORIENTATION_PROPERTIES = "setOrientationProperties"; public static final String SUCCESSFUL_VIEW = "successfulView"; private static final String TAG = "MRAIDPresenter"; public static final String TPAT = "tpat"; public static final String UPDATE_SIGNALS = "updateSignals"; private static final String USE_CUSTOM_CLOSE = "useCustomClose"; private static final String USE_CUSTOM_PRIVACY = "useCustomPrivacy"; public static final String VIDEO_LENGTH = "videoLength"; public static final String VIDEO_VIEWED = "videoViewed"; private Long adStartTime; private boolean adViewed; private final MRAIDAdWidget adWidget; private final AdPayload advertisement; private boolean backEnabled; private final BidPayload bidPayload; private AdEventListener bus; private final Lazy clickCoordinateTracker$delegate; private Executor executor; private final Lazy executors$delegate; private boolean heartbeatEnabled; private final AtomicBoolean isDestroying; private final OMTracker omTracker; private final Lazy pathProvider$delegate; private final Placement placement; private final Platform platform; private PresenterDelegate presenterDelegate; private final Lazy scheduler$delegate; private final AtomicBoolean sendReportIncentivized; private final Lazy signalManager$delegate; private final Lazy suspendableTimer$delegate; private String userId; private final Lazy vungleApiClient$delegate; private final VungleWebClient vungleWebClient; @VisibleForTesting public static /* synthetic */ void getAdStartTime$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getBackEnabled$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getBus$annotations() { } @VisibleForTesting public static /* synthetic */ void getClickCoordinateTracker$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getHeartbeatEnabled$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getSuspendableTimer$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getUserId$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getVungleApiClient$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void isDestroying$vungle_ads_release$annotations() { } public final Long getAdStartTime$vungle_ads_release() { return this.adStartTime; } public final boolean getBackEnabled$vungle_ads_release() { return this.backEnabled; } public final AdEventListener getBus() { return this.bus; } public final boolean getHeartbeatEnabled$vungle_ads_release() { return this.heartbeatEnabled; } public final String getUserId$vungle_ads_release() { return this.userId; } public final AtomicBoolean isDestroying$vungle_ads_release() { return this.isDestroying; } public final void setAdStartTime$vungle_ads_release(Long l) { this.adStartTime = l; } public final void setBackEnabled$vungle_ads_release(boolean z) { this.backEnabled = z; } public final void setBus(AdEventListener adEventListener) { this.bus = adEventListener; } public final void setEventListener(AdEventListener adEventListener) { this.bus = adEventListener; } public final void setHeartbeatEnabled$vungle_ads_release(boolean z) { this.heartbeatEnabled = z; } public final void setPresenterDelegate$vungle_ads_release(PresenterDelegate presenterDelegate) { this.presenterDelegate = presenterDelegate; } public final void setUserId$vungle_ads_release(String str) { this.userId = str; } public MRAIDPresenter(MRAIDAdWidget adWidget, AdPayload advertisement, Placement placement, VungleWebClient vungleWebClient, Executor executor, OMTracker omTracker, BidPayload bidPayload, Platform platform) { Lazy lazy; Lazy lazy2; Lazy lazy3; Lazy lazy4; Lazy lazy5; Lazy lazy6; Lazy lazy7; Intrinsics.checkNotNullParameter(adWidget, "adWidget"); Intrinsics.checkNotNullParameter(advertisement, "advertisement"); Intrinsics.checkNotNullParameter(placement, "placement"); Intrinsics.checkNotNullParameter(vungleWebClient, "vungleWebClient"); Intrinsics.checkNotNullParameter(executor, "executor"); Intrinsics.checkNotNullParameter(omTracker, "omTracker"); Intrinsics.checkNotNullParameter(platform, "platform"); this.adWidget = adWidget; this.advertisement = advertisement; this.placement = placement; this.vungleWebClient = vungleWebClient; this.executor = executor; this.omTracker = omTracker; this.bidPayload = bidPayload; this.platform = platform; this.isDestroying = new AtomicBoolean(false); this.sendReportIncentivized = new AtomicBoolean(false); ServiceLocator.Companion companion = ServiceLocator.Companion; final Context context = adWidget.getContext(); Intrinsics.checkNotNullExpressionValue(context, "adWidget.context"); LazyThreadSafetyMode lazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED; lazy = LazyKt__LazyJVMKt.lazy(lazyThreadSafetyMode, new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$special$$inlined$inject$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } /* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.network.VungleApiClient, java.lang.Object] */ @Override // kotlin.jvm.functions.Function0 public final VungleApiClient invoke() { return ServiceLocator.Companion.getInstance(context).getService(VungleApiClient.class); } }); this.vungleApiClient$delegate = lazy; final Context context2 = adWidget.getContext(); Intrinsics.checkNotNullExpressionValue(context2, "adWidget.context"); lazy2 = LazyKt__LazyJVMKt.lazy(lazyThreadSafetyMode, new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$special$$inlined$inject$2 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } /* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.executor.Executors, java.lang.Object] */ @Override // kotlin.jvm.functions.Function0 public final Executors invoke() { return ServiceLocator.Companion.getInstance(context2).getService(Executors.class); } }); this.executors$delegate = lazy2; final Context context3 = adWidget.getContext(); Intrinsics.checkNotNullExpressionValue(context3, "adWidget.context"); lazy3 = LazyKt__LazyJVMKt.lazy(lazyThreadSafetyMode, new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$special$$inlined$inject$3 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } /* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.util.PathProvider, java.lang.Object] */ @Override // kotlin.jvm.functions.Function0 public final PathProvider invoke() { return ServiceLocator.Companion.getInstance(context3).getService(PathProvider.class); } }); this.pathProvider$delegate = lazy3; final Context context4 = adWidget.getContext(); Intrinsics.checkNotNullExpressionValue(context4, "adWidget.context"); lazy4 = LazyKt__LazyJVMKt.lazy(lazyThreadSafetyMode, new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$special$$inlined$inject$4 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } /* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.signals.SignalManager, java.lang.Object] */ @Override // kotlin.jvm.functions.Function0 public final SignalManager invoke() { return ServiceLocator.Companion.getInstance(context4).getService(SignalManager.class); } }); this.signalManager$delegate = lazy4; lazy5 = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$scheduler$2 @Override // kotlin.jvm.functions.Function0 public final HandlerScheduler invoke() { return new HandlerScheduler(); } }); this.scheduler$delegate = lazy5; lazy6 = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$suspendableTimer$2 { super(0); } @Override // kotlin.jvm.functions.Function0 public final SuspendableTimer invoke() { final MRAIDPresenter mRAIDPresenter = MRAIDPresenter.this; return new SuspendableTimer(6.0d, true, null, new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$suspendableTimer$2.1 { super(0); } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Object invoke() { m3962invoke(); return Unit.INSTANCE; } /* renamed from: invoke, reason: collision with other method in class */ public final void m3962invoke() { Placement placement2; AdPayload adPayload; AdPayload adPayload2; AnalyticsClient analyticsClient = AnalyticsClient.INSTANCE; placement2 = MRAIDPresenter.this.placement; String referenceId = placement2.getReferenceId(); adPayload = MRAIDPresenter.this.advertisement; String creativeId = adPayload.getCreativeId(); adPayload2 = MRAIDPresenter.this.advertisement; analyticsClient.logError$vungle_ads_release(318, "Error ad template missing Heartbeat", referenceId, creativeId, adPayload2.eventId()); MRAIDPresenter.this.reportErrorAndCloseAd(new InternalError(VungleError.HEARTBEAT_ERROR, null, 2, null)); } }, 4, null); } }); this.suspendableTimer$delegate = lazy6; lazy7 = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$clickCoordinateTracker$2 { super(0); } @Override // kotlin.jvm.functions.Function0 public final ClickCoordinateTracker invoke() { MRAIDAdWidget mRAIDAdWidget; AdPayload adPayload; Executor executor2; mRAIDAdWidget = MRAIDPresenter.this.adWidget; Context context5 = mRAIDAdWidget.getContext(); Intrinsics.checkNotNullExpressionValue(context5, "adWidget.context"); adPayload = MRAIDPresenter.this.advertisement; executor2 = MRAIDPresenter.this.executor; return new ClickCoordinateTracker(context5, adPayload, executor2); } }); this.clickCoordinateTracker$delegate = lazy7; } public final VungleApiClient getVungleApiClient$vungle_ads_release() { return (VungleApiClient) this.vungleApiClient$delegate.getValue(); } /* JADX INFO: Access modifiers changed from: private */ public final Executors getExecutors() { return (Executors) this.executors$delegate.getValue(); } /* JADX INFO: Access modifiers changed from: private */ public final PathProvider getPathProvider() { return (PathProvider) this.pathProvider$delegate.getValue(); } /* JADX INFO: Access modifiers changed from: private */ public final SignalManager getSignalManager() { return (SignalManager) this.signalManager$delegate.getValue(); } private final HandlerScheduler getScheduler() { return (HandlerScheduler) this.scheduler$delegate.getValue(); } public final SuspendableTimer getSuspendableTimer$vungle_ads_release() { return (SuspendableTimer) this.suspendableTimer$delegate.getValue(); } public final ClickCoordinateTracker getClickCoordinateTracker$vungle_ads_release() { return (ClickCoordinateTracker) this.clickCoordinateTracker$delegate.getValue(); } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } @VisibleForTesting public static /* synthetic */ void getACTION_WITH_VALUE$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getCLOSE$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getCONSENT_ACTION$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getCREATIVE_HEARTBEAT$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getERROR$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getGET_AVAILABLE_DISK_SPACE$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getOPEN$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getOPEN_PRIVACY$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getSET_ORIENTATION_PROPERTIES$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getSUCCESSFUL_VIEW$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getTPAT$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getUPDATE_SIGNALS$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getVIDEO_LENGTH$vungle_ads_release$annotations() { } @VisibleForTesting public static /* synthetic */ void getVIDEO_VIEWED$vungle_ads_release$annotations() { } private Companion() { } } public final void onViewConfigurationChanged() { this.vungleWebClient.notifyPropertiesChange(true); } public final void start() { Logger.Companion.d(TAG, "start()"); this.adWidget.resumeWeb(); setAdVisibility(true); if (this.advertisement.adLoadOptimizationEnabled()) { recordPlayAssetMetric(); } } public final void stop() { Logger.Companion.d(TAG, "stop()"); this.adWidget.pauseWeb(); setAdVisibility(false); } public final void detach(@MRAIDAdWidget.AdStopReason int i) { AdEventListener adEventListener; Logger.Companion.d(TAG, "detach()"); boolean z = (i & 1) != 0; boolean z2 = (i & 2) != 0; this.vungleWebClient.setWebViewObserver(null); this.vungleWebClient.setMraidDelegate(null); if (!z && z2 && !this.isDestroying.getAndSet(true) && (adEventListener = this.bus) != null) { adEventListener.onNext(TtmlNode.END, null, this.placement.getReferenceId()); } this.adWidget.destroyWebView(this.omTracker.stop()); if (this.heartbeatEnabled) { getSuspendableTimer$vungle_ads_release().cancel(); } } public final void setAdVisibility(boolean z) { this.vungleWebClient.setAdVisibility(z); } public final void onViewTouched(MotionEvent motionEvent) { if (motionEvent != null) { getClickCoordinateTracker$vungle_ads_release().trackCoordinate(motionEvent); } } private final void closeView() { Long l = this.adStartTime; if (l != null) { long currentTimeMillis = System.currentTimeMillis() - l.longValue(); TpatSender tpatSender = new TpatSender(getVungleApiClient$vungle_ads_release(), this.placement.getReferenceId(), this.advertisement.getCreativeId(), this.advertisement.eventId(), getExecutors().getIoExecutor(), getPathProvider(), getSignalManager()); List tpatUrls = this.advertisement.getTpatUrls(Constants.AD_CLOSE_TPAT_KEY, String.valueOf(currentTimeMillis), String.valueOf(this.platform.getVolumeLevel())); if (tpatUrls != null) { tpatSender.sendTpats(tpatUrls, this.executor); } } this.adWidget.close(); } public final void handleExit() { if (this.backEnabled) { this.adWidget.showWebsite("javascript:window.vungle.mraidBridgeExt.requestMRAIDClose()"); } } /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARN: Code restructure failed: missing block: B:70:0x01fe, code lost: if (r21.equals(com.vungle.ads.internal.presenter.MRAIDPresenter.OPEN) == false) goto L175; */ /* JADX WARN: Code restructure failed: missing block: B:71:0x0217, code lost: r1 = r20.advertisement.adUnit(); */ /* JADX WARN: Code restructure failed: missing block: B:72:0x021d, code lost: if (r1 == null) goto L93; */ /* JADX WARN: Code restructure failed: missing block: B:73:0x021f, code lost: r10 = r1.getDeeplinkUrl(); */ /* JADX WARN: Code restructure failed: missing block: B:74:0x0223, code lost: r1 = com.vungle.ads.internal.util.JsonUtil.INSTANCE.getContentStringValue(r22, "url"); */ /* JADX WARN: Code restructure failed: missing block: B:75:0x0229, code lost: if (r10 == null) goto L97; */ /* JADX WARN: Code restructure failed: missing block: B:77:0x022f, code lost: if (r10.length() != 0) goto L101; */ /* JADX WARN: Code restructure failed: missing block: B:78:0x023a, code lost: r2 = r20.adWidget.getContext(); kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r2, "adWidget.context"); com.vungle.ads.internal.util.ExternalRouter.launch(r10, r1, r2, new com.vungle.ads.internal.ui.PresenterAppLeftCallback(r20.bus, r20.placement.getReferenceId()), new com.vungle.ads.internal.presenter.MRAIDPresenter$processCommand$6(r20)); */ /* JADX WARN: Code restructure failed: missing block: B:79:0x0260, code lost: r1 = r20.bus; */ /* JADX WARN: Code restructure failed: missing block: B:80:0x0262, code lost: if (r1 == null) goto L106; */ /* JADX WARN: Code restructure failed: missing block: B:81:0x0264, code lost: r1.onNext(com.vungle.ads.internal.presenter.MRAIDPresenter.OPEN, "adClick", r20.placement.getReferenceId()); */ /* JADX WARN: Code restructure failed: missing block: B:83:0x0231, code lost: if (r1 == null) goto L102; */ /* JADX WARN: Code restructure failed: missing block: B:85:0x0237, code lost: if (r1.length() != 0) goto L101; */ /* JADX WARN: Code restructure failed: missing block: B:86:0x0259, code lost: com.vungle.ads.internal.util.Logger.Companion.e(com.vungle.ads.internal.presenter.MRAIDPresenter.TAG, "CTA destination URL is not configured properly"); */ /* JADX WARN: Code restructure failed: missing block: B:91:0x0213, code lost: if (r21.equals(com.vungle.ads.internal.presenter.MRAIDPresenter.OPEN_NON_MRAID) == false) goto L175; */ /* JADX WARN: Removed duplicated region for block: B:132:0x034f */ /* JADX WARN: Removed duplicated region for block: B:135:0x035e */ @Override // com.vungle.ads.internal.ui.view.WebViewAPI.MraidDelegate /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public boolean processCommand(java.lang.String r21, kotlinx.serialization.json.JsonObject r22) { /* Method dump skipped, instructions count: 1158 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.vungle.ads.internal.presenter.MRAIDPresenter.processCommand(java.lang.String, kotlinx.serialization.json.JsonObject):boolean"); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: processCommand$lambda-3, reason: not valid java name */ public static final void m3958processCommand$lambda3(MRAIDPresenter this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.closeView(); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: processCommand$lambda-6, reason: not valid java name */ public static final void m3959processCommand$lambda6(MRAIDPresenter this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.vungleWebClient.notifyPropertiesChange(true); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: processCommand$lambda-7, reason: not valid java name */ public static final void m3960processCommand$lambda7(MRAIDPresenter this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.adWidget.setVisibility(0); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: processCommand$lambda-9, reason: not valid java name */ public static final void m3961processCommand$lambda9(MRAIDPresenter this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); String referenceId = this$0.placement.getReferenceId(); Call ri = this$0.getVungleApiClient$vungle_ads_release().ri(new CommonRequestBody.RequestParam((List) null, (CommonRequestBody.AdSizeParam) null, this$0.adStartTime, this$0.advertisement.advAppId(), referenceId, this$0.userId, 3, (DefaultConstructorMarker) null)); if (ri == null) { Logger.Companion.e(TAG, "Invalid ri call."); } else { ri.enqueue(new Callback() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$processCommand$7$1 @Override // com.vungle.ads.internal.network.Callback public void onResponse(Call call, Response response) { Logger.Companion.d("MRAIDPresenter", "send RI success"); } @Override // com.vungle.ads.internal.network.Callback public void onFailure(Call call, Throwable th) { Logger.Companion.d("MRAIDPresenter", "send RI Failure"); } }); } } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: processCommand$lambda-10, reason: not valid java name */ public static final void m3955processCommand$lambda10(MRAIDPresenter this$0, boolean z, String str, String str2) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.handleWebViewException(new InternalError(VungleError.CREATIVE_ERROR, null, 2, null), z, str + " : " + str2); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: processCommand$lambda-11, reason: not valid java name */ public static final void m3956processCommand$lambda11(MRAIDPresenter this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.getSuspendableTimer$vungle_ads_release().reset(); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: processCommand$lambda-12, reason: not valid java name */ public static final void m3957processCommand$lambda12(MRAIDPresenter this$0, long j) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.vungleWebClient.notifyDiskAvailableSize(j); } private final void makeBusError(VungleError vungleError) { AdEventListener adEventListener = this.bus; if (adEventListener != null) { adEventListener.onError(vungleError, this.placement.getReferenceId()); } } /* JADX INFO: Access modifiers changed from: private */ public final void reportErrorAndCloseAd(VungleError vungleError) { makeBusError(vungleError); closeView(); } @Override // com.vungle.ads.internal.ui.view.WebViewAPI.WebClientErrorHandler public void onReceivedError(String errorDesc, boolean z) { Intrinsics.checkNotNullParameter(errorDesc, "errorDesc"); if (z) { reportErrorAndCloseAd(new InternalError(VungleError.AD_RENDER_NETWORK_ERROR, null, 2, null)); } } @Override // com.vungle.ads.internal.ui.view.WebViewAPI.WebClientErrorHandler public boolean onWebRenderingProcessGone(WebView webView, Boolean bool) { handleWebViewException$default(this, new InternalError(VungleError.WEB_CRASH, null, 2, null), true, null, 4, null); return true; } @Override // com.vungle.ads.internal.ui.view.WebViewAPI.WebClientErrorHandler public void onRenderProcessUnresponsive(WebView webView, WebViewRenderProcess webViewRenderProcess) { handleWebViewException$default(this, new InternalError(VungleError.WEBVIEW_RENDER_UNRESPONSIVE, null, 2, null), true, null, 4, null); } public static /* synthetic */ void handleWebViewException$default(MRAIDPresenter mRAIDPresenter, VungleError vungleError, boolean z, String str, int i, Object obj) { if ((i & 4) != 0) { str = null; } mRAIDPresenter.handleWebViewException(vungleError, z, str); } private final void handleWebViewException(VungleError vungleError, boolean z, String str) { Logger.Companion.e(TAG, "handleWebViewException: " + vungleError.getLocalizedMessage() + ", fatal: " + z + ", errorMsg: " + str); if (z) { makeBusError(vungleError); closeView(); } } private final boolean loadMraid(File file) { File file2 = new File(file.getPath(), Constants.AD_INDEX_FILE_NAME); if (!file2.exists()) { AnalyticsClient.INSTANCE.logError$vungle_ads_release(310, "Fail to load html " + file2.getPath(), this.placement.getReferenceId(), this.advertisement.getCreativeId(), this.advertisement.eventId()); return false; } this.adWidget.showWebsite(AdPayload.FILE_SCHEME + file2.getPath()); return true; } public final void prepare() { int i; String str; String str2; String str3; String str4; int settings; boolean z = false; this.isDestroying.set(false); this.adWidget.linkWebView(this.vungleWebClient); AdConfig adConfig = this.advertisement.getAdConfig(); if (adConfig != null && (settings = adConfig.getSettings()) > 0) { this.backEnabled = (settings & 2) == 2; } this.heartbeatEnabled = this.advertisement.heartbeatEnabled(); AdConfig adConfig2 = this.advertisement.getAdConfig(); Integer valueOf = adConfig2 != null ? Integer.valueOf(adConfig2.getAdOrientation()) : null; if (valueOf != null && valueOf.intValue() == 0) { i = 7; } else { i = (valueOf != null && valueOf.intValue() == 1) ? 6 : 4; } this.adWidget.setOrientation(i); this.omTracker.start(); this.vungleWebClient.setMraidDelegate(this); this.vungleWebClient.setErrorHandler(this); File assetDirectory = this.advertisement.getAssetDirectory(); if (assetDirectory == null || !assetDirectory.exists()) { reportErrorAndCloseAd(new AdNotLoadedCantPlay()); return; } if (!loadMraid(assetDirectory)) { reportErrorAndCloseAd(new AdNotLoadedCantPlay()); return; } this.adStartTime = Long.valueOf(System.currentTimeMillis()); PresenterDelegate presenterDelegate = this.presenterDelegate; this.userId = presenterDelegate != null ? presenterDelegate.getUserId() : null; PresenterDelegate presenterDelegate2 = this.presenterDelegate; if (presenterDelegate2 == null || (str = presenterDelegate2.getAlertTitleText()) == null) { str = ""; } PresenterDelegate presenterDelegate3 = this.presenterDelegate; if (presenterDelegate3 == null || (str2 = presenterDelegate3.getAlertBodyText()) == null) { str2 = ""; } PresenterDelegate presenterDelegate4 = this.presenterDelegate; if (presenterDelegate4 == null || (str3 = presenterDelegate4.getAlertContinueButtonText()) == null) { str3 = ""; } PresenterDelegate presenterDelegate5 = this.presenterDelegate; if (presenterDelegate5 == null || (str4 = presenterDelegate5.getAlertCloseButtonText()) == null) { str4 = ""; } this.advertisement.setIncentivizedText(str, str2, str3, str4); ConfigManager configManager = ConfigManager.INSTANCE; if (configManager.getGDPRIsCountryDataProtected() && Intrinsics.areEqual("unknown", PrivacyManager.INSTANCE.getConsentStatus())) { z = true; } this.vungleWebClient.setConsentStatus(z, configManager.getGDPRConsentTitle(), configManager.getGDPRConsentMessage(), configManager.getGDPRButtonAccept(), configManager.getGDPRButtonDeny()); if (z) { PrivacyManager.INSTANCE.updateGdprConsent("opted_out_by_timeout", "vungle_modal", ""); } int showCloseDelay = this.advertisement.getShowCloseDelay(Boolean.valueOf(this.placement.isRewardedVideo())); if (showCloseDelay > 0) { getScheduler().schedule(new Runnable() { // from class: com.vungle.ads.internal.presenter.MRAIDPresenter$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { MRAIDPresenter.m3954prepare$lambda14(MRAIDPresenter.this); } }, showCloseDelay); } else { this.backEnabled = true; } AdEventListener adEventListener = this.bus; if (adEventListener != null) { adEventListener.onNext("start", null, this.placement.getReferenceId()); } if (this.heartbeatEnabled) { getSuspendableTimer$vungle_ads_release().start(); } } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: prepare$lambda-14, reason: not valid java name */ public static final void m3954prepare$lambda14(MRAIDPresenter this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.backEnabled = true; } private final void recordPlayAssetMetric() { Sdk.SDKMetric.SDKMetricType sDKMetricType; if (this.advertisement.getAssetsFullyDownloaded()) { sDKMetricType = Sdk.SDKMetric.SDKMetricType.LOCAL_ASSETS_USED; } else { sDKMetricType = Sdk.SDKMetric.SDKMetricType.REMOTE_ASSETS_USED; } AnalyticsClient.INSTANCE.logMetric$vungle_ads_release(new SingleValueMetric(sDKMetricType), (r13 & 2) != 0 ? null : this.placement.getReferenceId(), (r13 & 4) != 0 ? null : this.advertisement.getCreativeId(), (r13 & 8) != 0 ? null : this.advertisement.eventId(), (r13 & 16) != 0 ? null : null); } }