package com.ironsource; import android.app.Activity; import com.facebook.internal.security.CertificateUtil; import com.ironsource.environment.ContextProvider; import com.ironsource.g7; import com.ironsource.h7; import com.ironsource.mediationsdk.IronSourceSegment; import com.ironsource.mediationsdk.adunit.adapter.internal.listener.AdapterAdInteractionListener; import com.ironsource.mediationsdk.h; import com.ironsource.mediationsdk.logger.IronLog; import com.ironsource.mediationsdk.logger.IronSourceError; import com.ironsource.mediationsdk.model.Placement; import com.ironsource.mediationsdk.utils.ErrorBuilder; import com.ironsource.mediationsdk.utils.IronSourceUtils; import java.util.Iterator; import java.util.List; /* loaded from: classes2.dex */ public abstract class f7, Listener extends AdapterAdInteractionListener> extends h7 implements c2 { public class a extends yp { final /* synthetic */ Activity a; final /* synthetic */ Placement b; public a(Activity activity, Placement placement) { this.a = activity; this.b = placement; } @Override // com.ironsource.yp public void a() { f7.this.b(this.a, this.b); } } public f7(me meVar, le leVar, q0 q0Var, lj ljVar, IronSourceSegment ironSourceSegment) { super(meVar, leVar, q0Var, ljVar, ironSourceSegment); } public f7(q0 q0Var, lj ljVar, IronSourceSegment ironSourceSegment) { super(q0Var, ljVar, ironSourceSegment); } private String a(List list) { StringBuilder sb = new StringBuilder(); for (Smash smash : list) { if (smash.e() != null) { sb.append(smash.c()); sb.append(CertificateUtil.DELIMITER); sb.append(smash.e()); sb.append(","); } } return sb.toString(); } private void a(Activity activity, g7 g7Var, Placement placement) { if (this.o.i().e()) { this.r.a(); } g7Var.a(activity, placement); } private void a(Smash smash, List list) { for (Smash smash2 : list) { if (smash != null && smash2 == smash) { smash.b(true); return; } smash2.b(false); IronLog.INTERNAL.verbose(b(smash2.k() + " - not ready to show")); } } private void a(IronSourceError ironSourceError, g7 g7Var, String str) { this.s.j.a(n(), ironSourceError.getErrorCode(), ironSourceError.getErrorMessage(), str); this.q.g(); this.t.a(ironSourceError, g7Var != null ? g7Var.f() : null); if (this.o.i().e()) { b(false); } } private void a(IronSourceError ironSourceError, String str) { a(ironSourceError, (g7) null, str); } /* JADX INFO: Access modifiers changed from: private */ /* JADX WARN: Multi-variable type inference failed */ public void b(Activity activity, Placement placement) { g7 g7Var; IronSourceError ironSourceError; String a2; IronLog.INTERNAL.verbose(b("state = " + this.p)); synchronized (this.x) { try { this.i = placement; this.s.j.a(activity, n()); h7.f fVar = this.p; h7.f fVar2 = h7.f.SHOWING; g7Var = null; if (fVar == fVar2) { ironSourceError = new IronSourceError(t1.g(this.o.b()), "can't show ad while an ad is already showing"); } else if (fVar != h7.f.READY_TO_SHOW) { ironSourceError = new IronSourceError(IronSourceError.ERROR_CODE_NO_ADS_TO_SHOW, "show called while no ads are available"); } else if (placement == null) { ironSourceError = new IronSourceError(t1.b(this.o.b()), "empty default placement"); } else if (this.E.b(ContextProvider.getInstance().getApplicationContext(), placement, this.o.b())) { ironSourceError = new IronSourceError(t1.f(this.o.b()), "placement " + placement.getPlacementName() + " is capped"); } else { ironSourceError = null; } if (ironSourceError != null) { IronLog.API.error(b(ironSourceError.getErrorMessage())); a2 = ""; } else { List b = this.a.b(); tu tuVar = new tu(this.o); g7Var = (g7) tuVar.c(b); a((f7) g7Var, (List>) tuVar.b(b)); if (g7Var != null) { a(fVar2); i(g7Var); } else { ironSourceError = ErrorBuilder.buildNoAdsToShowError(this.o.b().toString()); a2 = a(b); } } a(ironSourceError, a2); } catch (Throwable th) { throw th; } } if (g7Var != null) { a(activity, (g7) g7Var, this.i); } } public void a(Activity activity, Placement placement) { if (c()) { a(new a(activity, placement)); } else { b(activity, placement); } } @Override // com.ironsource.c2 public void a(g7 g7Var) { IronLog.INTERNAL.verbose(b(g7Var.k())); if (this.p == h7.f.SHOWING) { a(h7.f.READY_TO_LOAD); } this.q.f(); this.t.a(g7Var.f()); } @Override // com.ironsource.c2 public void a(IronSourceError ironSourceError, g7 g7Var) { IronLog.INTERNAL.verbose(b(g7Var.k() + " - error = " + ironSourceError)); this.b.put(g7Var.c(), h.a.ISAuctionPerformanceFailedToShow); a(h7.f.READY_TO_LOAD); a(ironSourceError, g7Var, ""); } @Override // com.ironsource.c2 public void b(g7 g7Var) { IronLog.INTERNAL.verbose(b(g7Var.k())); this.t.g(g7Var.f()); } @Override // com.ironsource.c2 public void c(g7 g7Var) { IronLog.INTERNAL.verbose(b(g7Var.k())); this.t.a(); } @Override // com.ironsource.c2 public String d() { StringBuilder sb = new StringBuilder(); if (this.p == h7.f.READY_TO_SHOW) { for (g7 g7Var : this.a.b()) { if (g7Var.y()) { sb.append(g7Var.c()); sb.append(";"); } } } return sb.toString(); } @Override // com.ironsource.c2 public void d(g7 g7Var) { IronLog.INTERNAL.verbose(b(g7Var.k())); this.t.b(); } @Override // com.ironsource.h7 public boolean u() { if (!x()) { return false; } if (this.j && !IronSourceUtils.isNetworkConnected(ContextProvider.getInstance().getApplicationContext())) { return false; } Iterator it = this.a.b().iterator(); while (it.hasNext()) { if (((g7) it.next()).B()) { return true; } } return false; } @Override // com.ironsource.h7 public boolean v() { return false; } }