package com.fyber.inneractive.sdk.network; import android.text.TextUtils; import com.fyber.inneractive.sdk.config.IAConfigManager; import com.fyber.inneractive.sdk.external.ImpressionData; import com.fyber.inneractive.sdk.external.InneractiveAdRequest; import com.fyber.inneractive.sdk.external.InneractiveAdSpot; import com.fyber.inneractive.sdk.external.InneractiveAdSpotManager; import com.fyber.inneractive.sdk.external.InneractiveErrorCode; import com.fyber.inneractive.sdk.external.InneractiveInfrastructureError; import com.fyber.inneractive.sdk.factories.b; import com.fyber.inneractive.sdk.flow.k; import com.fyber.inneractive.sdk.util.IAlog; /* loaded from: classes2.dex */ public abstract class k { public a a; public volatile boolean b = false; public final com.fyber.inneractive.sdk.config.global.s c; public final String d; public interface a { } public k(com.fyber.inneractive.sdk.config.global.s sVar, String str, a aVar) { this.a = aVar; this.c = sVar; this.d = str; } public void a() { this.b = true; this.a = null; } public String b() { return null; } public final void a(InneractiveAdRequest inneractiveAdRequest, com.fyber.inneractive.sdk.response.e eVar) { InneractiveErrorCode a2; a aVar; if (this.a == null) { return; } if (this.b) { IAlog.e("IARemoteAdFetcher: ignoring response. Previous request was cancelled", new Object[0]); return; } com.fyber.inneractive.sdk.config.e0 a3 = com.fyber.inneractive.sdk.config.a.a(eVar.m); if (inneractiveAdRequest != null) { inneractiveAdRequest.setSelectedUnitConfig(a3); } com.fyber.inneractive.sdk.config.global.e eVar2 = new com.fyber.inneractive.sdk.config.global.e(); ImpressionData impressionData = eVar.r; eVar2.a = impressionData != null ? impressionData.getDemandId() : null; try { eVar2.b = Long.valueOf(IAConfigManager.L.d); } catch (NumberFormatException unused) { IAlog.a("invalid publisherId", new Object[0]); } this.c.a(eVar2); if (a3 == null) { a2 = InneractiveErrorCode.ERROR_CONFIGURATION_MISMATCH; } else { a2 = eVar.a(inneractiveAdRequest, this.c); } if (a2 == null) { com.fyber.inneractive.sdk.flow.k kVar = (com.fyber.inneractive.sdk.flow.k) this.a; if (kVar.f) { IAlog.e("IAAdSourceBase: load cancelled: ignoring response. Previous load request was cancelled", new Object[0]); return; } com.fyber.inneractive.sdk.config.global.s sVar = kVar.c; IAlog.e("%sonAdDataAvailable: got response data: %s", kVar.d(), eVar); if (eVar.F != com.fyber.inneractive.sdk.ignite.l.NONE && !TextUtils.isEmpty(eVar.y) && !TextUtils.isEmpty(eVar.E) && !TextUtils.isEmpty(eVar.G)) { com.fyber.inneractive.sdk.ignite.c cVar = IAConfigManager.L.D; if (cVar.f) { cVar.a((com.digitalturbine.ignite.authenticator.listeners.internal.b) null); } } com.fyber.inneractive.sdk.response.a a4 = com.fyber.inneractive.sdk.response.a.a(eVar.g); b.InterfaceC0070b interfaceC0070b = b.a.a.a.get(a4); com.fyber.inneractive.sdk.interfaces.a a5 = interfaceC0070b != null ? interfaceC0070b.a() : null; kVar.a = a5; if (a5 == null) { IAlog.f("%sonAdDataAvailable: Cannot find content handler for ad type: %s", kVar.d(), a4); k.a aVar2 = kVar.b; if (aVar2 != null) { ((com.fyber.inneractive.sdk.flow.u) aVar2).a(inneractiveAdRequest, new InneractiveInfrastructureError(InneractiveErrorCode.SDK_INTERNAL_ERROR, com.fyber.inneractive.sdk.flow.g.NO_CONTENT_LOADER_AVAILABLE), eVar); } } else { IAlog.e("%sonAdDataAvailable: found response loader: %s", kVar.d(), kVar.a); } ((com.fyber.inneractive.sdk.flow.h) kVar.a).a(inneractiveAdRequest, eVar, sVar, kVar, kVar); return; } com.fyber.inneractive.sdk.flow.g gVar = com.fyber.inneractive.sdk.flow.g.CONTENT_ERROR_UNSPECIFIED; if (a3 == null || a2 == InneractiveErrorCode.ERROR_CONFIGURATION_MISMATCH) { gVar = com.fyber.inneractive.sdk.flow.g.NO_APP_CONFIG_AVAILABLE; IAlog.b("%sGot configuration mismatch!", IAlog.a(this)); IAConfigManager.a(); } InneractiveInfrastructureError inneractiveInfrastructureError = new InneractiveInfrastructureError(a2, gVar); Exception exc = eVar.x; if (exc != null) { inneractiveInfrastructureError.setCause(exc); } com.fyber.inneractive.sdk.response.a a6 = com.fyber.inneractive.sdk.response.a.a(eVar.g); if (a6 != null) { Exception exc2 = eVar.x; if (exc2 != null) { inneractiveInfrastructureError.setCause(exc2); } com.fyber.inneractive.sdk.util.p.a(new com.fyber.inneractive.sdk.flow.c(new com.fyber.inneractive.sdk.flow.d(eVar, inneractiveAdRequest, a6 == com.fyber.inneractive.sdk.response.a.RETURNED_ADTYPE_HTML ? "send_failed_display_creatives" : "send_failed_vast_creatives", this.c.c()), inneractiveInfrastructureError)); } com.fyber.inneractive.sdk.config.global.s sVar2 = this.c; if (sVar2 == null) { InneractiveAdSpot spot = InneractiveAdSpotManager.get().getSpot(this.d); sVar2 = (spot == null || spot.getAdContent() == null) ? null : spot.getAdContent().c; } com.fyber.inneractive.sdk.flow.a.a(inneractiveAdRequest, inneractiveInfrastructureError, null, eVar, sVar2 != null ? sVar2.c() : null); if (this.b || (aVar = this.a) == null) { return; } ((com.fyber.inneractive.sdk.flow.k) aVar).a(inneractiveAdRequest, inneractiveInfrastructureError, eVar); } }