导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - WebAppActivity.java 源代码

正在查看: Hopscotch v9.7.2 应用的 WebAppActivity.java JAVA 源代码文件

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


package in.hopscotch.android.ui.webapp;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.RelativeLayout;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.clevertap.android.sdk.d1;
import com.clevertap.android.sdk.u;
import com.google.firebase.perf.metrics.Trace;
import in.hopscotch.android.activity.customerinfo.LoginActivity;
import in.hopscotch.android.application.HsApplication;
import in.hopscotch.android.common.helper.b;
import in.hopscotch.android.common.util.t;
import in.hopscotch.android.common.util.x;
import in.hopscotch.android.components.util.o;
import in.hopscotch.android.core.model.OrderAttributionData;
import in.hopscotch.android.core.webapp.WebviewJavascriptException;
import in.hopscotch.android.core.webapp.b;
import in.hopscotch.android.databinding.u2;
import in.hopscotch.android.fragment.a0;
import in.hopscotch.android.model.UserStatus;
import in.hopscotch.android.notificationnudge.model.NotificationNudge;
import in.juspay.hyper.constants.LogCategory;
import in.juspay.hyper.constants.LogSubCategory;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.collections.s0;
import kotlin.coroutines.jvm.internal.j;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.r;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Dispatchers;
import org.jetbrains.annotations.NotNull;

@Metadata
@SourceDebugExtension({"SMAP\nWebAppActivity.kt\nKotlin\n*S Kotlin\n*F\n+ 1 WebAppActivity.kt\nin/hopscotch/android/ui/webapp/WebAppActivity\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,913:1\n1726#2,3:914\n*S KotlinDebug\n*F\n+ 1 WebAppActivity.kt\nin/hopscotch/android/ui/webapp/WebAppActivity\n*L\n175#1:914,3\n*E\n"})
public final class WebAppActivity extends in.hopscotch.android.ui.webapp.b implements in.hopscotch.android.core.webapp.repository.e, in.hopscotch.android.core.webapp.repository.b, d1 {

    @NotNull
    private static final String SCREEN = "WISH_LIST";

    @NotNull
    private static final String WEB_APP_INTERFACE = "AndroidWebViewInterface";

    @NotNull
    private static final String WISHLIST = "wishlist";

    @NotNull
    public static final a q = new a(null);
    private boolean addAttributionData;
    private boolean addClickTrackingData;
    private u2 binding;
    private String clickTypeForScreen;
    private String dynamicContentType;
    private boolean firstLoad;
    private String fromLocation;
    private String fromScreen;
    private boolean hasDynamicContent;
    public in.hopscotch.android.core.webapp.js.b i;
    private boolean isExternalAction;
    public in.hopscotch.android.core.webapp.repository.a j;
    public in.hopscotch.android.core.webapp.a k;
    private boolean keepAttributionData;
    private boolean keepUniversalData;
    public in.hopscotch.android.core.webapp.repository.c l;
    public in.hopscotch.android.core.repository.a m;
    public in.hopscotch.android.core.webapp.store.b n;
    public in.hopscotch.android.core.providers.d o;
    private OrderAttributionData orderAttributionData;
    public in.hopscotch.android.core.util.d p;
    private boolean passCartQty;
    private boolean refreshOnDestroy;
    private boolean safeBrowsingInitialized;
    private boolean stateChanged;
    private in.hopscotch.android.core.webapp.model.g webAppLoginData;
    private String webUrl;
    private Trace webViewLoadTrace;

    @NotNull
    private final String screenId = in.hopscotch.android.common.util.e.a();

    @NotNull
    private Map<String, Object> wishListNudgeMap = new LinkedHashMap();

    @NotNull
    private final androidx.activity.result.b<Intent> loginResultLauncher = registerForActivityResult(new androidx.activity.result.contract.e(), new a0(this, 4));

    public static final class a {
        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        @NotNull
        public static Intent a(@NotNull Context context, @NotNull String webUrl, String str, String str2, boolean z, boolean z2, boolean z3, boolean z4, String str3, boolean z5, String str4) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intrinsics.checkNotNullParameter(webUrl, "webUrl");
            Intent intent = new Intent(context, (Class<?>) WebAppActivity.class);
            intent.putExtra("FROM_SCREEN", str);
            intent.putExtra("from_location", str2);
            intent.putExtra("WEB_URL", webUrl);
            intent.putExtra("refreshOnDestroy", z);
            intent.putExtra("keepAttributionData", true);
            intent.putExtra("keepUniversalData", true);
            intent.putExtra("passCartQty", z2);
            intent.putExtra("addAttributionData", z3);
            intent.putExtra("addClickTrackingData", z4);
            intent.putExtra("clickTypeForScreen", str3);
            intent.putExtra("hasDynamicContent", z5);
            intent.putExtra("dynamicContentType", str4);
            return intent;
        }

        private a() {
        }
    }

    @kotlin.coroutines.jvm.internal.e(c = "in.hopscotch.android.ui.webapp.WebAppActivity$cookieNotFound$1", f = "WebAppActivity.kt", l = {}, m = "invokeSuspend")
    public static final class b extends j implements Function2<CoroutineScope, kotlin.coroutines.d<? super Unit>, Object> {
        public b(kotlin.coroutines.d<? super b> dVar) {
            super(2, dVar);
        }

        @Override
        @NotNull
        public final kotlin.coroutines.d<Unit> create(Object obj, @NotNull kotlin.coroutines.d<?> dVar) {
            return WebAppActivity.this.new b(dVar);
        }

        @Override
        public final Object invoke(CoroutineScope coroutineScope, kotlin.coroutines.d<? super Unit> dVar) {
            return ((b) create(coroutineScope, dVar)).invokeSuspend(Unit.a);
        }

        @Override
        public final Object invokeSuspend(@NotNull Object obj) {
            kotlin.coroutines.intrinsics.a aVar = kotlin.coroutines.intrinsics.a.COROUTINE_SUSPENDED;
            r.b(obj);
            a aVar2 = WebAppActivity.q;
            WebAppActivity.this.c1();
            return Unit.a;
        }
    }

    @kotlin.coroutines.jvm.internal.e(c = "in.hopscotch.android.ui.webapp.WebAppActivity$goBack$1", f = "WebAppActivity.kt", l = {}, m = "invokeSuspend")
    public static final class c extends j implements Function2<CoroutineScope, kotlin.coroutines.d<? super Unit>, Object> {
        public c(kotlin.coroutines.d<? super c> dVar) {
            super(2, dVar);
        }

        @Override
        @NotNull
        public final kotlin.coroutines.d<Unit> create(Object obj, @NotNull kotlin.coroutines.d<?> dVar) {
            return WebAppActivity.this.new c(dVar);
        }

        @Override
        public final Object invoke(CoroutineScope coroutineScope, kotlin.coroutines.d<? super Unit> dVar) {
            return ((c) create(coroutineScope, dVar)).invokeSuspend(Unit.a);
        }

        @Override
        public final Object invokeSuspend(@NotNull Object obj) {
            kotlin.coroutines.intrinsics.a aVar = kotlin.coroutines.intrinsics.a.COROUTINE_SUSPENDED;
            r.b(obj);
            a aVar2 = WebAppActivity.q;
            WebAppActivity webAppActivity = WebAppActivity.this;
            if (webAppActivity.Y0()) {
                u2 u2Var = webAppActivity.binding;
                if (u2Var == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("binding");
                    u2Var = null;
                }
                u2Var.a.goBack();
            } else {
                webAppActivity.getOnBackPressedDispatcher().i();
            }
            return Unit.a;
        }
    }

    @kotlin.coroutines.jvm.internal.e(c = "in.hopscotch.android.ui.webapp.WebAppActivity$pageLoadStarted$1", f = "WebAppActivity.kt", l = {}, m = "invokeSuspend")
    public static final class d extends j implements Function2<CoroutineScope, kotlin.coroutines.d<? super Unit>, Object> {
        public d(kotlin.coroutines.d<? super d> dVar) {
            super(2, dVar);
        }

        @Override
        @NotNull
        public final kotlin.coroutines.d<Unit> create(Object obj, @NotNull kotlin.coroutines.d<?> dVar) {
            return WebAppActivity.this.new d(dVar);
        }

        @Override
        public final Object invoke(CoroutineScope coroutineScope, kotlin.coroutines.d<? super Unit> dVar) {
            return ((d) create(coroutineScope, dVar)).invokeSuspend(Unit.a);
        }

        @Override
        public final Object invokeSuspend(@NotNull Object obj) {
            kotlin.coroutines.intrinsics.a aVar = kotlin.coroutines.intrinsics.a.COROUTINE_SUSPENDED;
            r.b(obj);
            u2 u2Var = WebAppActivity.this.binding;
            if (u2Var == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                u2Var = null;
            }
            u2Var.b.setVisibility(8);
            return Unit.a;
        }
    }

    public static void T0(WebAppActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        u2 u2Var = this$0.binding;
        u2 u2Var2 = null;
        if (u2Var == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var = null;
        }
        u2Var.a.reload();
        u2 u2Var3 = this$0.binding;
        if (u2Var3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            u2Var2 = u2Var3;
        }
        u2Var2.c.setRefreshing(false);
    }

    public static void U0(WebAppActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        this$0.safeBrowsingInitialized = true;
    }

    public static final void W0(WebAppActivity webAppActivity) {
        if (webAppActivity.Y0()) {
            u2 u2Var = webAppActivity.binding;
            if (u2Var == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                u2Var = null;
            }
            u2Var.a.goBack();
            return;
        }
        boolean z = webAppActivity.isExternalAction;
        if (z) {
            if (z) {
                webAppActivity.startActivity(in.hopscotch.android.application.a0.a(webAppActivity));
                webAppActivity.finish();
                return;
            }
            return;
        }
        if (!webAppActivity.refreshOnDestroy || !webAppActivity.stateChanged) {
            if (webAppActivity.isFinishing()) {
                return;
            }
            webAppActivity.finish();
        } else {
            Intent intent = new Intent();
            intent.putExtra(LogCategory.ACTION, in.hopscotch.android.domain.response.base.b.SUCCESS);
            intent.putExtra("message", "");
            webAppActivity.setResult(-1, intent);
            webAppActivity.finish();
        }
    }

    public static void Z0(String str) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("from_screen", "Webview");
        in.hopscotch.android.analytics.c.m().getClass();
        in.hopscotch.android.analytics.c.I(str, linkedHashMap, true, false);
    }

    @NotNull
    public static final Intent b1(@NotNull Context context, @NotNull String str, String str2, String str3, boolean z, boolean z2, boolean z3, boolean z4, String str4, boolean z5, String str5) {
        q.getClass();
        return a.a(context, str, str2, str3, z, z2, z3, z4, str4, z5, str5);
    }

    public final void D(in.hopscotch.android.core.webapp.model.h hVar) {
        if (hVar != null) {
            if (this.isExternalAction && hVar.c()) {
                startActivity(in.hopscotch.android.application.a0.a(this));
                finish();
                return;
            }
            if (this.refreshOnDestroy) {
                this.stateChanged = true;
                if (hVar.c()) {
                    String a2 = hVar.a();
                    String b2 = hVar.b();
                    Intent intent = new Intent();
                    intent.putExtra(LogCategory.ACTION, a2);
                    intent.putExtra("message", b2);
                    setResult(-1, intent);
                    finish();
                }
                String b3 = hVar.b();
                if (b3 == null || kotlin.text.r.i(b3) || hVar.c()) {
                    return;
                }
                in.hopscotch.android.components.toast.a.d(this, 1, hVar.b());
            }
        }
    }

    public final void X0(boolean z, NotificationNudge notificationNudge) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        if (!z || notificationNudge == null) {
            linkedHashMap.put("showWishlistNudge", Boolean.FALSE);
            this.wishListNudgeMap.clear();
            this.wishListNudgeMap.put("wishlistNudge", linkedHashMap);
            return;
        }
        String title = notificationNudge.getTitle();
        Intrinsics.checkNotNull(title);
        Pair pair = new Pair("title", title);
        String titleImage = notificationNudge.getTitleImage();
        Intrinsics.checkNotNull(titleImage);
        Pair pair2 = new Pair("titleImage", titleImage);
        String description = notificationNudge.getDescription();
        Intrinsics.checkNotNull(description);
        Pair pair3 = new Pair("description", description);
        String positiveButtonText = notificationNudge.getPositiveButtonText();
        Intrinsics.checkNotNull(positiveButtonText);
        Pair pair4 = new Pair("positiveButtonText", positiveButtonText);
        String negativeButtonText = notificationNudge.getNegativeButtonText();
        Intrinsics.checkNotNull(negativeButtonText);
        linkedHashMap.putAll(s0.f(pair, pair2, pair3, pair4, new Pair("negativeButtonText", negativeButtonText), new Pair("showWishlistNudge", Boolean.TRUE)));
        this.wishListNudgeMap.clear();
        this.wishListNudgeMap.put("wishlistNudge", linkedHashMap);
    }

    public final boolean Y0() {
        u2 u2Var = this.binding;
        u2 u2Var2 = null;
        if (u2Var == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var = null;
        }
        if (u2Var.a.canGoBack()) {
            u2 u2Var3 = this.binding;
            if (u2Var3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
            } else {
                u2Var2 = u2Var3;
            }
            if (u2Var2.a.isFocused()) {
                return true;
            }
        }
        return false;
    }

    public final void a1() {
        u2 u2Var = this.binding;
        u2 u2Var2 = null;
        if (u2Var == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var = null;
        }
        u2Var.a.removeJavascriptInterface(WEB_APP_INTERFACE);
        u2 u2Var3 = this.binding;
        if (u2Var3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var3 = null;
        }
        u2Var3.a.removeAllViews();
        u2 u2Var4 = this.binding;
        if (u2Var4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var4 = null;
        }
        u2Var4.a.clearHistory();
        u2 u2Var5 = this.binding;
        if (u2Var5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var5 = null;
        }
        u2Var5.a.clearCache(false);
        u2 u2Var6 = this.binding;
        if (u2Var6 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var6 = null;
        }
        u2Var6.a.loadUrl("about:blank");
        u2 u2Var7 = this.binding;
        if (u2Var7 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var7 = null;
        }
        u2Var7.a.onPause();
        u2 u2Var8 = this.binding;
        if (u2Var8 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var8 = null;
        }
        SwipeRefreshLayout swipeRefreshLayout = u2Var8.c;
        u2 u2Var9 = this.binding;
        if (u2Var9 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var9 = null;
        }
        swipeRefreshLayout.removeView(u2Var9.a);
        u2 u2Var10 = this.binding;
        if (u2Var10 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            u2Var2 = u2Var10;
        }
        u2Var2.a.destroy();
    }

    public final void c0() {
        in.hopscotch.android.components.toast.a.d(getApplicationContext(), 1, getString(2132018647));
        u2 u2Var = this.binding;
        u2 u2Var2 = null;
        if (u2Var == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var = null;
        }
        RelativeLayout relativeLayout = u2Var.d;
        u2 u2Var3 = this.binding;
        if (u2Var3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            u2Var2 = u2Var3;
        }
        relativeLayout.removeView(u2Var2.a);
        a1();
        finish();
    }

    public final void c1() {
        in.hopscotch.android.core.webapp.repository.c cVar = this.l;
        u2 u2Var = null;
        if (cVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppCookieRepository");
            cVar = null;
        }
        cVar.a();
        d1();
        u2 u2Var2 = this.binding;
        if (u2Var2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            u2Var = u2Var2;
        }
        u2Var.a.reload();
    }

    public final void d0(String str, String str2, String str3, Integer num, Integer num2) {
        if (t.a(str)) {
            if (str != null) {
                Uri parse = Uri.parse(str);
                String host = parse.getHost();
                String scheme = parse.getScheme();
                if (host != null && !kotlin.text.r.i(host) && scheme != null && !kotlin.text.r.i(scheme) && !scheme.equalsIgnoreCase("hopscotch")) {
                    if (!scheme.equalsIgnoreCase("https")) {
                        startActivity(new Intent("android.intent.action.VIEW", parse));
                        return;
                    } else if (StringsKt.E(host, "hopscotch.in", false)) {
                        in.hopscotch.android.util.f.d(this, str, null, true);
                        return;
                    }
                }
            }
            Intent a2 = in.hopscotch.android.util.s0.a(this, str, "", "", "", str2, str3, null);
            a2.putExtra("FROM_SCREEN", str2);
            a2.putExtra("from_location", str3);
            if (num != null) {
                a2.putExtra("position", num.intValue());
            }
            if (num2 != null) {
                a2.putExtra("FROM_FEED_SIZE", num2.intValue());
            }
            if (this.addClickTrackingData && t.a(this.clickTypeForScreen)) {
                a2.putExtra("screenId", this.screenId);
                a2.putExtra("clickType", this.clickTypeForScreen);
            }
            startActivity(a2);
        }
    }

    public final void d1() {
        int b2;
        Map d2;
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        in.hopscotch.android.core.webapp.model.g gVar = this.webAppLoginData;
        if (gVar != null && !this.firstLoad && (d2 = gVar.d()) != null) {
            linkedHashMap.putAll(d2);
        }
        in.hopscotch.android.core.providers.d dVar = null;
        this.webAppLoginData = null;
        if (this.passCartQty && (b2 = in.hopscotch.android.application.a.b()) > 0) {
            linkedHashMap.put("cartQty", Integer.valueOf(b2));
        }
        String str = this.webUrl;
        if (str != null) {
            in.hopscotch.android.core.webapp.b.a.getClass();
            if (b.a.a(str) && StringsKt.E(str, "Wishlist", true)) {
                linkedHashMap.putAll(this.wishListNudgeMap);
            }
        }
        in.hopscotch.android.core.webapp.store.b bVar = this.n;
        if (bVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppPreferencesDB");
            bVar = null;
        }
        in.hopscotch.android.core.providers.d dVar2 = this.o;
        if (dVar2 != null) {
            dVar = dVar2;
        } else {
            Intrinsics.throwUninitializedPropertyAccessException("gsonProvider");
        }
        bVar.b(dVar.a().h(linkedHashMap));
    }

    public final void e(boolean z) {
        if (!z) {
            Z0("notification_permission_rejected");
        } else {
            BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), Dispatchers.getMain(), null, new f(this, null), 2, null);
            Z0("notification_permission_accepted");
        }
    }

    public final void f() {
        in.hopscotch.android.core.webapp.repository.c cVar = this.l;
        if (cVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppCookieRepository");
            cVar = null;
        }
        cVar.a();
        BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), Dispatchers.getMain(), null, new b(null), 2, null);
    }

    public final void g() {
        BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), Dispatchers.getMain(), null, new d(null), 2, null);
    }

    public final void goBack() {
        BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), Dispatchers.getMain(), null, new c(null), 2, null);
    }

    public final void i0(in.hopscotch.android.core.webapp.model.g gVar) {
        if (gVar != null) {
            this.webAppLoginData = gVar;
            String c2 = gVar.c();
            String c3 = (c2 == null || c2.length() == 0) ? UserStatus.getInstance().getLoginStatus() ? "PROMOTION_UPDATE_MOBILE" : "PROMOTION_LOGIN" : gVar.c();
            String b2 = gVar.b();
            String str = "";
            String valueOf = (b2 == null || b2.length() == 0) ? "" : String.valueOf(gVar.b());
            String a2 = gVar.a();
            String valueOf2 = (a2 == null || a2.length() == 0) ? "" : String.valueOf(gVar.a());
            String e = gVar.e();
            if (e != null && e.length() != 0) {
                str = String.valueOf(gVar.e());
            }
            Bundle bundle = new Bundle();
            bundle.putString("otpReason", c3);
            bundle.putBoolean("verifyMobileForCart", true);
            bundle.putString("redirectMessage", str);
            LoginActivity.a aVar = LoginActivity.i;
            androidx.activity.result.b<Intent> bVar = this.loginResultLauncher;
            aVar.getClass();
            LoginActivity.a.c(this, bVar, valueOf, valueOf2, "LOGIN_WITH_OTP", "", true, false, bundle);
        }
    }

    public final void n() {
        in.hopscotch.android.core.webapp.repository.c cVar = this.l;
        if (cVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppCookieRepository");
            cVar = null;
        }
        cVar.b();
    }

    public final void o0(@NotNull String webUrl) {
        Intrinsics.checkNotNullParameter(webUrl, "webUrl");
        this.webUrl = webUrl;
        Trace trace = this.webViewLoadTrace;
        if (trace != null) {
            trace.stop();
        }
    }

    @Override
    public final void onCreate(android.os.Bundle r18) {
        throw new UnsupportedOperationException("Method not decompiled: in.hopscotch.android.ui.webapp.WebAppActivity.onCreate(android.os.Bundle):void");
    }

    @Override
    public final void onDestroy() {
        in.hopscotch.android.core.webapp.js.b bVar = this.i;
        if (bVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppJavascriptInterface");
            bVar = null;
        }
        bVar.a((in.hopscotch.android.core.webapp.repository.e) null);
        in.hopscotch.android.core.webapp.a aVar = this.k;
        if (aVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppClient");
            aVar = null;
        }
        aVar.a((in.hopscotch.android.core.webapp.repository.b) null);
        in.hopscotch.android.core.webapp.repository.c cVar = this.l;
        if (cVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppCookieRepository");
            cVar = null;
        }
        cVar.d();
        u2 u2Var = this.binding;
        if (u2Var == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            u2Var = null;
        }
        u2Var.c.setOnRefreshListener((SwipeRefreshLayout.j) null);
        a1();
        if (this.addClickTrackingData) {
            in.hopscotch.android.core.util.b.d(this.screenId);
        }
        b.a.a.getClass();
        u b2 = b.a.b();
        if (b2 != null) {
            b2.k0(this);
        }
        super.onDestroy();
    }

    public final void onResume() {
        String str;
        boolean z;
        super/*androidx.fragment.app.n*/.onResume();
        in.hopscotch.android.core.repository.a aVar = this.m;
        in.hopscotch.android.core.webapp.repository.c cVar = null;
        if (aVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("orderAttributionDataRepository");
            aVar = null;
        }
        aVar.setOrderAttributionData(this.orderAttributionData);
        in.hopscotch.android.core.webapp.js.b bVar = this.i;
        if (bVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppJavascriptInterface");
            bVar = null;
        }
        bVar.a(this);
        in.hopscotch.android.core.webapp.a aVar2 = this.k;
        if (aVar2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppClient");
            aVar2 = null;
        }
        aVar2.a(this);
        boolean z2 = this.firstLoad;
        if (z2) {
            this.firstLoad = false;
            String str2 = this.webUrl;
            if (str2 != null) {
                Uri parse = Uri.parse(str2);
                Intrinsics.checkNotNull(parse);
                String url = in.hopscotch.android.core.util.h.a(in.hopscotch.android.core.util.h.a(in.hopscotch.android.core.util.h.a(in.hopscotch.android.core.util.h.a(parse, "id", "app"), "site", LogSubCategory.LifeCycle.ANDROID), "version", "9.7.2"), "build", "2025072909").toString();
                Intrinsics.checkNotNullExpressionValue(url, "toString(...)");
                x.a.getClass();
                Intrinsics.checkNotNullParameter(url, "url");
                try {
                    new URL(url).toURI();
                    z = true;
                } catch (Exception unused) {
                    z = false;
                }
                if (z) {
                    this.webUrl = url;
                }
            }
            d1();
            u2 u2Var = this.binding;
            if (u2Var == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                u2Var = null;
            }
            u2Var.b.setVisibility(0);
            String str3 = this.webUrl;
            in.hopscotch.android.core.webapp.b.a.getClass();
            if (b.a.a(str3)) {
                u2 u2Var2 = this.binding;
                if (u2Var2 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("binding");
                    u2Var2 = null;
                }
                u2Var2.b.setVisibility(8);
                if (str3 != null && StringsKt.E(str3, WISHLIST, false) && StringsKt.E(str3, "reload", false)) {
                    u2 u2Var3 = this.binding;
                    if (u2Var3 == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("binding");
                        u2Var3 = null;
                    }
                    u2Var3.a.reload();
                } else {
                    String g = androidx.privacysandbox.ads.adservices.java.internal.a.g(this.webUrl, "&reload");
                    this.webUrl = g;
                    if (g == null) {
                        g = "";
                    }
                    if (StringsKt.E(g, "qa.", false)) {
                        HashMap q2 = android.support.v4.media.c.q("x-nv", "true");
                        q2.put("x-nv-security-magic", HsApplication.b().b.getN7DebugMagicSecurityKey());
                        u2 u2Var4 = this.binding;
                        if (u2Var4 == null) {
                            Intrinsics.throwUninitializedPropertyAccessException("binding");
                            u2Var4 = null;
                        }
                        u2Var4.a.loadUrl(g, q2);
                    } else {
                        u2 u2Var5 = this.binding;
                        if (u2Var5 == null) {
                            Intrinsics.throwUninitializedPropertyAccessException("binding");
                            u2Var5 = null;
                        }
                        u2Var5.a.loadUrl(g);
                    }
                }
            } else {
                String string = getString(2132018199);
                Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
                in.hopscotch.android.core.util.d dVar = this.p;
                if (dVar == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("logger");
                    dVar = null;
                }
                dVar.d(new MalformedURLException(android.support.v4.media.a.k(string, " : ", this.webUrl)));
                in.hopscotch.android.components.toast.a.d(getApplicationContext(), 1, string);
            }
        }
        if (!this.firstLoad) {
            in.hopscotch.android.core.webapp.repository.c cVar2 = this.l;
            if (cVar2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("webAppCookieRepository");
                cVar2 = null;
            }
            cVar2.a();
            in.hopscotch.android.core.webapp.repository.c cVar3 = this.l;
            if (cVar3 != null) {
                cVar = cVar3;
            } else {
                Intrinsics.throwUninitializedPropertyAccessException("webAppCookieRepository");
            }
            cVar.c();
        }
        if (z2 || !this.hasDynamicContent || (str = this.dynamicContentType) == null || !Intrinsics.areEqual(str, "Wishlist")) {
            return;
        }
        o.a.getClass();
        if (o.b() > 0) {
            o.d();
            c1();
        }
    }

    public final void p(boolean z) {
        if (!z) {
            BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), Dispatchers.getMain(), null, new f(this, null), 2, null);
            Z0("notification_permission_rejected");
            return;
        }
        b.a.a.getClass();
        u b2 = b.a.b();
        if (b2 != null) {
            b2.N(true);
        }
    }

    public final void p0(String str) {
        in.hopscotch.android.core.util.d dVar = this.p;
        if (dVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("logger");
            dVar = null;
        }
        dVar.d(new WebviewJavascriptException(str));
    }

    public final void t(in.hopscotch.android.core.webapp.model.e eVar) {
        if (eVar != null) {
            in.hopscotch.android.application.a.e(eVar.a(), getApplicationContext());
        }
    }

    public final void w(String str, Map<String, ? extends Object> map) {
        in.hopscotch.android.core.webapp.repository.a aVar = this.j;
        if (aVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("webAppAnalyticsRepository");
            aVar = null;
        }
        aVar.a(str, map, this.keepAttributionData, this.keepUniversalData);
    }
}