package com.vungle.ads.internal.load; import com.vungle.ads.AnalyticsClient; import com.vungle.ads.MraidJsError; import com.vungle.ads.internal.downloader.AssetDownloadListener; import com.vungle.ads.internal.downloader.DownloadRequest; import com.vungle.ads.internal.executor.VungleThreadPoolExecutor; import com.vungle.ads.internal.util.FileUtility; import com.vungle.ads.internal.util.Logger; import java.io.File; import kotlin.jvm.internal.Intrinsics; /* loaded from: classes4.dex */ public final class MraidJsLoader$downloadJs$1$2 implements AssetDownloadListener { final /* synthetic */ VungleThreadPoolExecutor $executor; final /* synthetic */ File $jsPath; final /* synthetic */ File $mraidJsFile; public MraidJsLoader$downloadJs$1$2(VungleThreadPoolExecutor vungleThreadPoolExecutor, File file, File file2) { this.$executor = vungleThreadPoolExecutor; this.$jsPath = file; this.$mraidJsFile = file2; } @Override // com.vungle.ads.internal.downloader.AssetDownloadListener public void onError(final AssetDownloadListener.DownloadError downloadError, final DownloadRequest downloadRequest) { Intrinsics.checkNotNullParameter(downloadRequest, "downloadRequest"); VungleThreadPoolExecutor vungleThreadPoolExecutor = this.$executor; final File file = this.$jsPath; vungleThreadPoolExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.MraidJsLoader$downloadJs$1$2$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { MraidJsLoader$downloadJs$1$2.m3901onError$lambda0(AssetDownloadListener.DownloadError.this, downloadRequest, file); } }); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: onError$lambda-0, reason: not valid java name */ public static final void m3901onError$lambda0(AssetDownloadListener.DownloadError downloadError, DownloadRequest downloadRequest, File jsPath) { Intrinsics.checkNotNullParameter(downloadRequest, "$downloadRequest"); Intrinsics.checkNotNullParameter(jsPath, "$jsPath"); try { try { StringBuilder sb = new StringBuilder(); sb.append("download mraid js error: "); sb.append(downloadError != null ? Integer.valueOf(downloadError.getServerCode()) : null); sb.append(". Failed to load asset "); sb.append(downloadRequest.getAsset().getServerPath()); String sb2 = sb.toString(); Logger.Companion.d("MraidJsLoader", sb2); new MraidJsError(sb2).logErrorNoReturnValue$vungle_ads_release(); FileUtility.deleteContents(jsPath); } catch (Exception e) { Logger.Companion.e("MraidJsLoader", "Failed to delete js assets", e); } MraidJsLoader.INSTANCE.notifyListeners(12); } catch (Throwable th) { MraidJsLoader.INSTANCE.notifyListeners(12); throw th; } } @Override // com.vungle.ads.internal.downloader.AssetDownloadListener public void onSuccess(final File file, DownloadRequest downloadRequest) { Intrinsics.checkNotNullParameter(file, "file"); Intrinsics.checkNotNullParameter(downloadRequest, "downloadRequest"); VungleThreadPoolExecutor vungleThreadPoolExecutor = this.$executor; final File file2 = this.$mraidJsFile; final File file3 = this.$jsPath; vungleThreadPoolExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.MraidJsLoader$downloadJs$1$2$$ExternalSyntheticLambda1 @Override // java.lang.Runnable public final void run() { MraidJsLoader$downloadJs$1$2.m3902onSuccess$lambda1(file, file2, file3); } }); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: onSuccess$lambda-1, reason: not valid java name */ public static final void m3902onSuccess$lambda1(File file, File mraidJsFile, File jsPath) { Intrinsics.checkNotNullParameter(file, "$file"); Intrinsics.checkNotNullParameter(mraidJsFile, "$mraidJsFile"); Intrinsics.checkNotNullParameter(jsPath, "$jsPath"); try { if (file.exists() && file.length() > 0) { MraidJsLoader.INSTANCE.notifyListeners(10); } else { AnalyticsClient.INSTANCE.logError$vungle_ads_release(131, "Mraid js downloaded but write failure: " + mraidJsFile.getAbsolutePath(), (r13 & 4) != 0 ? null : null, (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null); FileUtility.deleteContents(jsPath); MraidJsLoader.INSTANCE.notifyListeners(12); } } catch (Exception e) { Logger.Companion.e("MraidJsLoader", "Failed to delete js assets", e); MraidJsLoader.INSTANCE.notifyListeners(12); } } }