导航菜单

页面标题

页面副标题

Bhakti v5.4.0 - WebFragment.java 源代码

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

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


package com.vlv.aravali.commonFeatures.web;

import Af.c;
import Bk.C;
import Cj.t;
import Hm.r;
import I5.g;
import Jj.a;
import Jj.b;
import Jj.d;
import Jj.h;
import Jj.i;
import Jj.k;
import Jj.l;
import Jj.n;
import Jj.o;
import Jj.p;
import Kp.V;
import Qn.AbstractC0210b;
import Qn.e;
import Qp.m;
import Sp.f;
import Vj.kj;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.webkit.CookieManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.databinding.DataBinderMapperImpl;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.B;
import androidx.lifecycle.G;
import androidx.lifecycle.i0;
import com.vlv.aravali.KukuFMApplication;
import com.vlv.aravali.coins.data.responses.EventInfo;
import com.vlv.aravali.common.models.User;
import com.vlv.aravali.common.models.user.UserResponse;
import com.vlv.aravali.master.ui.MasterActivity;
import com.vlv.aravali.model.EventData;
import com.vlv.aravali.payments.common.data.SubscriptionMeta;
import com.vlv.aravali.premium.PremiumTabParentActivity;
import com.vlv.aravali.views.fragments.C1830p;
import com.vlv.aravali.views.widgets.UIComponentNewErrorStates;
import in.juspay.hyper.constants.LogSubCategory;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jj.AbstractC2062a;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.I;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.J;
import kotlin.text.StringsKt;
import org.json.JSONObject;
import v4.j;

@Metadata
public final class WebFragment extends C1830p {
    public static final int $stable = 8;
    private final j arguments$delegate;
    private String currentUrl;
    private final Map<String, String> customHeaders;
    private String finalUrlBeforeDeeplink;
    private String mBaseUrl;
    private kj mBinding;
    private boolean showBackButton;
    private boolean showToolbar;
    private String utmSource;
    private boolean wasRatingVisible;

    public WebFragment() {
        super(2131558708);
        this.customHeaders = new HashMap();
        this.utmSource = "";
        this.finalUrlBeforeDeeplink = "";
        this.arguments$delegate = new j(J.a(o.class), new t(this, 4));
    }

    private final o getArguments() {
        return (o) this.arguments$delegate.getValue();
    }

    private final void initWebView() {
        kj kjVar = this.mBinding;
        if (kjVar != null) {
            WebView webView = kjVar.i0;
            WebSettings settings = webView.getSettings();
            settings.setDomStorageEnabled(true);
            settings.setJavaScriptEnabled(true);
            settings.setDatabaseEnabled(true);
            settings.setAllowFileAccess(true);
            settings.setAllowContentAccess(true);
            settings.setJavaScriptCanOpenWindowsAutomatically(true);
            settings.setUserAgentString(settings.getUserAgentString() + "KukuFMWebView");
            Intrinsics.checkNotNullParameter(this, "fragment");
            p pVar = new p();
            pVar.a = this;
            webView.addJavascriptInterface(pVar, LogSubCategory.LifeCycle.ANDROID);
            WebView.setWebContentsDebuggingEnabled(false);
            webView.setWebViewClient(new C(this, 1));
            webView.setWebChromeClient(new d(0, kjVar, this));
        }
    }

    public final void openViaDeeplink(String str) {
        try {
            ui(new c(20, this, str));
        } catch (Exception e) {
            xq.d.a.a(Ai.o.h("Invalid uri : ", e.getMessage()), new Object[0]);
        }
    }

    public static final Unit openViaDeeplink$lambda$20(WebFragment webFragment, String str) {
        if (webFragment.getActivity() instanceof MasterActivity) {
            if (Intrinsics.c(str, "app://kukufm/home")) {
                MasterActivity activity = webFragment.getActivity();
                Intrinsics.f(activity, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
                activity.navigateToHome();
            } else {
                MasterActivity activity2 = webFragment.getActivity();
                Intrinsics.f(activity2, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
                Uri parse = Uri.parse(str);
                Intrinsics.checkNotNullExpressionValue(parse, "parse(...)");
                MasterActivity.openedViaDeepLink$default(activity2, parse, null, null, new EventData("store_tab", null, "store_tab", null, null, null, null, null, null, false, null, null, false, null, null, null, null, null, null, null, null, null, false, 8388602, null), 6, null);
            }
        } else if (webFragment.getActivity() instanceof PremiumTabParentActivity) {
            PremiumTabParentActivity activity3 = webFragment.getActivity();
            Intrinsics.f(activity3, "null cannot be cast to non-null type com.vlv.aravali.premium.PremiumTabParentActivity");
            activity3.openViaUri(str);
        }
        return Unit.a;
    }

    public static final Unit reloadPage$lambda$19$lambda$18(WebFragment webFragment, CookieManager cookieManager, String str) {
        if (str != null && str.length() != 0) {
            G viewLifecycleOwner = webFragment.getViewLifecycleOwner();
            Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
            B i = i0.i(viewLifecycleOwner);
            f fVar = V.a;
            Kp.p.w(i, m.a, (Kp.J) null, new l(cookieManager, str, webFragment, null), 2);
        } else if (KukuFMApplication.x.B().e().e != null) {
            G viewLifecycleOwner2 = webFragment.getViewLifecycleOwner();
            Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
            B i2 = i0.i(viewLifecycleOwner2);
            f fVar2 = V.a;
            Kp.p.w(i2, m.a, (Kp.J) null, new Jj.m(cookieManager, str, webFragment, null), 2);
        }
        return Unit.a;
    }

    private final void setAndLoadWebView() {
        String str;
        String source;
        List<String> pathSegments;
        int i = 1;
        CookieManager cookieManager = CookieManager.getInstance();
        Ai.p pVar = KukuFMApplication.x;
        User t = io.sentry.config.d.t(pVar);
        ArrayList arrayList = e.a;
        Uri uri = e.c;
        this.utmSource = uri != null ? uri.getQueryParameter("utm_source") : null;
        xq.d.a.a(AbstractC0210b.m(uri, "Util Link Subs: "), new Object[0]);
        String slug = pVar.B().h().e().getSlug();
        I i2 = new I();
        String str2 = this.mBaseUrl;
        if (str2 == null) {
            str2 = "https://subscription.kukufm.com/renewal/";
        }
        String e = j.e.e(str2, slug);
        i2.a = e;
        String str3 = ((Object) e) + "?buildNumber=" + AbstractC2062a.a;
        i2.a = str3;
        this.finalUrlBeforeDeeplink = str3;
        if (uri != null && (pathSegments = uri.getPathSegments()) != null && pathSegments.contains(com.vlv.aravali.payments.legacy.ui.fragment.V.PATH_SUBSCRIPTION)) {
            i2.a = i2.a + "&deeplinkUrl=" + URLEncoder.encode(uri.toString(), "UTF-8");
        }
        String str4 = this.utmSource;
        if (str4 != null && str4.length() > 0) {
            i2.a = i2.a + "&utmSource=" + this.utmSource;
        }
        SubscriptionMeta subscriptionMeta = getArguments().a;
        if (subscriptionMeta != null && (source = subscriptionMeta.getSource()) != null && source.length() > 0) {
            Object obj = i2.a;
            SubscriptionMeta subscriptionMeta2 = getArguments().a;
            i2.a = obj + "&source=" + (subscriptionMeta2 != null ? subscriptionMeta2.getSource() : null);
        }
        FragmentActivity activity = getActivity();
        if (activity != null) {
            String str5 = i2.a + "&isPhonePeAppAvailable=" + e.I(activity, "com.phonepe.app");
            i2.a = str5;
            i2.a = ((Object) str5) + "&isPaytmAppAvailable=" + e.I(activity, "net.one97.paytm");
        }
        Object obj2 = i2.a;
        if (t == null || (str = t.getName()) == null) {
            str = "";
        }
        i2.a = obj2 + "&userName=" + URLEncoder.encode(str, "UTF-8");
        cookieManager.setCookie("https://kukufm.com/", "KukufmWebview=true; path=/; domain=.kukufm.com");
        cookieManager.setCookie("https://kukufm.com/", "AppName=com.vlv.aravali.bhakti; path=/; domain=.kukufm.com");
        String str6 = pVar.B().e().e;
        if (str6 != null) {
            ui(new a(this, str6, cookieManager, i2, 1));
        } else {
            pVar.B().e().c(new r(this, cookieManager, i2, i));
        }
        getLogs();
    }

    public static final Unit setAndLoadWebView$lambda$13$lambda$12(WebFragment webFragment, CookieManager cookieManager, I i, String str) {
        if (str == null || str.length() == 0) {
            String str2 = KukuFMApplication.x.B().e().e;
            if (str2 != null) {
                webFragment.ui(new b((Object) webFragment, str2, cookieManager, (Object) str, (Object) i, 0));
            }
        } else {
            webFragment.ui(new a(webFragment, str, cookieManager, i, 0));
        }
        return Unit.a;
    }

    public static final Unit setAndLoadWebView$lambda$13$lambda$12$lambda$11$lambda$10(WebFragment webFragment, String str, CookieManager cookieManager, String str2, I i) {
        WebView webView;
        webFragment.customHeaders.put("Authorization", "Bearer " + str);
        cookieManager.setCookie("https://kukufm.com/", "firebaseToken=" + str2 + "; path=/; domain=.kukufm.com");
        String str3 = webFragment.currentUrl;
        if (str3 == null || !Intrinsics.c(str3, i.a)) {
            String str4 = (String) i.a;
            webFragment.currentUrl = str4;
            kj kjVar = webFragment.mBinding;
            if (kjVar != null && (webView = kjVar.i0) != null) {
                if (str4 == null) {
                    str4 = "";
                }
                webView.loadUrl(str4, webFragment.customHeaders);
            }
        }
        return Unit.a;
    }

    public static final Unit setAndLoadWebView$lambda$13$lambda$12$lambda$9(WebFragment webFragment, String str, CookieManager cookieManager, I i) {
        WebView webView;
        webFragment.customHeaders.put("Authorization", "jwt " + str);
        cookieManager.setCookie("https://kukufm.com/", "jwtToken=" + str + "; path=/; domain=.kukufm.com");
        String str2 = webFragment.currentUrl;
        if (str2 == null || !Intrinsics.c(str2, i.a)) {
            String str3 = (String) i.a;
            webFragment.currentUrl = str3;
            kj kjVar = webFragment.mBinding;
            if (kjVar != null && (webView = kjVar.i0) != null) {
                if (str3 == null) {
                    str3 = "";
                }
                webView.loadUrl(str3, webFragment.customHeaders);
            }
        }
        return Unit.a;
    }

    public static final Unit setAndLoadWebView$lambda$8$lambda$7(WebFragment webFragment, String str, CookieManager cookieManager, I i) {
        WebView webView;
        webFragment.customHeaders.put("Authorization", "Bearer " + str);
        cookieManager.setCookie("https://kukufm.com/", "firebaseToken=" + str + "; path=/; domain=.kukufm.com");
        String str2 = webFragment.currentUrl;
        if (str2 == null || !Intrinsics.c(str2, i.a)) {
            String str3 = (String) i.a;
            webFragment.currentUrl = str3;
            kj kjVar = webFragment.mBinding;
            if (kjVar != null && (webView = kjVar.i0) != null) {
                if (str3 == null) {
                    str3 = "";
                }
                webView.loadUrl(str3, webFragment.customHeaders);
            }
        }
        return Unit.a;
    }

    private final void showNoInternetView() {
        kj kjVar = this.mBinding;
        if (kjVar != null) {
            UIComponentNewErrorStates uIComponentNewErrorStates = kjVar.M;
            uIComponentNewErrorStates.setVisibility(0);
            kjVar.i0.setVisibility(8);
            uIComponentNewErrorStates.setListener(new u6.c(this, 12));
        }
    }

    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");
            if (activity.isRatingPopupVisible()) {
                this.wasRatingVisible = true;
                MasterActivity activity2 = getActivity();
                Intrinsics.f(activity2, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
                activity2.hideRating();
            }
        }
    }

    public final void onBackPressed() {
        WebView webView;
        WebView webView2;
        kj kjVar = this.mBinding;
        if (kjVar == null || (webView = kjVar.i0) == null || !webView.canGoBack()) {
            g.U(this);
            return;
        }
        kj kjVar2 = this.mBinding;
        if (kjVar2 == null || (webView2 = kjVar2.i0) == null) {
            return;
        }
        webView2.goBack();
    }

    public final void onBackPressedOnWeb() {
        G viewLifecycleOwner = getViewLifecycleOwner();
        Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        Kp.p.w(i0.i(viewLifecycleOwner), (CoroutineContext) null, (Kp.J) null, new Jj.e(this, null), 3);
    }

    @Override
    public void onCreate(Bundle bundle) {
        String str;
        String str2;
        User t;
        String chatUrl;
        super.onCreate(bundle);
        if (getArguments().b != null || (((str2 = getArguments().b) == null || !StringsKt.y(str2, "chatbot", false)) && ((t = io.sentry.config.d.t(KukuFMApplication.x)) == null || (chatUrl = t.getChatUrl()) == null || !StringsKt.y(chatUrl, "bot", false)))) {
            str = getArguments().b;
        } else {
            str = getArguments().b;
            if (str == null) {
                User t2 = io.sentry.config.d.t(KukuFMApplication.x);
                str = t2 != null ? t2.getChatUrl() : null;
            }
        }
        this.mBaseUrl = str;
        this.showToolbar = getArguments().c;
        this.showBackButton = getArguments().d;
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        Intrinsics.checkNotNullParameter(layoutInflater, "inflater");
        if (this.mBinding == null) {
            int i = kj.j0;
            DataBinderMapperImpl dataBinderMapperImpl = x2.e.a;
            this.mBinding = (kj) x2.m.k(layoutInflater, 2131558708, viewGroup, false, (Object) null);
        }
        kj kjVar = this.mBinding;
        if (kjVar != null) {
            return ((x2.m) kjVar).d;
        }
        return null;
    }

    public void onPause() {
        super.onPause();
        if (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 onResume() {
        super.onResume();
        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");
            MasterActivity masterActivity = activity;
            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(false, userResponse != null ? userResponse.getDiscountRibbonData() : null);
        }
        FragmentActivity activity3 = getActivity();
        if (activity3 != null) {
            ArrayList arrayList = e.a;
            e.O(false, activity3);
        }
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        WebView webView;
        Intrinsics.checkNotNullParameter(bundle, "outState");
        super.onSaveInstanceState(bundle);
        kj kjVar = this.mBinding;
        if (kjVar == null || (webView = kjVar.i0) == null) {
            return;
        }
        webView.saveState(bundle);
    }

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        String event;
        Window window;
        Intrinsics.checkNotNullParameter(view, "view");
        super.onViewCreated(view, bundle);
        FragmentActivity activity = getActivity();
        if (activity != null && (window = activity.getWindow()) != null) {
            window.setSoftInputMode(16);
        }
        SubscriptionMeta subscriptionMeta = getArguments().a;
        if (subscriptionMeta != null && (event = subscriptionMeta.getEvent()) != null) {
            androidx.datastore.preferences.protobuf.o.r(KukuFMApplication.x, event);
        }
        kj kjVar = this.mBinding;
        if (kjVar != null) {
            Context context = getContext();
            if (context != null) {
                kjVar.i0.setBackgroundColor(context.getColor(2131100579));
            }
            boolean z = this.showToolbar;
            ?? r2 = kjVar.Z;
            if (z) {
                if (!this.showBackButton) {
                    r2.setNavigationIcon((Drawable) null);
                }
                r2.setTitle(String.valueOf(getArguments().e));
                r2.setNavigationOnClickListener(new Gj.a(this, 4));
                Intrinsics.checkNotNullExpressionValue((Object) r2, "toolbar");
                String str = getArguments().e;
                r2.setVisibility(((str != null && (StringsKt.H(str) ^ true)) || this.showBackButton) ? 0 : 8);
                kjVar.Y.setVisibility(0);
                if (getActivity() instanceof MasterActivity) {
                    MasterActivity activity2 = getActivity();
                    Intrinsics.f(activity2, "null cannot be cast to non-null type com.vlv.aravali.master.ui.MasterActivity");
                    activity2.showHideDiscountRibbon(false);
                }
            } else {
                r2.setVisibility(8);
            }
        }
        initWebView();
        if (!Ai.o.D(KukuFMApplication.x)) {
            showNoInternetView();
        }
        G viewLifecycleOwner = getViewLifecycleOwner();
        Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        Kp.p.w(i0.i(viewLifecycleOwner), (CoroutineContext) null, (Kp.J) null, new Jj.g(this, null), 3);
    }

    public void onViewStateRestored(Bundle bundle) {
        WebView webView;
        super.onViewStateRestored(bundle);
        if (bundle == null) {
            setAndLoadWebView();
            return;
        }
        kj kjVar = this.mBinding;
        if (kjVar == null || (webView = kjVar.i0) == null) {
            return;
        }
        webView.restoreState(bundle);
    }

    public final void openExternalLink(EventInfo eventInfo, String str) {
        Intrinsics.checkNotNullParameter(eventInfo, "eventInfo");
        Intrinsics.checkNotNullParameter(str, "jsonString");
        G viewLifecycleOwner = getViewLifecycleOwner();
        Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        Kp.p.w(i0.i(viewLifecycleOwner), (CoroutineContext) null, (Kp.J) null, new h(eventInfo, this, str, null), 3);
    }

    public final void openInternalLink(EventInfo eventInfo) {
        Intrinsics.checkNotNullParameter(eventInfo, "eventInfo");
        G viewLifecycleOwner = getViewLifecycleOwner();
        Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        Kp.p.w(i0.i(viewLifecycleOwner), (CoroutineContext) null, (Kp.J) null, new i(eventInfo, this, null), 3);
    }

    public final void openStorePage() {
        G viewLifecycleOwner = getViewLifecycleOwner();
        Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        Kp.p.w(i0.i(viewLifecycleOwner), (CoroutineContext) null, (Kp.J) null, new Jj.j(this, null), 3);
    }

    public final void reloadPage() {
        Ai.p pVar = KukuFMApplication.x;
        pVar.B().d().l("premium_page_token_expired").d();
        CookieManager cookieManager = CookieManager.getInstance();
        String str = pVar.B().e().e;
        if (str != null) {
            G viewLifecycleOwner = getViewLifecycleOwner();
            Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
            Kp.p.w(i0.i(viewLifecycleOwner), m.a, (Kp.J) null, new k(cookieManager, str, this, null), 2);
        } else {
            if (getView() != null) {
                pVar.B().e().c(new Bf.g(22, this, cookieManager));
            }
            Unit unit = Unit.a;
        }
    }

    public final void sendCustomEventLog(String str) {
        Intrinsics.checkNotNullParameter(str, "jsonString");
        G viewLifecycleOwner = getViewLifecycleOwner();
        Intrinsics.checkNotNullExpressionValue(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        B i = i0.i(viewLifecycleOwner);
        f fVar = V.a;
        Kp.p.w(i, Sp.e.c, (Kp.J) null, new n(str, null), 2);
    }

    public final void sendEvent(String str, String str2) {
        String source;
        Intrinsics.checkNotNullParameter(str, "eventName");
        try {
            Bi.k l = KukuFMApplication.x.B().d().l(str);
            String str3 = "";
            if (str2 == null) {
                str2 = "";
            }
            JSONObject jSONObject = new JSONObject(str2);
            ArrayList arrayList = e.a;
            l.a(e.d(jSONObject));
            String str4 = this.utmSource;
            if (str4 == null) {
                str4 = "";
            }
            l.c(str4, "utm_source");
            SubscriptionMeta subscriptionMeta = getArguments().a;
            if (subscriptionMeta != null && (source = subscriptionMeta.getSource()) != null) {
                str3 = source;
            }
            l.c(str3, "source_android");
            l.d();
        } catch (Exception unused) {
            androidx.datastore.preferences.protobuf.o.r(KukuFMApplication.x, "send_event_exception");
        }
    }
}