小红书.apk(点击下载) / u3.java


package gl;

import android.os.SystemClock;
import com.igexin.push.core.d.c;
import com.uber.autodispose.a0;
import com.uber.autodispose.d;
import com.uber.autodispose.y;
import com.xingin.alpha.bean.GoodsBean;
import com.xingin.alpha.bean.GoodsInfoBean;
import com.xingin.android.xhscomm.event.Event;
import com.xingin.redview.livefloatwindow.LiveWindowConfig;
import dw2.r;
import kotlin.Metadata;
import kotlin.Triple;
import kotlin.Unit;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import ks.c;
import ln.d2;
import sy.i;
import sy.u;
import sy.v0;

@Metadata(bv = {}, d1 = {"\u0000P\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u00002\u00020\u0001:\u0001&B\u0007¢\u0006\u0004\b$\u0010%J\u001c\u0010\u0007\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\u0010\u0010\n\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\bH\u0016JJ\u0010\u0015\u001a\u00020\u00062\u0006\u0010\f\u001a\u00020\u000b28\u0010\u0014\u001a4\u0012\u0013\u0012\u00110\u000e¢\u0006\f\b\u000f\u0012\b\b\u0010\u0012\u0004\b\b(\u0011\u0012\u0015\u0012\u0013\u0018\u00010\u0012¢\u0006\f\b\u000f\u0012\b\b\u0010\u0012\u0004\b\b(\u0013\u0012\u0004\u0012\u00020\u00060\rH\u0016J \u0010\u001a\u001a\u00020\u00062\u0006\u0010\u0016\u001a\u00020\u000b2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0019\u001a\u00020\u0017H\u0016J\b\u0010\u001b\u001a\u00020\u0006H\u0016J\b\u0010\u001c\u001a\u00020\u0006H\u0016J\b\u0010\u001d\u001a\u00020\u0006H\u0016J\u001a\u0010\u001f\u001a\u0014\u0012\u0004\u0012\u00020\u000b\u0012\u0004\u0012\u00020\u0017\u0012\u0004\u0012\u00020\u00170\u001eH\u0016J\b\u0010 \u001a\u00020\u0006H\u0016J\b\u0010!\u001a\u00020\u0006H\u0002J\u0018\u0010#\u001a\u00020\u00062\u0006\u0010\u0016\u001a\u00020\u000b2\u0006\u0010\"\u001a\u00020\u0017H\u0002¨\u0006'"}, d2 = {"Lgl/u3;", "", "Llw/b;", "livePlayer", "Lgl/v3;", qo2.a.COPY_LINK_TYPE_VIEW, "", "l", "", "roomId", "u", "", "contractId", "Lkotlin/Function2;", "", "Lkotlin/ParameterName;", "name", "hasGoods", "Lcom/xingin/alpha/bean/GoodsBean;", "goodsInfo", "callback", "g", "playbackUrl", "", "startTime", "duration", "r", "t", "q", c.f25536c, "Lkotlin/Triple;", "k", "j", "o", "progress", "s", "<init>", "()V", "a", "alpha_library_release"}, k = 1, mv = {1, 6, 0})
/* compiled from: AlphaPlayBackPresenter.kt */
public final class u3 {

    /* renamed from: n  reason: collision with root package name */
    public static final a f82893n = new a(null);

    /* renamed from: a  reason: collision with root package name */
    public final d2 f82894a = d2.f102239a;

    /* renamed from: b  reason: collision with root package name */
    public ks.c f82895b;

    /* renamed from: c  reason: collision with root package name */
    public int f82896c;

    /* renamed from: d  reason: collision with root package name */
    public int f82897d;

    /* renamed from: e  reason: collision with root package name */
    public String f82898e = "";

    /* renamed from: f  reason: collision with root package name */
    public int f82899f;

    /* renamed from: g  reason: collision with root package name */
    public boolean f82900g;

    /* renamed from: h  reason: collision with root package name */
    public long f82901h;

    /* renamed from: i  reason: collision with root package name */
    public lw.b f82902i;

    /* renamed from: j  reason: collision with root package name */
    public v3 f82903j;

    /* renamed from: k  reason: collision with root package name */
    public final String f82904k;

    /* renamed from: l  reason: collision with root package name */
    public final j30.a f82905l;

    /* renamed from: m  reason: collision with root package name */
    public final j30.a f82906m;

    @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\b†\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0005\u0010\u0006R\u0014\u0010\u0003\u001a\u00020\u00028\u0006X†T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004¨\u0006\u0007"}, d2 = {"Lgl/u3$a;", "", "", "TAG", "Ljava/lang/String;", "<init>", "()V", "alpha_library_release"}, k = 1, mv = {1, 6, 0})
    /* compiled from: AlphaPlayBackPresenter.kt */
    public static final class a {
        public a() {
        }

        public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"gl/u3$b", "Lks/c$b;", "", "second", "", "a", "alpha_library_release"}, k = 1, mv = {1, 6, 0})
    /* compiled from: AlphaPlayBackPresenter.kt */
    public static final class b implements c.b {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ u3 f82907a;

        public b(u3 u3Var) {
            this.f82907a = u3Var;
        }

        @Override // ks.c.b
        public void a(int i10) {
            if (i10 == this.f82907a.f82896c) {
                v3 v3Var = this.f82907a.f82903j;
                if (v3Var != null) {
                    v3Var.C(true);
                }
                v0.f131783a.c("AlphaPlayBackPresenter", null, "seekBack: backToLive");
            }
        }
    }

    public u3() {
        this.f82904k = i.f131651a.y() ? "https://live-explain-goods.xhscdn.com/timeshift/live/" : "http://live-explain-goods.xhscdn.com/timeshift/live/";
        this.f82905l = new s3(this);
        this.f82906m = new t3(this);
    }

    public static final void h(Function2 function2, GoodsInfoBean goodsInfoBean) {
        Intrinsics.checkNotNullParameter(function2, "$callback");
        if (goodsInfoBean != null && goodsInfoBean.getExist()) {
            GoodsBean info = goodsInfoBean.getInfo();
            boolean z14 = true;
            if (info == null || !info.getHasPlayBack()) {
                z14 = false;
            }
            if (z14) {
                function2.invoke(Boolean.TRUE, goodsInfoBean.getInfo());
                return;
            }
        }
        function2.invoke(Boolean.FALSE, null);
    }

    public static final void i(Function2 function2, Throwable th3) {
        Intrinsics.checkNotNullParameter(function2, "$callback");
        function2.invoke(Boolean.FALSE, null);
        v0.f131783a.c("AlphaPlayBackPresenter", null, th3.toString());
    }

    public static final void m(u3 u3Var, Event event) {
        Intrinsics.checkNotNullParameter(u3Var, "this$0");
        if (LiveWindowConfig.INSTANCE.getFloatWindowShowing() && u3Var.f82894a.J()) {
            ks.c cVar = u3Var.f82895b;
            u3Var.f82899f = cVar != null ? cVar.c() : 0;
            v0 v0Var = v0.f131783a;
            v0Var.c("AlphaPlayBackPresenter", null, "onStop: playback: watchedPlayBackTime=" + u3Var.f82899f);
        }
    }

    public static final void n(u3 u3Var, Event event) {
        Intrinsics.checkNotNullParameter(u3Var, "this$0");
        if (!u3Var.f82894a.J()) {
            return;
        }
        if (event.a().getBoolean("pause_player", false)) {
            ks.c cVar = u3Var.f82895b;
            if (cVar != null) {
                cVar.d();
                return;
            }
            return;
        }
        ks.c cVar2 = u3Var.f82895b;
        if (cVar2 != null) {
            cVar2.f();
        }
    }

    public void g(String str, Function2<? super Boolean, ? super GoodsBean, Unit> function2) {
        Intrinsics.checkNotNullParameter(str, "contractId");
        Intrinsics.checkNotNullParameter(function2, "callback");
        r<GoodsInfoBean> W0 = cl.a.f12786a.s().getGoodsInfoById(this.f82894a.z0(), str).x1(mi2.a.P()).W0(gw2.a.a());
        Intrinsics.checkNotNullExpressionValue(W0, "AlphaApiManager.goodsSer…dSchedulers.mainThread())");
        a0 a0Var = a0.D;
        Intrinsics.checkNotNullExpressionValue(a0Var, "UNBOUND");
        Object n14 = W0.n(d.b(a0Var));
        Intrinsics.checkExpressionValueIsNotNull(n14, "this.`as`(AutoDispose.autoDisposable(provider))");
        ((y) n14).a(new q3(function2), new r3(function2));
    }

    public void j() {
        e30.c.i(this.f82906m);
        e30.c.i(this.f82905l);
        this.f82902i = null;
        this.f82903j = null;
        p();
    }

    public Triple<String, Integer, Integer> k() {
        int i10;
        int i14 = 0;
        if (!this.f82894a.J() || this.f82895b == null) {
            i10 = 0;
        } else {
            i14 = this.f82897d;
            i10 = this.f82896c;
        }
        v0 v0Var = v0.f131783a;
        v0Var.c("AlphaPlayBackPresenter", null, "openFloat window: playback: startTime=" + i14 + " duration=" + i10);
        return new Triple<>(this.f82898e, Integer.valueOf(i14), Integer.valueOf(i10));
    }

    public void l(lw.b bVar, v3 v3Var) {
        this.f82902i = bVar;
        this.f82903j = v3Var;
        e30.c.g("com.xingin.alpha.floatwindow.FloatWindowManager.openFloatWindow", this.f82906m);
        e30.c.g("com.xingin.alpha.player.tx.TXLivePlayerWrapper.publishTimerPauseEvent", this.f82905l);
    }

    public final void o() {
        ks.c cVar = this.f82895b;
        if (cVar == null) {
            ks.c c14 = ks.d.f99203a.c();
            this.f82895b = c14;
            if (c14 != null) {
                c14.a(new b(this));
            }
        } else if (cVar != null) {
            cVar.i();
        }
    }

    public void p() {
        ks.c cVar = this.f82895b;
        if (cVar != null) {
            cVar.i();
        }
        this.f82896c = 0;
        this.f82897d = 0;
        this.f82899f = 0;
        this.f82898e = "";
        this.f82900g = false;
    }

    public void q() {
        ks.c cVar;
        v0 v0Var = v0.f131783a;
        StringBuilder sb3 = new StringBuilder();
        sb3.append("onStart: watchedPlayBackTime = ");
        sb3.append(this.f82899f);
        sb3.append(" playBackTimer.current = ");
        ks.c cVar2 = this.f82895b;
        sb3.append(cVar2 != null ? Integer.valueOf(cVar2.c()) : null);
        v0Var.c("AlphaPlayBackPresenter", null, sb3.toString());
        if (this.f82894a.J() && (cVar = this.f82895b) != null) {
            if (cVar != null) {
                cVar.f();
            }
            int i10 = this.f82899f;
            if (i10 != 0) {
                ks.c cVar3 = this.f82895b;
                boolean z14 = false;
                if (cVar3 != null && i10 == cVar3.c()) {
                    z14 = true;
                }
                if (!z14) {
                    ks.c cVar4 = this.f82895b;
                    Intrinsics.checkNotNull(cVar4);
                    if (cVar4.c() < this.f82896c) {
                        String str = this.f82898e;
                        ks.c cVar5 = this.f82895b;
                        Intrinsics.checkNotNull(cVar5);
                        s(str, cVar5.c());
                        StringBuilder sb4 = new StringBuilder();
                        sb4.append("onStart: playback: startTime=");
                        ks.c cVar6 = this.f82895b;
                        Intrinsics.checkNotNull(cVar6);
                        sb4.append(cVar6.c());
                        sb4.append(" duration=");
                        sb4.append(this.f82896c);
                        v0Var.c("AlphaPlayBackPresenter", null, sb4.toString());
                        return;
                    }
                    v3 v3Var = this.f82903j;
                    if (v3Var != null) {
                        v3Var.C(true);
                    }
                }
            }
        }
    }

    public void r(String str, int i10, int i14) {
        Intrinsics.checkNotNullParameter(str, "playbackUrl");
        this.f82897d = i10;
        this.f82896c = i14;
        this.f82900g = false;
        s(str, 0);
        o();
        v0 v0Var = v0.f131783a;
        v0Var.c("AlphaPlayBackPresenter", null, "seekBack: playback: startTime=" + this.f82897d + " duration=" + this.f82896c);
    }

    public final void s(String str, int i10) {
        if (!(str.length() > 0) || !u.f131753a.i0()) {
            lw.b bVar = this.f82902i;
            if (bVar != null) {
                bVar.y(this.f82904k + this.f82901h + "/timeshift.m3u8?delay=" + this.f82897d, this.f82897d, false);
                return;
            }
            return;
        }
        if (Intrinsics.areEqual(this.f82898e, str)) {
            lw.b bVar2 = this.f82902i;
            if (bVar2 != null) {
                bVar2.y(this.f82898e, i10, true);
            }
        } else {
            lw.b bVar3 = this.f82902i;
            if (bVar3 != null) {
                bVar3.y(str, 0, true);
            }
        }
        this.f82898e = str;
    }

    public void t() {
        if (this.f82894a.J() && !this.f82900g) {
            ks.c cVar = this.f82895b;
            if (cVar != null) {
                ks.c.h(cVar, 0, 1, null);
            }
            this.f82900g = true;
            v0 v0Var = v0.f131783a;
            v0Var.c("AlphaPlayBackPresenter", null, "playback: start " + SystemClock.elapsedRealtime());
        }
    }

    public void u(long j14) {
        this.f82901h = j14;
    }
}