导航菜单

页面标题

页面副标题

Bhakti v5.4.0 - PremiumTabParentFragment.java 源代码

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

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


package com.vlv.aravali.premium.ui;

import B4.G1;
import Vj.AbstractC0688vf;
import Vj.T4;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.j0;
import androidx.fragment.app.w0;
import androidx.lifecycle.i0;
import com.vlv.aravali.KukuFMApplication;
import com.vlv.aravali.coins.ui.fragments.F1;
import com.vlv.aravali.common.models.FreeTrialResponse;
import com.vlv.aravali.common.models.User;
import com.vlv.aravali.common.models.payments.PlanDetailItem;
import com.vlv.aravali.common.models.user.UserResponse;
import com.vlv.aravali.freeTrial.C1237i;
import com.vlv.aravali.freeTrial.C1252y;
import com.vlv.aravali.freeTrial.k0;
import com.vlv.aravali.master.ui.MasterActivity;
import com.vlv.aravali.model.ByPassLoginData;
import com.vlv.aravali.payments.common.data.SubscriptionMeta;
import com.vlv.aravali.payments.legacy.ui.fragment.V;
import com.vlv.aravali.premium.data.PremiumPageData;
import com.vlv.aravali.views.fragments.C1830p;
import com.vlv.aravali.views.widgets.UIComponentNewErrorStates;
import java.util.ArrayList;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import nl.C2198b;

@Metadata
public final class PremiumTabParentFragment extends AbstractC1508h {
    static final Gp.j[] $$delegatedProperties;
    public static final int $stable;
    public static final J Companion;
    private static final String TAG;
    private C1830p activeFragment;
    private final ol.a appDisposable;
    private final Ri.g binding$delegate;
    private SubscriptionMeta subscriptionMeta;
    private final mp.m vm$delegate;
    private boolean wasRatingVisible;

    static {
        Gp.j a = new kotlin.jvm.internal.A(PremiumTabParentFragment.class, "binding", "getBinding()Lcom/vlv/aravali/databinding/PremiumTabParentFragmentBinding;", 0);
        kotlin.jvm.internal.J.a.getClass();
        $$delegatedProperties = new Gp.j[]{a};
        Companion = new J();
        $stable = 8;
        Intrinsics.checkNotNullExpressionValue("PremiumTabParentFragment", "getSimpleName(...)");
        TAG = "PremiumTabParentFragment";
    }

    public PremiumTabParentFragment() {
        super(2131559286);
        mp.m a = mp.o.a(mp.p.NONE, new C1252y(new C1252y(this, 24), 25));
        this.vm$delegate = new B4.v(kotlin.jvm.internal.J.a(im.t.class), new N(a, 0), new T0.y(20, this, a), new N(a, 1));
        this.binding$delegate = new Ri.g(AbstractC0688vf.class, this);
        this.appDisposable = new ol.a();
        this.subscriptionMeta = new SubscriptionMeta("bottom_nav", null, null, null, null, null, null, null, null, null, null, null, null, false, null, null, null, null, null, 524286, null);
        Bundle arguments = getArguments();
        if (arguments != null) {
            this.subscriptionMeta = (SubscriptionMeta) arguments.getSerializable("subscription_meta");
        }
    }

    private final AbstractC0688vf getBinding() {
        return this.binding$delegate.a(this, $$delegatedProperties[0]);
    }

    private final void initNetworkCalls() {
        if (getVm().g.getValue() == null) {
            im.t vm2 = getVm();
            if (vm2.g.getValue() != null) {
                return;
            }
            Kp.p.w(i0.k(vm2), vm2.b, (Kp.J) null, new im.r(vm2, null), 2);
        }
    }

    private final void initObservers() {
        G1 g1 = new G1(getVm().f, new M(this, null), 5);
        androidx.lifecycle.G viewLifecycleOwner = getViewLifecycleOwner();
        Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        new H8.b(viewLifecycleOwner, g1, new L(2, null));
        ol.a aVar = this.appDisposable;
        Qo.b subscribe = nl.a.a(C2198b.class).subscribe(new com.vlv.aravali.downloadsV2.ui.f(new co.l(this, 22), 27), new com.vlv.aravali.downloadsV2.ui.f(new F1(24), 28));
        Intrinsics.checkNotNullExpressionValue(subscribe, "subscribe(...)");
        aVar.a(subscribe);
    }

    public static final Unit initObservers$lambda$2(PremiumTabParentFragment premiumTabParentFragment, C2198b c2198b) {
        int i = K.a[c2198b.a.ordinal()];
        if (i == 1) {
            premiumTabParentFragment.onGetPostLoginEvent();
        } else if (i == 2 || i == 3) {
            C1830p c1830p = premiumTabParentFragment.activeFragment;
            if (c1830p instanceof V) {
                Intrinsics.f(c1830p, "null cannot be cast to non-null type com.vlv.aravali.payments.legacy.ui.fragment.SubscriptionFragment");
                ((V) c1830p).setAndLoadWebView();
            } else if ((c1830p instanceof PremiumFragmentV2) || (c1830p instanceof PremiumFragment)) {
                premiumTabParentFragment.refreshPage();
            }
        } else if (i == 4 && (premiumTabParentFragment.getActivity() instanceof MasterActivity)) {
            C1830p c1830p2 = premiumTabParentFragment.activeFragment;
            if (c1830p2 instanceof V) {
                Intrinsics.f(c1830p2, "null cannot be cast to non-null type com.vlv.aravali.payments.legacy.ui.fragment.SubscriptionFragment");
                ((V) c1830p2).setAndLoadWebView();
            } else if ((c1830p2 instanceof PremiumFragmentV2) || (c1830p2 instanceof PremiumFragment)) {
                premiumTabParentFragment.refreshPage();
            }
        }
        return Unit.a;
    }

    public static final Unit initObservers$lambda$4(Throwable th) {
        th.printStackTrace();
        return Unit.a;
    }

    private final void onGetPostLoginEvent() {
        ConstraintLayout constraintLayout;
        User t = io.sentry.config.d.t(KukuFMApplication.x);
        if (t != null && t.isPremium()) {
            refreshPage();
            return;
        }
        C1830p c1830p = this.activeFragment;
        if (c1830p instanceof V) {
            Intrinsics.f(c1830p, "null cannot be cast to non-null type com.vlv.aravali.payments.legacy.ui.fragment.SubscriptionFragment");
            T4 binding = ((V) c1830p).getBinding();
            if (binding != null && (constraintLayout = binding.M) != null) {
                constraintLayout.setVisibility(8);
            }
            C1830p c1830p2 = this.activeFragment;
            Intrinsics.f(c1830p2, "null cannot be cast to non-null type com.vlv.aravali.views.fragments.BaseFragment");
            if (c1830p2.getMLoginData() != null) {
                C1830p c1830p3 = this.activeFragment;
                Intrinsics.f(c1830p3, "null cannot be cast to non-null type com.vlv.aravali.views.fragments.BaseFragment");
                ByPassLoginData mLoginData = c1830p3.getMLoginData();
                if ((mLoginData != null ? mLoginData.getPaymentPlanData() : null) != null) {
                    C1830p c1830p4 = this.activeFragment;
                    Intrinsics.f(c1830p4, "null cannot be cast to non-null type com.vlv.aravali.payments.legacy.ui.fragment.SubscriptionFragment");
                    V v = (V) c1830p4;
                    C1830p c1830p5 = this.activeFragment;
                    Intrinsics.f(c1830p5, "null cannot be cast to non-null type com.vlv.aravali.views.fragments.BaseFragment");
                    ByPassLoginData mLoginData2 = c1830p5.getMLoginData();
                    PlanDetailItem paymentPlanData = mLoginData2 != null ? mLoginData2.getPaymentPlanData() : null;
                    Intrinsics.e(paymentPlanData);
                    v.navigateToPaymentFlow(paymentPlanData);
                }
            }
            C1830p c1830p6 = this.activeFragment;
            Intrinsics.f(c1830p6, "null cannot be cast to non-null type com.vlv.aravali.payments.legacy.ui.fragment.SubscriptionFragment");
            ((V) c1830p6).setAndLoadWebView();
        }
    }

    private final void openAppropriatePage() {
        User.PageInfo pageInfo;
        Ai.p pVar = KukuFMApplication.x;
        User t = io.sentry.config.d.t(pVar);
        if (t == null || (pageInfo = t.getPageInfo()) == null) {
            initNetworkCalls();
            return;
        }
        User.PageType pageType = pageInfo.getPageType();
        int i = pageType == null ? -1 : K.b[pageType.ordinal()];
        if (i == -1) {
            initNetworkCalls();
            return;
        }
        if (i == 1) {
            openSubscriptionPage(Build.VERSION.SDK_INT >= 28 ? pageInfo.getPageUrl() : "https://kukufm.com/subscription/");
            return;
        }
        if (i != 2) {
            throw new mp.q();
        }
        String pageUrl = pageInfo.getPageUrl();
        if (pageUrl == null || pageUrl.length() == 0 || Build.VERSION.SDK_INT < 28) {
            initNetworkCalls();
            return;
        }
        r rVar = PremiumFragmentV2.Companion;
        String pageUrl2 = pageInfo.getPageUrl();
        SubscriptionMeta subscriptionMeta = this.subscriptionMeta;
        rVar.getClass();
        PremiumFragmentV2 a = r.a(pageUrl2, subscriptionMeta);
        this.activeFragment = a;
        j0 childFragmentManager = getChildFragmentManager();
        Intrinsics.checkNotNullExpressionValue(childFragmentManager, "getChildFragmentManager(...)");
        Intrinsics.checkNotNullParameter(childFragmentManager, "fragmentManager");
        Intrinsics.checkNotNullParameter(a, "fragment");
        Intrinsics.checkNotNullParameter(PremiumFragmentV2.TAG, "tag");
        childFragmentManager.getClass();
        androidx.fragment.app.a aVar = new androidx.fragment.app.a(childFragmentManager);
        Intrinsics.checkNotNullExpressionValue(aVar, "beginTransaction(...)");
        ((w0) aVar).h = 4099;
        aVar.g(2131362584, a, PremiumFragmentV2.TAG);
        aVar.l(true, true);
        pVar.B().d().l("web_premium_page_viewed").d();
    }

    public final void openPremiumPage(PremiumPageData premiumPageData) {
        String str;
        if (premiumPageData == null) {
            r rVar = PremiumFragmentV2.Companion;
            SubscriptionMeta subscriptionMeta = this.subscriptionMeta;
            rVar.getClass();
            PremiumFragmentV2 a = r.a(null, subscriptionMeta);
            this.activeFragment = a;
            j0 childFragmentManager = getChildFragmentManager();
            Intrinsics.checkNotNullExpressionValue(childFragmentManager, "getChildFragmentManager(...)");
            Intrinsics.checkNotNullParameter(childFragmentManager, "fragmentManager");
            Intrinsics.checkNotNullParameter(a, "fragment");
            Intrinsics.checkNotNullParameter(PremiumFragmentV2.TAG, "tag");
            childFragmentManager.getClass();
            androidx.fragment.app.a aVar = new androidx.fragment.app.a(childFragmentManager);
            Intrinsics.checkNotNullExpressionValue(aVar, "beginTransaction(...)");
            ((w0) aVar).h = 4099;
            aVar.g(2131362584, a, PremiumFragmentV2.TAG);
            aVar.l(true, true);
            androidx.datastore.preferences.protobuf.o.r(KukuFMApplication.x, "web_premium_page_viewed");
            return;
        }
        C1511k c1511k = PremiumFragment.Companion;
        SubscriptionMeta subscriptionMeta2 = this.subscriptionMeta;
        c1511k.getClass();
        PremiumFragment a2 = C1511k.a(premiumPageData, subscriptionMeta2);
        this.activeFragment = a2;
        j0 childFragmentManager2 = getChildFragmentManager();
        Intrinsics.checkNotNullExpressionValue(childFragmentManager2, "getChildFragmentManager(...)");
        str = PremiumFragment.TAG;
        Intrinsics.checkNotNullParameter(childFragmentManager2, "fragmentManager");
        Intrinsics.checkNotNullParameter(a2, "fragment");
        Intrinsics.checkNotNullParameter(str, "tag");
        childFragmentManager2.getClass();
        androidx.fragment.app.a aVar2 = new androidx.fragment.app.a(childFragmentManager2);
        Intrinsics.checkNotNullExpressionValue(aVar2, "beginTransaction(...)");
        ((w0) aVar2).h = 4099;
        aVar2.g(2131362584, a2, str);
        aVar2.l(true, true);
        androidx.datastore.preferences.protobuf.o.r(KukuFMApplication.x, "native_premium_page_viewed");
    }

    public final void openSubscriptionPage(String str) {
        String str2;
        FreeTrialResponse freeTrialResponse = Qn.e.k;
        if (freeTrialResponse != null && freeTrialResponse.getEnableFreeTrial()) {
            FreeTrialResponse freeTrialResponse2 = Qn.e.k;
            if (freeTrialResponse2 != null ? Intrinsics.c(freeTrialResponse2.getShowNativeScreen(), Boolean.TRUE) : false) {
                Bundle bundle = new Bundle();
                SubscriptionMeta subscriptionMeta = this.subscriptionMeta;
                bundle.putString("source", subscriptionMeta != null ? subscriptionMeta.getSource() : null);
                bundle.putSerializable("subscription_meta", this.subscriptionMeta);
                bundle.putBoolean("can_dismiss", false);
                FreeTrialResponse freeTrialResponse3 = Qn.e.k;
                if (Intrinsics.c(freeTrialResponse3 != null ? freeTrialResponse3.getFtScreenType() : null, "vertical_video")) {
                    C1237i c1237i = com.vlv.aravali.freeTrial.A.Companion;
                    SubscriptionMeta subscriptionMeta2 = this.subscriptionMeta;
                    c1237i.getClass();
                    com.vlv.aravali.freeTrial.A a = C1237i.a(subscriptionMeta2);
                    this.activeFragment = a;
                    j0 childFragmentManager = getChildFragmentManager();
                    Intrinsics.checkNotNullExpressionValue(childFragmentManager, "getChildFragmentManager(...)");
                    Intrinsics.checkNotNullParameter(childFragmentManager, "fragmentManager");
                    Intrinsics.checkNotNullParameter(a, "fragment");
                    Intrinsics.checkNotNullParameter(com.vlv.aravali.freeTrial.A.TAG, "tag");
                    childFragmentManager.getClass();
                    androidx.fragment.app.a aVar = new androidx.fragment.app.a(childFragmentManager);
                    Intrinsics.checkNotNullExpressionValue(aVar, "beginTransaction(...)");
                    ((w0) aVar).h = 4099;
                    aVar.g(2131362584, a, com.vlv.aravali.freeTrial.A.TAG);
                    aVar.l(true, true);
                } else {
                    k0.Companion.getClass();
                    k0 k0Var = new k0();
                    k0Var.setArguments(bundle);
                    this.activeFragment = k0Var;
                    j0 childFragmentManager2 = getChildFragmentManager();
                    Intrinsics.checkNotNullExpressionValue(childFragmentManager2, "getChildFragmentManager(...)");
                    Intrinsics.checkNotNullParameter(childFragmentManager2, "fragmentManager");
                    Intrinsics.checkNotNullParameter(k0Var, "fragment");
                    Intrinsics.checkNotNullParameter(k0.TAG, "tag");
                    childFragmentManager2.getClass();
                    androidx.fragment.app.a aVar2 = new androidx.fragment.app.a(childFragmentManager2);
                    Intrinsics.checkNotNullExpressionValue(aVar2, "beginTransaction(...)");
                    ((w0) aVar2).h = 4099;
                    aVar2.g(2131362584, k0Var, k0.TAG);
                    aVar2.l(true, true);
                }
                hideLoader();
                return;
            }
        }
        com.vlv.aravali.payments.legacy.ui.fragment.K k = V.Companion;
        SubscriptionMeta subscriptionMeta3 = this.subscriptionMeta;
        k.getClass();
        V v = new V();
        Bundle bundle2 = new Bundle();
        bundle2.putSerializable("subscription_meta", subscriptionMeta3);
        bundle2.putString("subscription_url", str);
        v.setArguments(bundle2);
        this.activeFragment = v;
        j0 childFragmentManager3 = getChildFragmentManager();
        Intrinsics.checkNotNullExpressionValue(childFragmentManager3, "getChildFragmentManager(...)");
        str2 = V.TAG;
        Intrinsics.checkNotNullParameter(childFragmentManager3, "fragmentManager");
        Intrinsics.checkNotNullParameter(v, "fragment");
        Intrinsics.checkNotNullParameter(str2, "tag");
        childFragmentManager3.getClass();
        androidx.fragment.app.a aVar3 = new androidx.fragment.app.a(childFragmentManager3);
        Intrinsics.checkNotNullExpressionValue(aVar3, "beginTransaction(...)");
        ((w0) aVar3).h = 4099;
        aVar3.g(2131362584, v, str2);
        aVar3.l(true, true);
    }

    private final void refreshPage() {
        showLoader();
        openAppropriatePage();
    }

    public final void showErrorState(String str) {
        UIComponentNewErrorStates uIComponentNewErrorStates;
        Bi.k r = io.sentry.config.d.r(KukuFMApplication.x, "premium_page_error");
        r.c(String.valueOf(str), "error_message");
        r.d();
        AbstractC0688vf binding = getBinding();
        if (binding != null && (uIComponentNewErrorStates = binding.L) != null) {
            uIComponentNewErrorStates.setVisibility(0);
            Context context = uIComponentNewErrorStates.getContext();
            String string = context != null ? context.getString(2132018564) : null;
            Context context2 = uIComponentNewErrorStates.getContext();
            UIComponentNewErrorStates.setData$default(uIComponentNewErrorStates, string, str, context2 != null ? context2.getString(2132018437) : null, 0, false, 8, null);
            uIComponentNewErrorStates.setListener(new Z6.k(this, 23));
        }
        hideLoader();
    }

    private final void showLoader() {
        FrameLayout frameLayout;
        AbstractC0688vf binding = getBinding();
        if (binding == null || (frameLayout = binding.Q) == null) {
            return;
        }
        frameLayout.setVisibility(0);
    }

    private final void updateUIForBottomPlayer() {
        if (getActivity() instanceof MasterActivity) {
            MasterActivity activity = getActivity();
            Intrinsics.f(activity, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
            activity.hideRating();
            MasterActivity activity2 = getActivity();
            Intrinsics.f(activity2, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
            if (activity2.isRatingPopupVisible()) {
                this.wasRatingVisible = true;
            }
        }
    }

    public final im.t getVm() {
        return (im.t) this.vm$delegate.getValue();
    }

    public final void hideLoader() {
        FrameLayout frameLayout;
        AbstractC0688vf binding = getBinding();
        if (binding == null || (frameLayout = binding.Q) == null) {
            return;
        }
        frameLayout.setVisibility(8);
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        C1830p c1830p = this.activeFragment;
        if (c1830p != null) {
            c1830p.onActivityResult(i, i2, (Intent) null);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.appDisposable.b();
    }

    public final void onNetworkConnectionChanged() {
        UIComponentNewErrorStates uIComponentNewErrorStates;
        Context requireContext = requireContext();
        Intrinsics.checkNotNullExpressionValue(requireContext, "requireContext(...)");
        if (!new ml.a(requireContext).b()) {
            ArrayList arrayList = Qn.e.a;
            Context requireContext2 = requireContext();
            Intrinsics.checkNotNullExpressionValue(requireContext2, "requireContext(...)");
            showErrorState(Qn.e.w(2132018158, requireContext2, KukuFMApplication.x.B().h().e().getCode(), (String) null));
            return;
        }
        AbstractC0688vf binding = getBinding();
        if (binding != null && (uIComponentNewErrorStates = binding.L) != null) {
            uIComponentNewErrorStates.setVisibility(8);
        }
        refreshPage();
    }

    @Override
    public void onResume() {
        super.onResume();
        updateUIForBottomPlayer();
        FragmentActivity activity = getActivity();
        if (activity != null) {
            ArrayList arrayList = Qn.e.a;
            Qn.e.O(false, activity);
        }
        if (getActivity() instanceof MasterActivity) {
            SubscriptionMeta subscriptionMeta = this.subscriptionMeta;
            if (subscriptionMeta != null ? Intrinsics.c(subscriptionMeta.isFromFreeTrial(), Boolean.TRUE) : false) {
                return;
            }
            FreeTrialResponse freeTrialResponse = Qn.e.k;
            if (Intrinsics.c(freeTrialResponse != null ? freeTrialResponse.getFtScreenType() : null, "vertical_video")) {
                return;
            }
            MasterActivity activity2 = getActivity();
            Intrinsics.f(activity2, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
            MasterActivity masterActivity = activity2;
            MasterActivity activity3 = getActivity();
            Intrinsics.f(activity3, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
            UserResponse userResponse = activity3.getUserResponse();
            masterActivity.setUnsetSaleRibbon(false, userResponse != null ? userResponse.getDiscountRibbonData() : null);
        }
    }

    public void onStop() {
        super.onStop();
        SubscriptionMeta subscriptionMeta = this.subscriptionMeta;
        if (!(subscriptionMeta != null ? Intrinsics.c(subscriptionMeta.isFromFreeTrial(), Boolean.TRUE) : false)) {
            ArrayList arrayList = Qn.e.a;
            FreeTrialResponse freeTrialResponse = Qn.e.k;
            if (!Intrinsics.c(freeTrialResponse != null ? freeTrialResponse.getFtScreenType() : null, "vertical_video") && (getActivity() instanceof MasterActivity)) {
                MasterActivity activity = getActivity();
                Intrinsics.f(activity, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
                MasterActivity masterActivity = activity;
                User t = io.sentry.config.d.t(KukuFMApplication.x);
                boolean showStickyRibbon = t != null ? t.getShowStickyRibbon() : false;
                MasterActivity activity2 = getActivity();
                Intrinsics.f(activity2, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
                UserResponse userResponse = activity2.getUserResponse();
                masterActivity.setUnsetSaleRibbon(showStickyRibbon, userResponse != null ? userResponse.getDiscountRibbonData() : null);
            }
        }
        if (this.wasRatingVisible && (getActivity() instanceof MasterActivity)) {
            this.wasRatingVisible = false;
            MasterActivity activity3 = getActivity();
            Intrinsics.f(activity3, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
            activity3.showRatingPopupAgain();
        }
    }

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        Intrinsics.checkNotNullParameter(view, "view");
        super.onViewCreated(view, bundle);
        initObservers();
        if (this.activeFragment == null) {
            openAppropriatePage();
        } else {
            hideLoader();
        }
        Context requireContext = requireContext();
        Intrinsics.checkNotNullExpressionValue(requireContext, "requireContext(...)");
        if (new ml.a(requireContext).b()) {
            return;
        }
        ArrayList arrayList = Qn.e.a;
        Context requireContext2 = requireContext();
        Intrinsics.checkNotNullExpressionValue(requireContext2, "requireContext(...)");
        showErrorState(Qn.e.w(2132018158, requireContext2, KukuFMApplication.x.B().h().e().getCode(), (String) null));
    }
}