导航菜单

页面标题

页面副标题

Bhakti v5.4.0 - PlayerActivity.java 源代码

正在查看: Bhakti v5.4.0 应用的 PlayerActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.vlv.aravali.playerMedia3.ui;

import Am.U;
import B4.v;
import Cn.s;
import Kl.k;
import Kp.V;
import Kp.p;
import Ml.C0;
import Ml.a1;
import Np.F0;
import Qf.h;
import Qn.e;
import Sp.f;
import Vl.A;
import Vl.AbstractC0811h;
import Vl.C;
import Vl.C0803d;
import Vl.C0807f;
import Vl.C0813i;
import Vl.C0815j;
import Vl.C0817k;
import Vl.C0819l;
import Vl.C0823n;
import Vl.C0824n0;
import Vl.C0826o0;
import Vl.C0831r0;
import Vl.C0833s0;
import Vl.C0836u;
import Vl.C0837u0;
import Vl.C0838v;
import Vl.C0839v0;
import Vl.C0841w0;
import Vl.C0843x0;
import Vl.C0844y;
import Vl.F;
import Vl.H;
import Vl.K;
import Vl.N;
import Vl.Q;
import Vl.S;
import Vl.X;
import Vl.Y;
import Vl.r;
import am.C0908c;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController$;
import androidx.datastore.preferences.protobuf.o;
import androidx.lifecycle.B;
import androidx.lifecycle.i0;
import androidx.lifecycle.q0;
import bj.EnumC0912c;
import cj.C1036U;
import cj.C1063x;
import cm.C1089b0;
import cm.C1107k0;
import cm.R0;
import cm.W;
import com.truecaller.android.sdk.legacy.TruecallerSdkScope;
import com.vlv.aravali.KukuFMApplication;
import com.vlv.aravali.coins.UnlockSuccessMetadata;
import com.vlv.aravali.coins.data.responses.CoinSilentNotifData;
import com.vlv.aravali.coins.ui.fragments.T0;
import com.vlv.aravali.coins.ui.fragments.UnlockEpisodeBottomSheet;
import com.vlv.aravali.common.models.Author;
import com.vlv.aravali.common.models.CUPart;
import com.vlv.aravali.common.models.FreeTrialResponse;
import com.vlv.aravali.common.models.Infographic;
import com.vlv.aravali.common.models.Show;
import com.vlv.aravali.common.models.User;
import com.vlv.aravali.common.models.coins.Pack;
import com.vlv.aravali.common.models.payments.PlanDetailItem;
import com.vlv.aravali.common.models.user.UserResponse;
import com.vlv.aravali.common.models.vip.Offer;
import com.vlv.aravali.master.ui.MasterActivity;
import com.vlv.aravali.model.ByPassLoginData;
import com.vlv.aravali.payments.common.data.PaymentInfo;
import com.vlv.aravali.payments.common.data.SubscriptionMeta;
import com.vlv.aravali.payments.common.data.VerifyPaymentResponse;
import com.vlv.aravali.payments.playbilling.c;
import com.vlv.aravali.playerMedia3.ui.PlayerActivity;
import com.vlv.aravali.playerMedia3.ui.models.CommentScreenEvent$CheckLogin;
import com.vlv.aravali.playerMedia3.ui.models.CommentScreenEvent$OpenProfilePage;
import com.vlv.aravali.playerMedia3.ui.models.InfographicInsightUiModel;
import com.vlv.aravali.playerMedia3.ui.models.PlayerScreenEvent$OpenProfilePage;
import com.vlv.aravali.playerMedia3.ui.viewmodels.PlayerUiState;
import com.vlv.aravali.receivers.BluetoothBroadcastReceiver;
import com.vlv.aravali.receivers.HeadSetReceiver;
import com.vlv.aravali.showV2.ui.model.CreditsScreenEvent$FollowUser;
import com.vlv.aravali.showV2.ui.model.CreditsScreenEvent$OpenProfilePage;
import com.vlv.aravali.showV2.ui.model.CreditsScreenEvent$OpenShowPage;
import com.vlv.aravali.showV2.ui.model.CreditsScreenEvent$UnfollowUser;
import com.vlv.aravali.showV2.ui.model.RelatedScreenEvent$AddShowToLibrary;
import com.vlv.aravali.showV2.ui.model.RelatedScreenEvent$OpenCollection;
import com.vlv.aravali.showV2.ui.model.RelatedScreenEvent$OpenShowPage;
import com.vlv.aravali.showV2.ui.model.RelatedScreenEvent$RemoveShowFromLibrary;
import com.vlv.aravali.tangentialShows.presentation.action.TangentialShowAction$AddShowToLibrary;
import com.vlv.aravali.tangentialShows.presentation.action.TangentialShowAction$OpenShowPage;
import com.vlv.aravali.tangentialShows.presentation.action.TangentialShowAction$RemoveShowFromLibrary;
import com.vlv.aravali.views.activities.BaseActivity;
import com.vlv.aravali.views.widgets.InfographicsBottomSheet;
import h0.a0;
import h0.w;
import ij.i;
import io.sentry.config.d;
import j$.time.LocalDate;
import j$.time.format.DateTimeFormatter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.J;
import kp.b;
import ln.C2174i;
import mn.C2194e;
import mp.m;
import mp.q;
import nl.C2198b;
import ol.a;
import on.C2229t;
import pn.AbstractC2256a;
import pn.AbstractC2259d;

@Metadata
public final class PlayerActivity extends Hilt_PlayerActivity {
    public static final int $stable = 8;
    private C0908c actions;
    private Integer currentEpisodeIndex;
    private InfographicsBottomSheet infographicsBottomSheet;
    private final a0 isActivityInPipMode$delegate;
    private boolean isBluetoothHeadsetConnected;
    private boolean isCoinTaskInProgress;
    private boolean isUnlockDialogVisible;
    private boolean isWiredHeadsetConnected;
    private Integer mPackId;
    private SubscriptionMeta mSourceMeta;
    private k playBillingDelegate;
    private final m playBillingPaymentViewModel$delegate;
    private final SharedPreferences prefs;
    private final SharedPreferences.OnSharedPreferenceChangeListener sleepTimerSharedPrefsListener;
    private Integer totalEpisodes;
    private final a appDisposable = new a();
    private final HeadSetReceiver headSetReceiver = new HeadSetReceiver();
    private final BluetoothBroadcastReceiver bluetoothReceiver = new BluetoothBroadcastReceiver();
    private String source = "";
    private final m viewModel$delegate = new v(J.a(R0.class), new C0843x0(this, 4), new C0803d(this, 3), new C0843x0(this, 5));
    private final m episodeQueueViewModel$delegate = new v(J.a(C1107k0.class), new C0843x0(this, 6), new C0803d(this, 0), new C0843x0(this, 7));
    private final m commentsViewModel$delegate = new v(J.a(W.class), new C0843x0(this, 9), new C0843x0(this, 8), new C0843x0(this, 10));
    private final m coinsViewModel$delegate = new v(J.a(C1036U.class), new C0843x0(this, 0), new h(14), new C0843x0(this, 1));

    public PlayerActivity() {
        SharedPreferences sharedPreferences = KukuFMApplication.x.B().getSharedPreferences("com.vlv.aravali.bhakti", 0);
        Intrinsics.checkNotNullExpressionValue(sharedPreferences, "getSharedPreferences(...)");
        this.prefs = sharedPreferences;
        this.sleepTimerSharedPrefsListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
            @Override
            public final void onSharedPreferenceChanged(SharedPreferences sharedPreferences2, String str) {
                PlayerActivity.sleepTimerSharedPrefsListener$lambda$6(PlayerActivity.this, sharedPreferences2, str);
            }
        };
        this.playBillingPaymentViewModel$delegate = new v(J.a(c.class), new C0843x0(this, 2), new h(15), new C0843x0(this, 3));
        this.isActivityInPipMode$delegate = w.x(Boolean.FALSE);
    }

    public final void buyCoinPackViaGoogle(Pack pack) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0813i(this, pack, null), 3);
    }

    private final void buyPack(Pack pack, Show show, String str, boolean z) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0815j(pack, show, this, str, z, null), 3);
    }

    public static void buyPack$default(PlayerActivity playerActivity, Pack pack, Show show, String str, boolean z, int i, Object obj) {
        if ((i & 8) != 0) {
            z = false;
        }
        playerActivity.buyPack(pack, show, str, z);
    }

    public final void buySubscriptionPack(Pack pack, PlanDetailItem planDetailItem) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0817k(this, pack, planDetailItem, null), 3);
    }

    private final void checkHeadSetAlreadyConnected() {
        Object systemService = getSystemService("audio");
        Intrinsics.f(systemService, "null cannot be cast to non-null type android.media.AudioManager");
        AudioManager audioManager = (AudioManager) systemService;
        if (audioManager.isBluetoothA2dpOn()) {
            this.isBluetoothHeadsetConnected = false;
            b bVar = nl.a.a;
            nl.a.b(new C2198b(i.BLUETOOTH_HEADPHONE_CONNECTED, new Object[0]));
        } else if (audioManager.isWiredHeadsetOn()) {
            this.isWiredHeadsetConnected = true;
            b bVar2 = nl.a.a;
            nl.a.b(new C2198b(i.WIRED_HEADPHONE_CONNECTED, new Object[0]));
        } else {
            b bVar3 = nl.a.a;
            nl.a.b(new C2198b(i.WIRED_HEADPHONE_DISCONNECTED, new Object[0]));
            showHeadPhoneNudge();
        }
        showBgPlayEnabledNudge();
    }

    public static final q0 coinsViewModel_delegate$lambda$5() {
        return new ol.i(J.a(C1036U.class), new h(17));
    }

    public static final C1036U coinsViewModel_delegate$lambda$5$lambda$4() {
        return new C1036U(new C1063x());
    }

    private final void dismiss(String str) {
        if (isTaskRoot()) {
            Intent intent = new Intent((Context) this, (Class<?>) MasterActivity.class);
            if (str != null) {
                intent.setData(D8.i.M0(str));
            }
            startActivity(intent);
        }
        finish();
        overridePendingTransition(0, 2130772057);
    }

    public static void dismiss$default(PlayerActivity playerActivity, String str, int i, Object obj) {
        if ((i & 1) != 0) {
            str = null;
        }
        playerActivity.dismiss(str);
    }

    public static void doPurchaseCoinClicked$default(PlayerActivity playerActivity, String str, int i, Integer num, boolean z, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            i = 0;
        }
        if ((i2 & 4) != 0) {
            num = null;
        }
        if ((i2 & 8) != 0) {
            z = false;
        }
        playerActivity.doPurchaseCoinClicked(str, i, num, z);
    }

    public static void doWhenSubscribeClicked$default(PlayerActivity playerActivity, String str, int i, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            i = 0;
        }
        playerActivity.doWhenSubscribeClicked(str, i);
    }

    private final void downloadEvent(String str, Show show, CUPart cUPart) {
        String str2;
        Integer id;
        Ai.p pVar = KukuFMApplication.x;
        Bi.k kVar = new Bi.k(pVar.B().d());
        kVar.k(str);
        Object obj = "";
        if (show == null || (str2 = show.getTitle()) == null) {
            str2 = "";
        }
        kVar.c(str2, "show_title");
        if (show != null && (id = show.getId()) != null) {
            obj = id;
        }
        kVar.c(obj, "show_id");
        kVar.c(cUPart != null ? cUPart.getId() : null, "episode_id");
        User z = pVar.B().h().z();
        kVar.c(z != null ? z.getId() : null, "user_id");
        Integer id2 = show != null ? show.getId() : null;
        Show show2 = (Show) getPlayingShowFlow().getValue();
        kVar.c(Boolean.valueOf(Intrinsics.c(id2, show2 != null ? show2.getId() : null)), "episode_play_status");
        kVar.d();
    }

    public static void downloadEvent$default(PlayerActivity playerActivity, String str, Show show, CUPart cUPart, int i, Object obj) {
        if ((i & 2) != 0) {
            show = null;
        }
        if ((i & 4) != 0) {
            cUPart = null;
        }
        playerActivity.downloadEvent(str, show, cUPart);
    }

    public static final q0 episodeQueueViewModel_delegate$lambda$3(PlayerActivity playerActivity) {
        return new ol.i(J.a(C1107k0.class), new C0803d(playerActivity, 1));
    }

    public static final C1107k0 episodeQueueViewModel_delegate$lambda$3$lambda$2(PlayerActivity playerActivity) {
        Context applicationContext = playerActivity.getApplicationContext();
        Intrinsics.checkNotNullExpressionValue(applicationContext, "getApplicationContext(...)");
        return new C1107k0(new C0(applicationContext), playerActivity.getIntent().getIntExtra("show_id", 0), "player");
    }

    public final C1036U getCoinsViewModel() {
        return (C1036U) this.coinsViewModel$delegate.getValue();
    }

    public final W getCommentsViewModel() {
        return (W) this.commentsViewModel$delegate.getValue();
    }

    public final C1107k0 getEpisodeQueueViewModel() {
        return (C1107k0) this.episodeQueueViewModel$delegate.getValue();
    }

    public final void getPackMetaData(int i, int i2) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0819l(this, i, i2, null), 3);
    }

    private final c getPlayBillingPaymentViewModel() {
        return (c) this.playBillingPaymentViewModel$delegate.getValue();
    }

    public final void handleCommentEvents(Zl.a aVar) {
        if (aVar instanceof CommentScreenEvent$CheckLogin) {
            if (BaseActivity.loginRequest$default(this, new ByPassLoginData("player", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 131070, null), "player", null, 4, null)) {
                ((CommentScreenEvent$CheckLogin) aVar).getIfLoggedIn().invoke();
            }
        } else {
            if (!(aVar instanceof CommentScreenEvent$OpenProfilePage)) {
                throw new q();
            }
            b bVar = nl.a.a;
            nl.a.b(new C2198b(i.OPEN_OTHER_PROFILE, Integer.valueOf(((CommentScreenEvent$OpenProfilePage) aVar).getProfileId())));
            dismiss$default(this, null, 1, null);
        }
    }

    public final void handleCreditsScreenEvent(AbstractC2256a abstractC2256a) {
        if (abstractC2256a instanceof CreditsScreenEvent$OpenShowPage) {
            b bVar = nl.a.a;
            i iVar = i.NAVIGATE_TO_NEW_SHOW_SCREEN;
            CreditsScreenEvent$OpenShowPage creditsScreenEvent$OpenShowPage = (CreditsScreenEvent$OpenShowPage) abstractC2256a;
            String slug = creditsScreenEvent$OpenShowPage.getShow().getSlug();
            if (slug == null) {
                slug = "";
            }
            Integer id = creditsScreenEvent$OpenShowPage.getShow().getId();
            nl.a.b(new C2198b(iVar, slug, Integer.valueOf(id != null ? id.intValue() : 0), "player_go_to_show", "player"));
            dismiss(creditsScreenEvent$OpenShowPage.getShow().getUri());
            return;
        }
        if (abstractC2256a instanceof CreditsScreenEvent$FollowUser) {
            String string = getString(2132017697);
            Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
            showToast(string, 0);
        } else if (abstractC2256a instanceof CreditsScreenEvent$UnfollowUser) {
            String string2 = getString(2132018687);
            Intrinsics.checkNotNullExpressionValue(string2, "getString(...)");
            showToast(string2, 0);
        } else {
            if (!(abstractC2256a instanceof CreditsScreenEvent$OpenProfilePage)) {
                throw new q();
            }
            b bVar2 = nl.a.a;
            nl.a.b(new C2198b(i.OPEN_OTHER_PROFILE, Integer.valueOf(((CreditsScreenEvent$OpenProfilePage) abstractC2256a).getProfileId())));
            dismiss$default(this, null, 1, null);
        }
    }

    public final void handleEpisodeScreenEvents(pn.AbstractC2258c r14) {
        throw new UnsupportedOperationException("Method not decompiled: com.vlv.aravali.playerMedia3.ui.PlayerActivity.handleEpisodeScreenEvents(pn.c):void");
    }

    public final void handleEvents(Zl.m r57, am.C0908c r58) {
        throw new UnsupportedOperationException("Method not decompiled: com.vlv.aravali.playerMedia3.ui.PlayerActivity.handleEvents(Zl.m, am.c):void");
    }

    public final void handleRelatedEvents(AbstractC2259d abstractC2259d) {
        if (abstractC2259d instanceof RelatedScreenEvent$OpenShowPage) {
            b bVar = nl.a.a;
            i iVar = i.NAVIGATE_TO_NEW_SHOW_SCREEN;
            RelatedScreenEvent$OpenShowPage relatedScreenEvent$OpenShowPage = (RelatedScreenEvent$OpenShowPage) abstractC2259d;
            String slug = relatedScreenEvent$OpenShowPage.getShow().getSlug();
            if (slug == null) {
                slug = "";
            }
            Integer id = relatedScreenEvent$OpenShowPage.getShow().getId();
            nl.a.b(new C2198b(iVar, slug, Integer.valueOf(id != null ? id.intValue() : 0), "related", "player"));
            dismiss(relatedScreenEvent$OpenShowPage.getShow().getUri());
            return;
        }
        if (abstractC2259d instanceof RelatedScreenEvent$AddShowToLibrary) {
            getViewModel().k(((RelatedScreenEvent$AddShowToLibrary) abstractC2259d).getShow());
            String string = getString(2132017209);
            Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
            showToast(string, 0);
            return;
        }
        if (abstractC2259d instanceof RelatedScreenEvent$RemoveShowFromLibrary) {
            getViewModel().m(((RelatedScreenEvent$RemoveShowFromLibrary) abstractC2259d).getShow());
            String string2 = getString(2132018412);
            Intrinsics.checkNotNullExpressionValue(string2, "getString(...)");
            showToast(string2, 0);
            return;
        }
        if (!(abstractC2259d instanceof RelatedScreenEvent$OpenCollection)) {
            throw new q();
        }
        RelatedScreenEvent$OpenCollection relatedScreenEvent$OpenCollection = (RelatedScreenEvent$OpenCollection) abstractC2259d;
        String uri = relatedScreenEvent$OpenCollection.getCollection().getUri();
        String title = relatedScreenEvent$OpenCollection.getCollection().getTitle();
        b bVar2 = nl.a.a;
        nl.a.b(new C2198b(i.OPEN_COLLECTION_SHOWS_BY_ID, uri, title));
        dismiss(uri);
    }

    public final void handleTangentialShowActions(Kn.a aVar) {
        if (!(aVar instanceof TangentialShowAction$OpenShowPage)) {
            if (aVar instanceof TangentialShowAction$AddShowToLibrary) {
                String string = getString(2132017209);
                Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
                showToast(string, 0);
                return;
            } else {
                if (!(aVar instanceof TangentialShowAction$RemoveShowFromLibrary)) {
                    throw new q();
                }
                String string2 = getString(2132018412);
                Intrinsics.checkNotNullExpressionValue(string2, "getString(...)");
                showToast(string2, 0);
                return;
            }
        }
        Bi.k r = d.r(KukuFMApplication.x, "tangential_show_clicked");
        TangentialShowAction$OpenShowPage tangentialShowAction$OpenShowPage = (TangentialShowAction$OpenShowPage) aVar;
        r.c(tangentialShowAction$OpenShowPage.getShow().getId(), "show");
        r.d();
        b bVar = nl.a.a;
        i iVar = i.NAVIGATE_TO_NEW_SHOW_SCREEN;
        String slug = tangentialShowAction$OpenShowPage.getShow().getSlug();
        if (slug == null) {
            slug = "";
        }
        Integer id = tangentialShowAction$OpenShowPage.getShow().getId();
        nl.a.b(new C2198b(iVar, slug, Integer.valueOf(id != null ? id.intValue() : 0), "related", "player"));
        dismiss(tangentialShowAction$OpenShowPage.getShow().getUri());
    }

    public final void hidePackLoadingView() {
        if (isFinishing()) {
            return;
        }
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0823n(this, null), 3);
    }

    private final void initObservers() {
        Object systemService = getSystemService("audio");
        Intrinsics.f(systemService, "null cannot be cast to non-null type android.media.AudioManager");
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0838v(this, (AudioManager) systemService, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0844y(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new A(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new F(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new H(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new K(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new N(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new Q(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new r(this, null), 3);
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0836u(this, null), 3);
    }

    private final void initRxListeners() {
        a aVar = this.appDisposable;
        Qo.b subscribe = nl.a.a(C2198b.class).subscribe(new Qk.b(new C0807f(this, 0), 6));
        Intrinsics.checkNotNullExpressionValue(subscribe, "subscribe(...)");
        aVar.a(subscribe);
    }

    public static final Unit initRxListeners$lambda$11(PlayerActivity playerActivity, C2198b c2198b) {
        int i = AbstractC0811h.a[c2198b.a.ordinal()];
        Object[] objArr = c2198b.b;
        switch (i) {
            case 1:
                playerActivity.postLoginEventProcess(c2198b, null, null, new U(playerActivity, 4));
                break;
            case 2:
            case 3:
            case 4:
                dismiss$default(playerActivity, null, 1, null);
                break;
            case 5:
                C0908c c0908c = playerActivity.actions;
                if (c0908c == null) {
                    Intrinsics.m("actions");
                    throw null;
                }
                c0908c.f.invoke();
                break;
            case 6:
                playerActivity.isBluetoothHeadsetConnected = true;
                KukuFMApplication.x.B().d().l("headphones_connected").d();
                playerActivity.getViewModel().o(Xl.a.BLUETOOTH_HEADPHONE_CONNECTED);
                break;
            case 7:
                playerActivity.isBluetoothHeadsetConnected = false;
                o.r(KukuFMApplication.x, "headphones_disconnected");
                if (!playerActivity.isWiredHeadsetConnected) {
                    playerActivity.getViewModel().o(Xl.a.DISCONNECTED);
                    break;
                }
                break;
            case 8:
                playerActivity.isWiredHeadsetConnected = true;
                KukuFMApplication.x.B().d().l("headphones_connected").d();
                playerActivity.getViewModel().o(Xl.a.WIRED_HEADPHONE_CONNECTED);
                break;
            case 9:
                playerActivity.isWiredHeadsetConnected = false;
                o.r(KukuFMApplication.x, "headphones_disconnected");
                if (!playerActivity.isBluetoothHeadsetConnected) {
                    playerActivity.getViewModel().o(Xl.a.DISCONNECTED);
                    break;
                }
                break;
            case 10:
                if (objArr.length != 0) {
                    Object obj = objArr[0];
                    if (obj instanceof CoinSilentNotifData) {
                        Intrinsics.f(obj, "null cannot be cast to non-null type com.vlv.aravali.coins.data.responses.CoinSilentNotifData");
                        B i2 = i0.i(playerActivity);
                        f fVar = V.a;
                        p.w(i2, Qp.m.a, (Kp.J) null, new S(playerActivity, (CoinSilentNotifData) obj, null), 2);
                        break;
                    }
                }
                break;
            case 11:
                Object B = kotlin.collections.v.B(objArr);
                if (B instanceof UnlockSuccessMetadata) {
                    UnlockSuccessMetadata unlockSuccessMetadata = (UnlockSuccessMetadata) B;
                    if (unlockSuccessMetadata.getLevel() != EnumC0912c.SHOW) {
                        C1107k0 episodeQueueViewModel = playerActivity.getEpisodeQueueViewModel();
                        episodeQueueViewModel.getClass();
                        p.w(i0.k(episodeQueueViewModel), (CoroutineContext) null, (Kp.J) null, new C1089b0(episodeQueueViewModel, unlockSuccessMetadata, null), 3);
                        break;
                    }
                }
                break;
        }
        return Unit.a;
    }

    public static final Unit initRxListeners$lambda$11$lambda$10(PlayerActivity playerActivity, String str, Object obj) {
        Intrinsics.checkNotNullParameter(str, "it");
        Intrinsics.checkNotNullParameter(obj, "any");
        if (Intrinsics.c(str, "login_navigate_to_payment_flow_coins")) {
            b bVar = nl.a.a;
            nl.a.b(new C2198b(i.NAVIGATE_TO_COIN_PAYMENTS, obj, "paywall_purchase_coins"));
            dismiss$default(playerActivity, null, 1, null);
        }
        return Unit.a;
    }

    private final void initStoreCallBacks() {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new X(this, null), 3);
    }

    public final void initiatePaymentFlow(int i, int i2) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new Y(this, i, i2, null), 3);
    }

    public final boolean isActivityInPipMode() {
        return ((Boolean) this.isActivityInPipMode$delegate.getValue()).booleanValue();
    }

    private final boolean isInLast10Percent(Integer num, Integer num2) {
        if (num == null || num2 == null || num.intValue() <= 0) {
            return false;
        }
        return ((double) num2.intValue()) >= ((double) num.intValue()) * 0.9d;
    }

    public final boolean isPipSupportedVersionAndDevice() {
        return Build.VERSION.SDK_INT >= 26 && !D8.i.B0();
    }

    public final void navigateToMainActivity() {
        Intent intent = new Intent((Context) this, (Class<?>) MasterActivity.class);
        intent.setFlags(268468224);
        startActivity(intent);
    }

    public final void onPaymentFailure() {
        B i = i0.i(this);
        f fVar = V.a;
        p.w(i, Qp.m.a, (Kp.J) null, new C0826o0(this, null), 2);
    }

    public final void onSubscriptionPaymentSuccess(VerifyPaymentResponse verifyPaymentResponse, PaymentInfo paymentInfo) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0831r0(paymentInfo, verifyPaymentResponse, this, null), 3);
    }

    private final void openInfographicInsightsGallery(Integer num) {
        Object obj;
        int intValue;
        ArrayList arrayList = getViewModel().o0;
        if (arrayList.isEmpty()) {
            return;
        }
        Iterator it = ((Iterable) getViewModel().n0).iterator();
        while (true) {
            if (!it.hasNext()) {
                obj = null;
                break;
            }
            obj = it.next();
            InfographicInsightUiModel infographicInsightUiModel = (InfographicInsightUiModel) obj;
            CUPart cUPart = (CUPart) getPlayingEpisodeFlow().getValue();
            if (cUPart != null) {
                int episodeId = infographicInsightUiModel.getEpisodeId();
                Integer id = cUPart.getId();
                if (id != null && episodeId == id.intValue()) {
                    break;
                }
            }
        }
        InfographicInsightUiModel infographicInsightUiModel2 = (InfographicInsightUiModel) obj;
        Infographic indicatorItem = infographicInsightUiModel2 != null ? infographicInsightUiModel2.getIndicatorItem() : null;
        if (num != null) {
            intValue = num.intValue();
        } else {
            Integer valueOf = indicatorItem != null ? Integer.valueOf(indicatorItem.getId()) : null;
            intValue = valueOf != null ? valueOf.intValue() : ((Infographic) CollectionsKt.N(arrayList)).getId();
        }
        InfographicsBottomSheet.InfographicsStartParams infographicsStartParams = new InfographicsBottomSheet.InfographicsStartParams(arrayList, intValue);
        Bundle bundle = new Bundle();
        bundle.putParcelable("start_bundle", infographicsStartParams);
        InfographicsBottomSheet.Companion.getClass();
        Intrinsics.checkNotNullParameter(bundle, "bundle");
        InfographicsBottomSheet infographicsBottomSheet = new InfographicsBottomSheet();
        infographicsBottomSheet.setArguments(bundle);
        this.infographicsBottomSheet = infographicsBottomSheet;
        infographicsBottomSheet.show(getSupportFragmentManager(), InfographicsBottomSheet.TAG);
    }

    public static void openInfographicInsightsGallery$default(PlayerActivity playerActivity, Integer num, int i, Object obj) {
        if ((i & 1) != 0) {
            num = null;
        }
        playerActivity.openInfographicInsightsGallery(num);
    }

    private final void openMoreLikeThis(String str, int i) {
        if (isFinishing() || isDestroyed() || isActivityInPipMode()) {
            return;
        }
        if (Intrinsics.c(str, "less_than_ten_perc_content_left") || (!KukuFMApplication.x.B().h().E() && Intrinsics.c(str, "once_per_session_pause"))) {
            Ai.p pVar = KukuFMApplication.x;
            if (!pVar.B().h().E()) {
                Ai.o.C(pVar.B().h().a.a, "mlt_is_one_time_pause_shown", true);
            }
            pVar.B().h().F(false);
        }
        if (KukuFMApplication.x.B().h().a.a.getBoolean("mlt_is_already_shown", false)) {
            return;
        }
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0837u0(this, i, str, null), 3);
    }

    public static final q0 playBillingPaymentViewModel_delegate$lambda$8() {
        return new ol.i(J.a(c.class), new h(16));
    }

    public static final c playBillingPaymentViewModel_delegate$lambda$8$lambda$7() {
        return new c(new s());
    }

    private final void setActivityInPipMode(boolean z) {
        this.isActivityInPipMode$delegate.setValue(Boolean.valueOf(z));
    }

    private final void setBluetoothListener() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.bluetooth.device.action.ACL_CONNECTED");
        intentFilter.addAction("android.bluetooth.device.action.ACL_DISCONNECTED");
        if (Build.VERSION.SDK_INT >= 26) {
            registerReceiver(this.bluetoothReceiver, intentFilter, 2);
        } else {
            registerReceiver(this.bluetoothReceiver, intentFilter);
        }
    }

    private final void setHeadsetListener() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.HEADSET_PLUG");
        registerReceiver(this.headSetReceiver, intentFilter);
    }

    private final void showAudioQualityDialog() {
        throw new UnsupportedOperationException("Method not decompiled: com.vlv.aravali.playerMedia3.ui.PlayerActivity.showAudioQualityDialog():void");
    }

    public static final Unit showAudioQualityDialog$lambda$17$lambda$16(PlayerActivity playerActivity, ij.b bVar) {
        Intrinsics.checkNotNullParameter(bVar, "quality");
        Ai.p pVar = KukuFMApplication.x;
        Bi.k r = d.r(pVar, "audio_quality_selected_player");
        r.c(bVar.getAlternateName(), "audio_quality");
        r.d();
        R0 viewModel = playerActivity.getViewModel();
        UserResponse.SettingsData q = pVar.B().h().q();
        viewModel.r(q != null ? UserResponse.SettingsData.copy$default(q, null, null, null, null, UserResponse.SettingsData.AudioQualitySetting.copy$default(q.getAudioQuality(), null, null, bVar.getAlternateName(), 3, null), null, 47, null) : null);
        playerActivity.switchAudioQuality();
        return Unit.a;
    }

    private final void showBgPlayEnabledNudge() {
        Object value;
        PlayerUiState copy;
        Object value2;
        PlayerUiState copy2;
        R0 viewModel = getViewModel();
        viewModel.getClass();
        boolean c = Intrinsics.c(KukuFMApplication.x.B().h().a.a.getString("is_background_play_enabled_pop_up_viewed", ""), LocalDate.now().format(DateTimeFormatter.ISO_DATE));
        F0 f0 = viewModel.j0;
        if (c) {
            do {
                value = f0.getValue();
                copy = r2.copy((r62 & 1) != 0 ? r2.showId : 0, (r62 & 2) != 0 ? r2.show : null, (r62 & 4) != 0 ? r2.episode : null, (r62 & 8) != 0 ? r2.episodeId : 0, (r62 & 16) != 0 ? r2.episodeTitle : null, (r62 & 32) != 0 ? r2.episodeIndex : 0, (r62 & 64) != 0 ? r2.playingState : null, (r62 & 128) != 0 ? r2.thumbnailImageUrl : null, (r62 & 256) != 0 ? r2.gradientImageUrl : null, (r62 & 512) != 0 ? r2.paywallImage : null, (r62 & 1024) != 0 ? r2.isPlayLocked : false, (r62 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? r2.isVideoEpisode : false, (r62 & TruecallerSdkScope.FOOTER_TYPE_LATER) != 0 ? r2.isVideoPaywall : false, (r62 & 8192) != 0 ? r2.isFullScreenMode : false, (r62 & 16384) != 0 ? r2.headPhoneConnectionState : null, (r62 & 32768) != 0 ? r2.nComments : 0, (r62 & 65536) != 0 ? r2.comment : null, (r62 & 131072) != 0 ? r2.commentErrorMessage : null, (r62 & 262144) != 0 ? r2.isUserPremium : false, (r62 & 524288) != 0 ? r2.showAudioQualitySelector : false, (r62 & 1048576) != 0 ? r2.availableAudioQualities : null, (r62 & 2097152) != 0 ? r2.showUnlockFab : false, (r62 & 4194304) != 0 ? r2.showUpsellFab : false, (r62 & 8388608) != 0 ? r2.sleepTimerSlug : null, (r62 & 16777216) != 0 ? r2.infographicIndicatorImage : null, (r62 & 33554432) != 0 ? r2.infographicThumbnailImage : null, (r62 & 67108864) != 0 ? r2.hasInfographicsAndInsights : false, (r62 & 134217728) != 0 ? r2.infographicType : null, (r62 & 268435456) != 0 ? r2.infographicId : null, (r62 & 536870912) != 0 ? r2.showSubtitles : false, (r62 & 1073741824) != 0 ? r2.isTransitionAudio : false, (r62 & Integer.MIN_VALUE) != 0 ? r2.isEpisodeCoinBased : false, (r63 & 1) != 0 ? r2.isShowCoinBased : false, (r63 & 2) != 0 ? r2.isPlayerAd : false, (r63 & 4) != 0 ? r2.showTag : null, (r63 & 8) != 0 ? r2.showTagBg : null, (r63 & 16) != 0 ? r2.showTagColor : null, (r63 & 32) != 0 ? r2.nEpisodes : 0, (r63 & 64) != 0 ? r2.settingsData : null, (r63 & 128) != 0 ? r2.isVideoFullScreenDefault : false, (r63 & 256) != 0 ? r2.showHeadphoneNudge : false, (r63 & 512) != 0 ? r2.commentNudgeMessage : null, (r63 & 1024) != 0 ? r2.showBackgroundPlayEnabledNudge : false, (r63 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? ((PlayerUiState) value).isPlayPauseButtonIsInPauseState : false);
            } while (!f0.l(value, copy));
        } else {
            do {
                value2 = f0.getValue();
                copy2 = r4.copy((r62 & 1) != 0 ? r4.showId : 0, (r62 & 2) != 0 ? r4.show : null, (r62 & 4) != 0 ? r4.episode : null, (r62 & 8) != 0 ? r4.episodeId : 0, (r62 & 16) != 0 ? r4.episodeTitle : null, (r62 & 32) != 0 ? r4.episodeIndex : 0, (r62 & 64) != 0 ? r4.playingState : null, (r62 & 128) != 0 ? r4.thumbnailImageUrl : null, (r62 & 256) != 0 ? r4.gradientImageUrl : null, (r62 & 512) != 0 ? r4.paywallImage : null, (r62 & 1024) != 0 ? r4.isPlayLocked : false, (r62 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? r4.isVideoEpisode : false, (r62 & TruecallerSdkScope.FOOTER_TYPE_LATER) != 0 ? r4.isVideoPaywall : false, (r62 & 8192) != 0 ? r4.isFullScreenMode : false, (r62 & 16384) != 0 ? r4.headPhoneConnectionState : null, (r62 & 32768) != 0 ? r4.nComments : 0, (r62 & 65536) != 0 ? r4.comment : null, (r62 & 131072) != 0 ? r4.commentErrorMessage : null, (r62 & 262144) != 0 ? r4.isUserPremium : false, (r62 & 524288) != 0 ? r4.showAudioQualitySelector : false, (r62 & 1048576) != 0 ? r4.availableAudioQualities : null, (r62 & 2097152) != 0 ? r4.showUnlockFab : false, (r62 & 4194304) != 0 ? r4.showUpsellFab : false, (r62 & 8388608) != 0 ? r4.sleepTimerSlug : null, (r62 & 16777216) != 0 ? r4.infographicIndicatorImage : null, (r62 & 33554432) != 0 ? r4.infographicThumbnailImage : null, (r62 & 67108864) != 0 ? r4.hasInfographicsAndInsights : false, (r62 & 134217728) != 0 ? r4.infographicType : null, (r62 & 268435456) != 0 ? r4.infographicId : null, (r62 & 536870912) != 0 ? r4.showSubtitles : false, (r62 & 1073741824) != 0 ? r4.isTransitionAudio : false, (r62 & Integer.MIN_VALUE) != 0 ? r4.isEpisodeCoinBased : false, (r63 & 1) != 0 ? r4.isShowCoinBased : false, (r63 & 2) != 0 ? r4.isPlayerAd : false, (r63 & 4) != 0 ? r4.showTag : null, (r63 & 8) != 0 ? r4.showTagBg : null, (r63 & 16) != 0 ? r4.showTagColor : null, (r63 & 32) != 0 ? r4.nEpisodes : 0, (r63 & 64) != 0 ? r4.settingsData : null, (r63 & 128) != 0 ? r4.isVideoFullScreenDefault : false, (r63 & 256) != 0 ? r4.showHeadphoneNudge : false, (r63 & 512) != 0 ? r4.commentNudgeMessage : null, (r63 & 1024) != 0 ? r4.showBackgroundPlayEnabledNudge : true, (r63 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? ((PlayerUiState) value2).isPlayPauseButtonIsInPauseState : false);
            } while (!f0.l(value2, copy2));
            uj.d h = KukuFMApplication.x.B().h();
            Ai.o.B(h.a.a, "is_background_play_enabled_pop_up_viewed", LocalDate.now().format(DateTimeFormatter.ISO_DATE));
        }
    }

    private final void showHeadPhoneNudge() {
        Object value;
        PlayerUiState copy;
        Object value2;
        PlayerUiState copy2;
        R0 viewModel = getViewModel();
        viewModel.getClass();
        boolean c = Intrinsics.c(KukuFMApplication.x.B().h().a.a.getString("is_head_phone_pop_up_viewed", ""), new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).format(new Date()));
        F0 f0 = viewModel.j0;
        if (c) {
            do {
                value = f0.getValue();
                copy = r2.copy((r62 & 1) != 0 ? r2.showId : 0, (r62 & 2) != 0 ? r2.show : null, (r62 & 4) != 0 ? r2.episode : null, (r62 & 8) != 0 ? r2.episodeId : 0, (r62 & 16) != 0 ? r2.episodeTitle : null, (r62 & 32) != 0 ? r2.episodeIndex : 0, (r62 & 64) != 0 ? r2.playingState : null, (r62 & 128) != 0 ? r2.thumbnailImageUrl : null, (r62 & 256) != 0 ? r2.gradientImageUrl : null, (r62 & 512) != 0 ? r2.paywallImage : null, (r62 & 1024) != 0 ? r2.isPlayLocked : false, (r62 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? r2.isVideoEpisode : false, (r62 & TruecallerSdkScope.FOOTER_TYPE_LATER) != 0 ? r2.isVideoPaywall : false, (r62 & 8192) != 0 ? r2.isFullScreenMode : false, (r62 & 16384) != 0 ? r2.headPhoneConnectionState : null, (r62 & 32768) != 0 ? r2.nComments : 0, (r62 & 65536) != 0 ? r2.comment : null, (r62 & 131072) != 0 ? r2.commentErrorMessage : null, (r62 & 262144) != 0 ? r2.isUserPremium : false, (r62 & 524288) != 0 ? r2.showAudioQualitySelector : false, (r62 & 1048576) != 0 ? r2.availableAudioQualities : null, (r62 & 2097152) != 0 ? r2.showUnlockFab : false, (r62 & 4194304) != 0 ? r2.showUpsellFab : false, (r62 & 8388608) != 0 ? r2.sleepTimerSlug : null, (r62 & 16777216) != 0 ? r2.infographicIndicatorImage : null, (r62 & 33554432) != 0 ? r2.infographicThumbnailImage : null, (r62 & 67108864) != 0 ? r2.hasInfographicsAndInsights : false, (r62 & 134217728) != 0 ? r2.infographicType : null, (r62 & 268435456) != 0 ? r2.infographicId : null, (r62 & 536870912) != 0 ? r2.showSubtitles : false, (r62 & 1073741824) != 0 ? r2.isTransitionAudio : false, (r62 & Integer.MIN_VALUE) != 0 ? r2.isEpisodeCoinBased : false, (r63 & 1) != 0 ? r2.isShowCoinBased : false, (r63 & 2) != 0 ? r2.isPlayerAd : false, (r63 & 4) != 0 ? r2.showTag : null, (r63 & 8) != 0 ? r2.showTagBg : null, (r63 & 16) != 0 ? r2.showTagColor : null, (r63 & 32) != 0 ? r2.nEpisodes : 0, (r63 & 64) != 0 ? r2.settingsData : null, (r63 & 128) != 0 ? r2.isVideoFullScreenDefault : false, (r63 & 256) != 0 ? r2.showHeadphoneNudge : false, (r63 & 512) != 0 ? r2.commentNudgeMessage : null, (r63 & 1024) != 0 ? r2.showBackgroundPlayEnabledNudge : false, (r63 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? ((PlayerUiState) value).isPlayPauseButtonIsInPauseState : false);
            } while (!f0.l(value, copy));
        } else {
            do {
                value2 = f0.getValue();
                copy2 = r6.copy((r62 & 1) != 0 ? r6.showId : 0, (r62 & 2) != 0 ? r6.show : null, (r62 & 4) != 0 ? r6.episode : null, (r62 & 8) != 0 ? r6.episodeId : 0, (r62 & 16) != 0 ? r6.episodeTitle : null, (r62 & 32) != 0 ? r6.episodeIndex : 0, (r62 & 64) != 0 ? r6.playingState : null, (r62 & 128) != 0 ? r6.thumbnailImageUrl : null, (r62 & 256) != 0 ? r6.gradientImageUrl : null, (r62 & 512) != 0 ? r6.paywallImage : null, (r62 & 1024) != 0 ? r6.isPlayLocked : false, (r62 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? r6.isVideoEpisode : false, (r62 & TruecallerSdkScope.FOOTER_TYPE_LATER) != 0 ? r6.isVideoPaywall : false, (r62 & 8192) != 0 ? r6.isFullScreenMode : false, (r62 & 16384) != 0 ? r6.headPhoneConnectionState : null, (r62 & 32768) != 0 ? r6.nComments : 0, (r62 & 65536) != 0 ? r6.comment : null, (r62 & 131072) != 0 ? r6.commentErrorMessage : null, (r62 & 262144) != 0 ? r6.isUserPremium : false, (r62 & 524288) != 0 ? r6.showAudioQualitySelector : false, (r62 & 1048576) != 0 ? r6.availableAudioQualities : null, (r62 & 2097152) != 0 ? r6.showUnlockFab : false, (r62 & 4194304) != 0 ? r6.showUpsellFab : false, (r62 & 8388608) != 0 ? r6.sleepTimerSlug : null, (r62 & 16777216) != 0 ? r6.infographicIndicatorImage : null, (r62 & 33554432) != 0 ? r6.infographicThumbnailImage : null, (r62 & 67108864) != 0 ? r6.hasInfographicsAndInsights : false, (r62 & 134217728) != 0 ? r6.infographicType : null, (r62 & 268435456) != 0 ? r6.infographicId : null, (r62 & 536870912) != 0 ? r6.showSubtitles : false, (r62 & 1073741824) != 0 ? r6.isTransitionAudio : false, (r62 & Integer.MIN_VALUE) != 0 ? r6.isEpisodeCoinBased : false, (r63 & 1) != 0 ? r6.isShowCoinBased : false, (r63 & 2) != 0 ? r6.isPlayerAd : false, (r63 & 4) != 0 ? r6.showTag : null, (r63 & 8) != 0 ? r6.showTagBg : null, (r63 & 16) != 0 ? r6.showTagColor : null, (r63 & 32) != 0 ? r6.nEpisodes : 0, (r63 & 64) != 0 ? r6.settingsData : null, (r63 & 128) != 0 ? r6.isVideoFullScreenDefault : false, (r63 & 256) != 0 ? r6.showHeadphoneNudge : true, (r63 & 512) != 0 ? r6.commentNudgeMessage : null, (r63 & 1024) != 0 ? r6.showBackgroundPlayEnabledNudge : false, (r63 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? ((PlayerUiState) value2).isPlayPauseButtonIsInPauseState : false);
            } while (!f0.l(value2, copy2));
            uj.d h = KukuFMApplication.x.B().h();
            Ai.o.B(h.a.a, "is_head_phone_pop_up_viewed", new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).format(new Date()));
        }
    }

    public final void showPackLoadingView() {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0839v0(this, null), 3);
    }

    private final void showSleepTimerDialog() {
    }

    private final void showSliderPlaybackSpeedDialog() {
    }

    public final void showVipFreeCoinsPopupIfNeeded(Show show) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0841w0(show, this, null), 3);
    }

    public static final void sleepTimerSharedPrefsListener$lambda$6(PlayerActivity playerActivity, SharedPreferences sharedPreferences, String str) {
        F0 f0;
        Object value;
        PlayerUiState copy;
        if (str != null && str.hashCode() == 1961339341 && str.equals("sleep_timer_slug")) {
            R0 viewModel = playerActivity.getViewModel();
            String string = sharedPreferences.getString("sleep_timer_slug", "");
            String str2 = string != null ? string : "";
            viewModel.getClass();
            Intrinsics.checkNotNullParameter(str2, "sleepTimerSlug");
            do {
                f0 = viewModel.j0;
                value = f0.getValue();
                copy = r3.copy((r62 & 1) != 0 ? r3.showId : 0, (r62 & 2) != 0 ? r3.show : null, (r62 & 4) != 0 ? r3.episode : null, (r62 & 8) != 0 ? r3.episodeId : 0, (r62 & 16) != 0 ? r3.episodeTitle : null, (r62 & 32) != 0 ? r3.episodeIndex : 0, (r62 & 64) != 0 ? r3.playingState : null, (r62 & 128) != 0 ? r3.thumbnailImageUrl : null, (r62 & 256) != 0 ? r3.gradientImageUrl : null, (r62 & 512) != 0 ? r3.paywallImage : null, (r62 & 1024) != 0 ? r3.isPlayLocked : false, (r62 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? r3.isVideoEpisode : false, (r62 & TruecallerSdkScope.FOOTER_TYPE_LATER) != 0 ? r3.isVideoPaywall : false, (r62 & 8192) != 0 ? r3.isFullScreenMode : false, (r62 & 16384) != 0 ? r3.headPhoneConnectionState : null, (r62 & 32768) != 0 ? r3.nComments : 0, (r62 & 65536) != 0 ? r3.comment : null, (r62 & 131072) != 0 ? r3.commentErrorMessage : null, (r62 & 262144) != 0 ? r3.isUserPremium : false, (r62 & 524288) != 0 ? r3.showAudioQualitySelector : false, (r62 & 1048576) != 0 ? r3.availableAudioQualities : null, (r62 & 2097152) != 0 ? r3.showUnlockFab : false, (r62 & 4194304) != 0 ? r3.showUpsellFab : false, (r62 & 8388608) != 0 ? r3.sleepTimerSlug : str2, (r62 & 16777216) != 0 ? r3.infographicIndicatorImage : null, (r62 & 33554432) != 0 ? r3.infographicThumbnailImage : null, (r62 & 67108864) != 0 ? r3.hasInfographicsAndInsights : false, (r62 & 134217728) != 0 ? r3.infographicType : null, (r62 & 268435456) != 0 ? r3.infographicId : null, (r62 & 536870912) != 0 ? r3.showSubtitles : false, (r62 & 1073741824) != 0 ? r3.isTransitionAudio : false, (r62 & Integer.MIN_VALUE) != 0 ? r3.isEpisodeCoinBased : false, (r63 & 1) != 0 ? r3.isShowCoinBased : false, (r63 & 2) != 0 ? r3.isPlayerAd : false, (r63 & 4) != 0 ? r3.showTag : null, (r63 & 8) != 0 ? r3.showTagBg : null, (r63 & 16) != 0 ? r3.showTagColor : null, (r63 & 32) != 0 ? r3.nEpisodes : 0, (r63 & 64) != 0 ? r3.settingsData : null, (r63 & 128) != 0 ? r3.isVideoFullScreenDefault : false, (r63 & 256) != 0 ? r3.showHeadphoneNudge : false, (r63 & 512) != 0 ? r3.commentNudgeMessage : null, (r63 & 1024) != 0 ? r3.showBackgroundPlayEnabledNudge : false, (r63 & TruecallerSdkScope.BUTTON_SHAPE_RECTANGLE) != 0 ? ((PlayerUiState) value).isPlayPauseButtonIsInPauseState : false);
            } while (!f0.l(value, copy));
        }
    }

    public final void unlockEpisode(Show show, CUPart cUPart) {
        Ai.p pVar = KukuFMApplication.x;
        if (d.t(pVar) == null || this.isUnlockDialogVisible) {
            return;
        }
        T0 t0 = UnlockEpisodeBottomSheet.Companion;
        Integer id = show.getId();
        int intValue = id != null ? id.intValue() : 0;
        Integer id2 = cUPart.getId();
        Integer valueOf = Integer.valueOf(id2 != null ? id2.intValue() : 0);
        Offer unlockOffer = show.getUnlockOffer();
        t0.getClass();
        UnlockEpisodeBottomSheet a = T0.a("player_page_get_more_coins", intValue, valueOf, unlockOffer);
        pVar.B().h().G();
        a.registerDialogActionsInterface(new Xb.b(this));
        this.isUnlockDialogVisible = true;
        a.show(getSupportFragmentManager(), UnlockEpisodeBottomSheet.TAG);
    }

    private final void updatePipState() {
        boolean isInPictureInPictureMode;
        if (Build.VERSION.SDK_INT >= 26) {
            isInPictureInPictureMode = isInPictureInPictureMode();
            setActivityInPipMode(isInPictureInPictureMode);
        }
    }

    public static final q0 viewModel_delegate$lambda$1(PlayerActivity playerActivity) {
        return new ol.i(J.a(R0.class), new C0803d(playerActivity, 2));
    }

    public static final R0 viewModel_delegate$lambda$1$lambda$0(PlayerActivity playerActivity) {
        Context applicationContext = playerActivity.getApplicationContext();
        Intrinsics.checkNotNullExpressionValue(applicationContext, "getApplicationContext(...)");
        return new R0(new a1(new C0(applicationContext)), new C2174i(new C2229t(), new C2194e()), playerActivity.getIntent().getExtras());
    }

    public final void doPurchaseCoinClicked(String str, int i, Integer num, boolean z) {
        Integer id;
        String str2;
        Intrinsics.checkNotNullParameter(str, "eventSource");
        Pair pair = e.g;
        if (pair != null && (str2 = (String) pair.b) != null) {
            e.c = Uri.parse(str2);
        }
        Bi.k g = o.g(KukuFMApplication.x, "view_all_plans_clicked", "source", "player");
        g.c(str, "player_source");
        g.g(false);
        Show show = (Show) getPlayingShowFlow().getValue();
        int i2 = -1;
        Integer valueOf = Integer.valueOf((show == null || (id = show.getId()) == null) ? -1 : id.intValue());
        if (num != null) {
            i2 = num.intValue();
        } else {
            CUPart cUPart = (CUPart) getPlayingEpisodeFlow().getValue();
            Integer id2 = cUPart != null ? cUPart.getId() : null;
            if (id2 != null) {
                i2 = id2.intValue();
            }
        }
        Integer valueOf2 = Integer.valueOf(i2);
        Show show2 = (Show) getPlayingShowFlow().getValue();
        SubscriptionMeta subscriptionMeta = new SubscriptionMeta(str, valueOf, valueOf2, null, null, null, show2 != null ? show2.getImage() : null, null, null, null, Integer.valueOf(i), null, null, z, null, null, null, null, null, 515000, null);
        b bVar = nl.a.a;
        nl.a.b(new C2198b(i.NAVIGATE_TO_COIN_FLOW, subscriptionMeta));
        dismiss$default(this, null, 1, null);
    }

    public final void doWhenSubscribeClicked(String str, int i) {
        Integer id;
        Integer id2;
        String str2;
        Intrinsics.checkNotNullParameter(str, "eventSource");
        Pair pair = e.g;
        if (pair != null && (str2 = (String) pair.b) != null) {
            e.c = Uri.parse(str2);
        }
        Bi.k g = o.g(KukuFMApplication.x, "view_all_plans_clicked", "source", "player");
        g.c(str, "player_source");
        g.g(false);
        Show show = (Show) getPlayingShowFlow().getValue();
        int i2 = -1;
        Integer valueOf = Integer.valueOf((show == null || (id2 = show.getId()) == null) ? -1 : id2.intValue());
        CUPart cUPart = (CUPart) getPlayingEpisodeFlow().getValue();
        if (cUPart != null && (id = cUPart.getId()) != null) {
            i2 = id.intValue();
        }
        Integer valueOf2 = Integer.valueOf(i2);
        Show show2 = (Show) getPlayingShowFlow().getValue();
        SubscriptionMeta subscriptionMeta = new SubscriptionMeta(str, valueOf, valueOf2, null, null, null, show2 != null ? show2.getImage() : null, null, null, null, Integer.valueOf(i), null, null, false, null, null, null, null, null, 523192, null);
        b bVar = nl.a.a;
        nl.a.b(new C2198b(i.NAVIGATE_TO_SUBSCRIPTION_FLOW, subscriptionMeta));
        dismiss$default(this, null, 1, null);
    }

    public final void episodeEvent(String str) {
        String str2;
        Object obj;
        Object obj2;
        String str3;
        Integer id;
        Integer id2;
        Intrinsics.checkNotNullParameter(str, "name");
        CUPart cUPart = (CUPart) getPlayingEpisodeFlow().getValue();
        Show show = (Show) getPlayingShowFlow().getValue();
        Bi.k kVar = new Bi.k(KukuFMApplication.x.B().d());
        kVar.k(str);
        Object obj3 = "";
        if (cUPart == null || (str2 = cUPart.getTitle()) == null) {
            str2 = "";
        }
        kVar.c(str2, "episode_title");
        if (cUPart == null || (obj = cUPart.getId()) == null) {
            obj = "";
        }
        kVar.c(obj, "episode_id");
        kVar.c(Integer.valueOf((show == null || (id2 = show.getId()) == null) ? 0 : id2.intValue()), "show_id");
        if (show == null || (obj2 = show.getTitle()) == null) {
            obj2 = 0;
        }
        kVar.c(obj2, "show_title");
        if ((cUPart != null ? cUPart.getAuthor() : null) != null) {
            Author author = cUPart.getAuthor();
            if (author == null || (str3 = author.getName()) == null) {
                str3 = "";
            }
            kVar.c(str3, "publisher_name");
            Author author2 = cUPart.getAuthor();
            if (author2 != null && (id = author2.getId()) != null) {
                obj3 = id;
            }
            kVar.c(obj3, "publisher_id");
        }
        kVar.d();
    }

    public final R0 getViewModel() {
        return (R0) this.viewModel$delegate.getValue();
    }

    @Override
    public void onCreate(Bundle bundle) {
        Bundle extras;
        Bundle extras2;
        Bundle extras3;
        String string;
        super.onCreate(bundle);
        Intent intent = getIntent();
        String str = "";
        if (intent != null && (extras3 = intent.getExtras()) != null && (string = extras3.getString("source", "")) != null) {
            str = string;
        }
        this.source = str;
        k kVar = new k(this, getPlayBillingPaymentViewModel(), new u6.e(this, 25));
        this.playBillingDelegate = kVar;
        getLifecycle().a(kVar);
        r2.a.e0(getWindow(), false);
        h.a.a(this, new p0.c(new C0824n0(this, bundle), true, 1867807047));
        this.totalEpisodes = Integer.valueOf(getIntent().getIntExtra("totalEpisodes", 0));
        this.currentEpisodeIndex = Integer.valueOf(getIntent().getIntExtra("currentEpisodeIndex", 0));
        initObservers();
        initRxListeners();
        registerMediaDownloader(this);
        initStoreCallBacks();
        Bi.k r = d.r(KukuFMApplication.x, "player_screen_viewed");
        Intent intent2 = getIntent();
        Integer num = null;
        r.c((intent2 == null || (extras2 = intent2.getExtras()) == null) ? null : Integer.valueOf(extras2.getInt("show_id", 0)), "show_id");
        Intent intent3 = getIntent();
        if (intent3 != null && (extras = intent3.getExtras()) != null) {
            num = Integer.valueOf(extras.getInt("episode_id", 0));
        }
        r.c(num, "episode_id");
        r.c(this.source, "source");
        r.d();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Window window = getWindow();
        if (window != null) {
            window.clearFlags(128);
        }
        o.r(KukuFMApplication.x, "player_collapsed");
        this.appDisposable.b();
        try {
            unregisterReceiver(this.headSetReceiver);
            unregisterReceiver(this.bluetoothReceiver);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onPictureInPictureModeChanged(boolean z, Configuration configuration) {
        Intrinsics.checkNotNullParameter(configuration, "newConfig");
        super.onPictureInPictureModeChanged(z, configuration);
        updatePipState();
        if (z) {
            Bi.k r = d.r(KukuFMApplication.x, "pip_mode_entered");
            Show show = (Show) getPlayingShowFlow().getValue();
            r.c(show != null ? show.getId() : null, "show_id");
            CUPart cUPart = (CUPart) getPlayingEpisodeFlow().getValue();
            r.c(cUPart != null ? cUPart.getId() : null, "episode_id");
            r.d();
            return;
        }
        Bi.k r2 = d.r(KukuFMApplication.x, "pip_mode_exited");
        Show show2 = (Show) getPlayingShowFlow().getValue();
        r2.c(show2 != null ? show2.getId() : null, "show_id");
        CUPart cUPart2 = (CUPart) getPlayingEpisodeFlow().getValue();
        r2.c(cUPart2 != null ? cUPart2.getId() : null, "episode_id");
        r2.d();
    }

    @Override
    public void onResume() {
        super.onResume();
        updatePipState();
    }

    public void onStart() {
        super.onStart();
        setHeadsetListener();
        setBluetoothListener();
        checkHeadSetAlreadyConnected();
        this.prefs.registerOnSharedPreferenceChangeListener(this.sleepTimerSharedPrefsListener);
    }

    public void onStop() {
        super.onStop();
        this.prefs.unregisterOnSharedPreferenceChangeListener(this.sleepTimerSharedPrefsListener);
        if (isActivityInPipMode()) {
            finish();
        }
    }

    public final void openFreeTrialPage() {
        ArrayList arrayList = e.a;
        FreeTrialResponse freeTrialResponse = e.k;
        if (freeTrialResponse == null || !freeTrialResponse.getEnableFreeTrialPlayer()) {
            return;
        }
        Bundle m = CredentialProviderBeginSignInController$.ExternalSyntheticOutline0.m("source", "PlayerActivity");
        com.vlv.aravali.freeTrial.H.Companion.getClass();
        Intrinsics.checkNotNullParameter(m, "bundle");
        com.vlv.aravali.freeTrial.H h = new com.vlv.aravali.freeTrial.H();
        h.setArguments(m);
        if (isFinishing()) {
            return;
        }
        h.show(getSupportFragmentManager(), com.vlv.aravali.freeTrial.H.TAG);
    }

    public final void openMobileAds(Integer num, String str, Integer num2) {
        p.w(i0.i(this), (CoroutineContext) null, (Kp.J) null, new C0833s0(num, str, num2, this, null), 3);
    }

    public final void openProfilePage(int i) {
        if (this.actions != null) {
            PlayerScreenEvent$OpenProfilePage playerScreenEvent$OpenProfilePage = new PlayerScreenEvent$OpenProfilePage(i);
            C0908c c0908c = this.actions;
            if (c0908c != null) {
                handleEvents(playerScreenEvent$OpenProfilePage, c0908c);
            } else {
                Intrinsics.m("actions");
                throw null;
            }
        }
    }

    public final void openShowViaIntent(Show show) {
        Intrinsics.checkNotNullParameter(show, "show");
        b bVar = nl.a.a;
        i iVar = i.NAVIGATE_TO_NEW_SHOW_SCREEN;
        String slug = show.getSlug();
        if (slug == null) {
            slug = "";
        }
        Integer id = show.getId();
        nl.a.b(new C2198b(iVar, slug, Integer.valueOf(id != null ? id.intValue() : 0), "pop_up", "more_like_this"));
        dismiss(show.getUri());
    }
}