package com.ironsource;

import com.ironsource.environment.thread.IronSourceThreadManager;
import com.ironsource.mediationsdk.adunit.adapter.utility.AdInfo;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.ironsource.mediationsdk.logger.IronSourceLogger;
import com.ironsource.mediationsdk.logger.IronSourceLoggerManager;
import com.ironsource.mediationsdk.model.Placement;
import com.ironsource.mediationsdk.sdk.LevelPlayRewardedVideoBaseListener;
import com.ironsource.mediationsdk.sdk.LevelPlayRewardedVideoListener;
import com.ironsource.mediationsdk.sdk.LevelPlayRewardedVideoManualListener;
/* loaded from: classes4.dex */
public class yo extends q7 {
    private static final yo d = new yo();
    private LevelPlayRewardedVideoBaseListener b = null;
    private LevelPlayRewardedVideoBaseListener c = null;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public class a implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ boolean f3262a;
        final /* synthetic */ AdInfo b;

        a(boolean z, AdInfo adInfo) {
            this.f3262a = z;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            IronLog ironLog;
            String str;
            if (yo.this.b != null) {
                if (this.f3262a) {
                    ((LevelPlayRewardedVideoListener) yo.this.b).onAdAvailable(yo.this.a(this.b));
                    ironLog = IronLog.CALLBACK;
                    str = "onAdAvailable() adInfo = " + yo.this.a(this.b);
                } else {
                    ((LevelPlayRewardedVideoListener) yo.this.b).onAdUnavailable();
                    ironLog = IronLog.CALLBACK;
                    str = "onAdUnavailable()";
                }
                ironLog.info(str);
            }
        }
    }

    /* loaded from: classes4.dex */
    class b implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ Placement f3263a;
        final /* synthetic */ AdInfo b;

        b(Placement placement, AdInfo adInfo) {
            this.f3263a = placement;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.c != null) {
                yo.this.c.onAdRewarded(this.f3263a, yo.this.a(this.b));
                IronLog.CALLBACK.info("onAdRewarded() placement = " + this.f3263a + ", adInfo = " + yo.this.a(this.b));
            }
        }
    }

    /* loaded from: classes4.dex */
    class c implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ Placement f3264a;
        final /* synthetic */ AdInfo b;

        c(Placement placement, AdInfo adInfo) {
            this.f3264a = placement;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.b != null) {
                yo.this.b.onAdRewarded(this.f3264a, yo.this.a(this.b));
                IronLog.CALLBACK.info("onAdRewarded() placement = " + this.f3264a + ", adInfo = " + yo.this.a(this.b));
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public class d implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ IronSourceError f3265a;
        final /* synthetic */ AdInfo b;

        d(IronSourceError ironSourceError, AdInfo adInfo) {
            this.f3265a = ironSourceError;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.c != null) {
                yo.this.c.onAdShowFailed(this.f3265a, yo.this.a(this.b));
                IronLog.CALLBACK.info("onAdShowFailed() adInfo = " + yo.this.a(this.b) + ", error = " + this.f3265a.getErrorMessage());
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public class e implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ IronSourceError f3266a;
        final /* synthetic */ AdInfo b;

        e(IronSourceError ironSourceError, AdInfo adInfo) {
            this.f3266a = ironSourceError;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.b != null) {
                yo.this.b.onAdShowFailed(this.f3266a, yo.this.a(this.b));
                IronLog.CALLBACK.info("onAdShowFailed() adInfo = " + yo.this.a(this.b) + ", error = " + this.f3266a.getErrorMessage());
            }
        }
    }

    /* loaded from: classes4.dex */
    class f implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ Placement f3267a;
        final /* synthetic */ AdInfo b;

        f(Placement placement, AdInfo adInfo) {
            this.f3267a = placement;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.c != null) {
                yo.this.c.onAdClicked(this.f3267a, yo.this.a(this.b));
                IronLog.CALLBACK.info("onAdClicked() placement = " + this.f3267a + ", adInfo = " + yo.this.a(this.b));
            }
        }
    }

    /* loaded from: classes4.dex */
    class g implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ Placement f3268a;
        final /* synthetic */ AdInfo b;

        g(Placement placement, AdInfo adInfo) {
            this.f3268a = placement;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.b != null) {
                yo.this.b.onAdClicked(this.f3268a, yo.this.a(this.b));
                IronLog.CALLBACK.info("onAdClicked() placement = " + this.f3268a + ", adInfo = " + yo.this.a(this.b));
            }
        }
    }

    /* loaded from: classes4.dex */
    class h implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ AdInfo f3269a;

        h(AdInfo adInfo) {
            this.f3269a = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.c != null) {
                ((LevelPlayRewardedVideoManualListener) yo.this.c).onAdReady(yo.this.a(this.f3269a));
                IronLog.CALLBACK.info("onAdReady() adInfo = " + yo.this.a(this.f3269a));
            }
        }
    }

    /* loaded from: classes4.dex */
    class i implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ AdInfo f3270a;

        i(AdInfo adInfo) {
            this.f3270a = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.b != null) {
                ((LevelPlayRewardedVideoManualListener) yo.this.b).onAdReady(yo.this.a(this.f3270a));
                IronLog.CALLBACK.info("onAdReady() adInfo = " + yo.this.a(this.f3270a));
            }
        }
    }

    /* loaded from: classes4.dex */
    class j implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ IronSourceError f3271a;

        j(IronSourceError ironSourceError) {
            this.f3271a = ironSourceError;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.c != null) {
                ((LevelPlayRewardedVideoManualListener) yo.this.c).onAdLoadFailed(this.f3271a);
                IronLog.CALLBACK.info("onAdLoadFailed() error = " + this.f3271a.getErrorMessage());
            }
        }
    }

    /* loaded from: classes4.dex */
    class k implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ IronSourceError f3272a;

        k(IronSourceError ironSourceError) {
            this.f3272a = ironSourceError;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.b != null) {
                ((LevelPlayRewardedVideoManualListener) yo.this.b).onAdLoadFailed(this.f3272a);
                IronLog.CALLBACK.info("onAdLoadFailed() error = " + this.f3272a.getErrorMessage());
            }
        }
    }

    /* loaded from: classes4.dex */
    class l implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ AdInfo f3273a;

        l(AdInfo adInfo) {
            this.f3273a = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.c != null) {
                yo.this.c.onAdOpened(yo.this.a(this.f3273a));
                IronLog.CALLBACK.info("onAdOpened() adInfo = " + yo.this.a(this.f3273a));
            }
        }
    }

    /* loaded from: classes4.dex */
    class m implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ AdInfo f3274a;

        m(AdInfo adInfo) {
            this.f3274a = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.b != null) {
                yo.this.b.onAdOpened(yo.this.a(this.f3274a));
                IronLog.CALLBACK.info("onAdOpened() adInfo = " + yo.this.a(this.f3274a));
            }
        }
    }

    /* loaded from: classes4.dex */
    class n implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ AdInfo f3275a;

        n(AdInfo adInfo) {
            this.f3275a = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.c != null) {
                yo.this.c.onAdClosed(yo.this.a(this.f3275a));
                IronLog.CALLBACK.info("onAdClosed() adInfo = " + yo.this.a(this.f3275a));
            }
        }
    }

    /* loaded from: classes4.dex */
    class o implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ AdInfo f3276a;

        o(AdInfo adInfo) {
            this.f3276a = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            if (yo.this.b != null) {
                yo.this.b.onAdClosed(yo.this.a(this.f3276a));
                IronLog.CALLBACK.info("onAdClosed() adInfo = " + yo.this.a(this.f3276a));
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public class p implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ boolean f3277a;
        final /* synthetic */ AdInfo b;

        p(boolean z, AdInfo adInfo) {
            this.f3277a = z;
            this.b = adInfo;
        }

        @Override // java.lang.Runnable
        public void run() {
            IronLog ironLog;
            String str;
            if (yo.this.c != null) {
                if (this.f3277a) {
                    ((LevelPlayRewardedVideoListener) yo.this.c).onAdAvailable(yo.this.a(this.b));
                    ironLog = IronLog.CALLBACK;
                    str = "onAdAvailable() adInfo = " + yo.this.a(this.b);
                } else {
                    ((LevelPlayRewardedVideoListener) yo.this.c).onAdUnavailable();
                    ironLog = IronLog.CALLBACK;
                    str = "onAdUnavailable()";
                }
                ironLog.info(str);
            }
        }
    }

    private yo() {
    }

    public static yo a() {
        return d;
    }

    private void a(String str) {
        IronSourceLoggerManager.getLogger().log(IronSourceLogger.IronSourceTag.CALLBACK, str, 1);
    }

    public void a(IronSourceError ironSourceError) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new j(ironSourceError));
            return;
        }
        LevelPlayRewardedVideoBaseListener levelPlayRewardedVideoBaseListener = this.b;
        if (levelPlayRewardedVideoBaseListener == null || !(levelPlayRewardedVideoBaseListener instanceof LevelPlayRewardedVideoManualListener)) {
            return;
        }
        IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new k(ironSourceError));
    }

    public void a(IronSourceError ironSourceError, AdInfo adInfo) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new d(ironSourceError, adInfo));
        } else if (this.b != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new e(ironSourceError, adInfo));
        }
    }

    public void a(Placement placement, AdInfo adInfo) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new f(placement, adInfo));
        } else if (this.b != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new g(placement, adInfo));
        }
    }

    public void a(LevelPlayRewardedVideoBaseListener levelPlayRewardedVideoBaseListener) {
        this.b = levelPlayRewardedVideoBaseListener;
    }

    public void a(boolean z, AdInfo adInfo) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new p(z, adInfo));
            return;
        }
        LevelPlayRewardedVideoBaseListener levelPlayRewardedVideoBaseListener = this.b;
        if (levelPlayRewardedVideoBaseListener == null || !(levelPlayRewardedVideoBaseListener instanceof LevelPlayRewardedVideoListener)) {
            return;
        }
        IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new a(z, adInfo));
    }

    public void b() {
    }

    public void b(AdInfo adInfo) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new n(adInfo));
        } else if (this.b != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new o(adInfo));
        }
    }

    public void b(Placement placement, AdInfo adInfo) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new b(placement, adInfo));
        } else if (this.b != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new c(placement, adInfo));
        }
    }

    public void b(LevelPlayRewardedVideoBaseListener levelPlayRewardedVideoBaseListener) {
        this.c = levelPlayRewardedVideoBaseListener;
    }

    public void c() {
    }

    public void c(AdInfo adInfo) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new l(adInfo));
        } else if (this.b != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new m(adInfo));
        }
    }

    public void d(AdInfo adInfo) {
        if (this.c != null) {
            IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new h(adInfo));
            return;
        }
        LevelPlayRewardedVideoBaseListener levelPlayRewardedVideoBaseListener = this.b;
        if (levelPlayRewardedVideoBaseListener == null || !(levelPlayRewardedVideoBaseListener instanceof LevelPlayRewardedVideoManualListener)) {
            return;
        }
        IronSourceThreadManager.INSTANCE.postOnUiThreadTask(new i(adInfo));
    }
}
