package xyz.stream.api;

import android.app.Activity;
import java.util.Date;
import org.drive_hunter.R;
import xyz.stream.api.entity.CheckUpdateEntity;
import xyz.stream.utils.event.UpdateEvent;
import xyz.stream.utils.event.UpdateProgressEvent;
import xyz.stream.view.UiUtils;
import xyz.stream.view.UpdateDialogController;

/* JADX INFO: loaded from: classes3.dex */
public final class y implements g, t5.h {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static volatile y f36032c;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public volatile Object f36033a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Object f36034b;

    public static y d() {
        if (f36032c == null) {
            synchronized (y.class) {
                try {
                    if (f36032c == null) {
                        y yVar = new y();
                        yVar.f36034b = "";
                        f36032c = yVar;
                    }
                } finally {
                }
            }
        }
        return f36032c;
    }

    @Override // xyz.stream.api.g
    public final void a(Object obj) {
    }

    @Override // xyz.stream.api.g
    public final void b(String str) {
        xyz.stream.utils.f.p().x("Update error: " + str);
        fe.d.b().e(new UpdateProgressEvent(0, true));
    }

    public final void c(final Activity activity, final boolean z10, final boolean z11, final boolean z12) {
        this.f36034b = kotlinx.coroutines.flow.h.h("MM-dd-yyyy HH:mm", new Date());
        new Thread(new Runnable() { // from class: xyz.stream.api.v
            @Override // java.lang.Runnable
            public final void run() {
                final boolean z13 = z10;
                final Activity activity2 = activity;
                final boolean z14 = z11;
                final boolean z15 = z12;
                final y yVar = this.f35939a;
                yVar.getClass();
                final CheckUpdateEntity checkUpdateEntityA = z.b().a(z13);
                activity2.runOnUiThread(new Runnable() { // from class: xyz.stream.api.w
                    @Override // java.lang.Runnable
                    public final void run() {
                        y yVar2 = yVar;
                        CheckUpdateEntity checkUpdateEntity = checkUpdateEntityA;
                        boolean z16 = z14;
                        boolean z17 = z15;
                        Activity activity3 = activity2;
                        boolean z18 = z13;
                        if (checkUpdateEntity == null) {
                            if (z18 && ((x) yVar2.f36033a) != null) {
                                UiUtils.showTip(activity3, activity3.getString(R.string.latest_version));
                            }
                            if (((x) yVar2.f36033a) != null) {
                                UiUtils.dismissProgressDialog();
                                return;
                            }
                            return;
                        }
                        if (!z16) {
                            yVar2.getClass();
                        } else if (((x) yVar2.f36033a) != null) {
                            UiUtils.dismissProgressDialog();
                        }
                        fe.d.b().h(new UpdateEvent(true));
                        if (!z17 || activity3.isFinishing() || activity3.isDestroyed()) {
                            return;
                        }
                        boolean z19 = checkUpdateEntity.getForceUpdate() != null && checkUpdateEntity.getForceUpdate().intValue() == 1;
                        String version = checkUpdateEntity.getVersion();
                        String updateContent = checkUpdateEntity.getUpdateContent();
                        x xVar = (x) yVar2.f36033a;
                        if (xVar == null) {
                            return;
                        }
                        com.google.firebase.messaging.i iVar = new com.google.firebase.messaging.i(yVar2, z19, activity3);
                        he.d dVar = (he.d) xVar;
                        if (activity3.isFinishing() || activity3.isDestroyed()) {
                            return;
                        }
                        UpdateDialogController.show(activity3, z19, version, updateContent, new androidx.media3.exoplayer.analytics.g(dVar, iVar, 18));
                    }
                });
            }
        }).start();
    }

    @Override // t5.h
    public final Object get() {
        if (this.f36033a == null) {
            synchronized (this) {
                try {
                    if (this.f36033a == null) {
                        this.f36033a = t5.n.checkNotNull(((t5.h) this.f36034b).get());
                    }
                } finally {
                }
            }
        }
        return this.f36033a;
    }
}
