导航菜单

页面标题

页面副标题

Mitra Bukalapak v2.55.0 - StandardBrowserScreen.java 源代码

正在查看: Mitra Bukalapak v2.55.0 应用的 StandardBrowserScreen.java JAVA 源代码文件

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


package com.bukalapak.android.lib.browser;

import android.content.Intent;
import android.os.Bundle;
import android.webkit.CookieManager;
import android.webkit.WebView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.bukalapak.android.lib.api4.tungku.data.SingleKycIdentity;
import com.bukalapak.android.lib.browser.BrowserScreen;
import com.bukalapak.android.lib.browser.StandardBrowserScreen;
import com.bukalapak.android.lib.browser.StandardBrowserScreen.b;
import defpackage.C0152ku0;
import defpackage.C0187su0;
import defpackage.dk4;
import defpackage.go7;
import defpackage.gx2;
import defpackage.hc7;
import defpackage.kr9;
import defpackage.lm9;
import defpackage.p64;
import defpackage.w36;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;

@Metadata(d1 = {"\u0000^\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010 \n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\f\b\u0016\u0018\u0000 @*\b\b\u0000\u0010\u0002*\u00020\u00012\b\u0012\u0004\u0012\u00028\u00000\u0003:\u0002ABB\u0007¢\u0006\u0004\b?\u0010=J\u0018\u0010\t\u001a\u00020\b2\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0014J\u0010\u0010\n\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0016J\u0018\u0010\f\u001a\u00020\u000b2\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0014J\u0010\u0010\r\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0016J\u0010\u0010\u000f\u001a\u00020\b2\u0006\u0010\u000e\u001a\u00020\u000bH\u0014J\b\u0010\u0010\u001a\u00020\bH\u0004J\u001a\u0010\u0012\u001a\u00020\b2\u0006\u0010\u0005\u001a\u00020\u00042\b\u0010\u0011\u001a\u0004\u0018\u00010\u0006H\u0014J\u0010\u0010\u0013\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0006H\u0016J\u0012\u0010\u0016\u001a\u00020\b2\b\u0010\u0015\u001a\u0004\u0018\u00010\u0014H\u0014J\u0018\u0010\u001a\u001a\u00020\b2\u0006\u0010\u0017\u001a\u00020\u00062\u0006\u0010\u0019\u001a\u00020\u0018H\u0016J\u0010\u0010\u001b\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0016J\b\u0010\u001c\u001a\u00020\bH\u0016J\u0010\u0010\u001e\u001a\u00020\u00062\u0006\u0010\u001d\u001a\u00020\u0006H\u0016J\"\u0010!\u001a\u00020\b2\u0006\u0010\u001d\u001a\u00020\u00062\u0006\u0010\u001f\u001a\u00020\u00182\b\u0010 \u001a\u0004\u0018\u00010\u0018H\u0016J'\u0010$\u001a\u0004\u0018\u00010\u00182\u0006\u0010\u0017\u001a\u00020\u00062\f\u0010#\u001a\b\u0012\u0004\u0012\u00020\u00060\"H\u0000¢\u0006\u0004\b$\u0010%J\u0010\u0010'\u001a\u00020\b2\u0006\u0010&\u001a\u00020\u0014H\u0014R\u001a\u0010-\u001a\u00020(8\u0014X\u0094\u0004¢\u0006\f\n\u0004\b)\u0010*\u001a\u0004\b+\u0010,R2\u00106\u001a\u0012\u0012\u0004\u0012\u00020\u00180.j\b\u0012\u0004\u0012\u00020\u0018`/8\u0000@\u0000X\u0080\u000e¢\u0006\u0012\n\u0004\b0\u00101\u001a\u0004\b2\u00103\"\u0004\b4\u00105R,\u0010>\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\b078\u0004X\u0084\u0004¢\u0006\u0012\n\u0004\b8\u00109\u0012\u0004\b<\u0010=\u001a\u0004\b:\u0010;¨\u0006C"}, d2 = {"Lcom/bukalapak/android/lib/browser/StandardBrowserScreen;", "Lcom/bukalapak/android/lib/browser/StandardBrowserScreen$b;", "E", "Lcom/bukalapak/android/lib/browser/BrowserScreen;", "Landroid/webkit/WebView;", "view", SingleKycIdentity.EMPTY, "url", "Llm9;", "F0", "b1", SingleKycIdentity.EMPTY, "L0", "Y0", "firstInit", "h0", "V0", "newTitle", "R0", "c1", "Landroid/os/Bundle;", "savedInstanceState", "k0", "currentUrl", "Lw36;", "currentPageState", "a1", "Z0", "U", "previousUrl", SingleKycIdentity.D1, "previousState", "currentState", "W0", SingleKycIdentity.EMPTY, "webHistory", "e1", "(Ljava/lang/String;Ljava/util/List;)Lw36;", "outState", "onSaveInstanceState", SingleKycIdentity.EMPTY, "l", "I", "Q", "()I", "layoutResId", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "m", "Ljava/util/ArrayList;", "getPageStates$lib_release", "()Ljava/util/ArrayList;", "setPageStates$lib_release", "(Ljava/util/ArrayList;)V", "pageStates", "Lkotlin/Function1;", "n", "Lgx2;", "getDefaultOpenUrlListener", "()Lgx2;", "getDefaultOpenUrlListener$annotations", "()V", "defaultOpenUrlListener", "<init>", SingleKycIdentity.O, SingleKycIdentity.A, SingleKycIdentity.B, "lib_release"}, k = 1, mv = {1, 5, 1})
public class StandardBrowserScreen<E extends b> extends BrowserScreen<E> {

    private final int layoutResId = hc7.a;

    private ArrayList<w36> pageStates = new ArrayList<>();

    private final gx2<String, lm9> defaultOpenUrlListener = new c(this);

    @Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\t\b\u0016\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b&\u0010'R\"\u0010\u0003\u001a\u00020\u00028\u0006@\u0006X\u0086.¢\u0006\u0012\n\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR>\u0010\u000b\u001a\u001e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00020\tj\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u0002`\n8\u0016@\u0016X\u0096\u000e¢\u0006\u0012\n\u0004\b\u000b\u0010\f\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010R\"\u0010\u0012\u001a\u00020\u00118\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b\u0012\u0010\u0013\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R\"\u0010\u0018\u001a\u00020\u00118\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b\u0018\u0010\u0013\u001a\u0004\b\u0019\u0010\u0015\"\u0004\b\u001a\u0010\u0017R>\u0010\u001b\u001a\u001e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00020\tj\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u0002`\n8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b\u001b\u0010\f\u001a\u0004\b\u001c\u0010\u000e\"\u0004\b\u001d\u0010\u0010R2\u0010 \u001a\u0012\u0012\u0004\u0012\u00020\u00020\u001ej\b\u0012\u0004\u0012\u00020\u0002`\u001f8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b \u0010!\u001a\u0004\b\"\u0010#\"\u0004\b$\u0010%¨\u0006("}, d2 = {"Lcom/bukalapak/android/lib/browser/StandardBrowserScreen$b;", "Lcom/bukalapak/android/lib/browser/BrowserScreen$b;", SingleKycIdentity.EMPTY, "url", "Ljava/lang/String;", "P", "()Ljava/lang/String;", "U", "(Ljava/lang/String;)V", "Ljava/util/HashMap;", "Lkotlin/collections/HashMap;", "headers", "Ljava/util/HashMap;", "M", "()Ljava/util/HashMap;", "S", "(Ljava/util/HashMap;)V", SingleKycIdentity.EMPTY, "redirectOnly", "Z", "N", "()Z", "T", "(Z)V", "webViewOnly", "Q", "V", "cookieInjection", "K", "R", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "blacklistedCookies", "Ljava/util/ArrayList;", "J", "()Ljava/util/ArrayList;", "setBlacklistedCookies", "(Ljava/util/ArrayList;)V", "<init>", "()V", "lib_release"}, k = 1, mv = {1, 5, 1})
    public static class b extends BrowserScreen.b {
        private boolean redirectOnly;
        public String url;
        private boolean webViewOnly;
        private HashMap<String, String> headers = new HashMap<>();
        private HashMap<String, String> cookieInjection = new HashMap<>();
        private ArrayList<String> blacklistedCookies = new ArrayList<>();

        public final ArrayList<String> J() {
            return this.blacklistedCookies;
        }

        public final HashMap<String, String> K() {
            return this.cookieInjection;
        }

        public HashMap<String, String> M() {
            return this.headers;
        }

        public final boolean getRedirectOnly() {
            return this.redirectOnly;
        }

        public final String P() {
            String str = this.url;
            if (str != null) {
                return str;
            }
            p64.t("url");
            throw null;
        }

        public final boolean getWebViewOnly() {
            return this.webViewOnly;
        }

        public final void R(HashMap<String, String> hashMap) {
            p64.h(hashMap, "<set-?>");
            this.cookieInjection = hashMap;
        }

        public void S(HashMap<String, String> hashMap) {
            p64.h(hashMap, "<set-?>");
            this.headers = hashMap;
        }

        public final void T(boolean z) {
            this.redirectOnly = z;
        }

        public final void U(String str) {
            p64.h(str, "<set-?>");
            this.url = str;
        }

        public final void V(boolean z) {
            this.webViewOnly = z;
        }
    }

    @Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0005\u001a\u00020\u0004\"\b\b\u0000\u0010\u0001*\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u0002H\n"}, d2 = {"Lcom/bukalapak/android/lib/browser/StandardBrowserScreen$b;", "E", SingleKycIdentity.EMPTY, "url", "Llm9;", "<anonymous>"}, k = 3, mv = {1, 5, 1})
    static final class c extends dk4 implements gx2<String, lm9> {
        final StandardBrowserScreen<E> this$0;

        c(StandardBrowserScreen<E> standardBrowserScreen) {
            super(1);
            this.this$0 = standardBrowserScreen;
        }

        public final void a(String str) {
            p64.h(str, "url");
            Intent intent = (Intent) this.this$0.getIntent().clone();
            Serializable serializableExtra = intent.getSerializableExtra("extras");
            if (serializableExtra == null) {
                throw new NullPointerException("null cannot be cast to non-null type E of com.bukalapak.android.lib.browser.StandardBrowserScreen");
            }
            ((b) serializableExtra).U(str);
            intent.putExtra("extras", this.this$0.P());
            this.this$0.onNewIntent(intent);
        }

        @Override
        public lm9 invoke(String str) {
            a(str);
            return lm9.a;
        }
    }

    public static final void X0(StandardBrowserScreen standardBrowserScreen) {
        p64.h(standardBrowserScreen, "this$0");
        standardBrowserScreen.V0();
    }

    @Override
    protected void F0(WebView webView, String str) {
        p64.h(webView, "view");
        p64.h(str, "url");
        super.F0(webView, str);
        CookieManager cookieManager = CookieManager.getInstance();
        String cookie = cookieManager.getCookie(str);
        if (cookie == null) {
            return;
        }
        ArrayList<String> J = ((b) P()).J();
        if (!J.isEmpty()) {
            Iterator<T> it = J.iterator();
            while (it.hasNext()) {
                cookie = new go7("\\s*" + ((String) it.next()) + "=([^;]*);?").g(cookie, SingleKycIdentity.EMPTY);
            }
        }
        HashMap<String, String> K = ((b) P()).K();
        if (!K.isEmpty()) {
            for (Map.Entry<String, String> entry : K.entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue();
                cookie = new go7(key + "=([^;]*)").g(cookie, key + "=" + value);
            }
        }
        cookieManager.setCookie(str, cookie);
    }

    @Override
    protected boolean L0(WebView view, String url) {
        p64.h(view, "view");
        p64.h(url, "url");
        Y0(url);
        return true;
    }

    @Override
    protected int getLayoutResId() {
        return this.layoutResId;
    }

    @Override
    protected void R0(WebView webView, String str) {
        p64.h(webView, "view");
        if (((b) P()).getRedirectOnly()) {
            str = getString(ve7.g);
        }
        super.R0(webView, str);
    }

    @Override
    public void U() {
        Object q0;
        BrowserView O = O();
        p64.g(O, "browserView");
        List<String> a = kr9.a(O);
        String originalUrl = O().getOriginalUrl();
        if (a.size() > 1 && originalUrl != null) {
            q0 = C0187su0.q0(this.pageStates);
            w36 w36Var = (w36) q0;
            w36 e1 = e1(originalUrl, a.subList(0, C0152ku0.j(a)));
            if (e1 != null) {
                W0(a.get(C0152ku0.j(a) - 1), e1, w36Var);
            }
        }
        super.U();
    }

    protected final void V0() {
        String url = O().getUrl();
        if (url == null) {
            return;
        }
        O().loadUrl(url);
    }

    public void W0(String str, w36 w36Var, w36 w36Var2) {
        p64.h(str, "previousUrl");
        p64.h(w36Var, "previousState");
        if (w36Var2 != w36Var) {
            BrowserScreen.g0(this, w36Var.getIntent(), false, 2, null);
        }
    }

    public void Y0(String str) {
        p64.h(str, "url");
        if (((b) P()).getWebViewOnly()) {
            this.defaultOpenUrlListener.invoke(str);
        } else {
            b1(str);
        }
    }

    public void Z0(String str) {
        p64.h(str, "url");
        O().setVisibility(0);
        O().loadUrl(str);
    }

    public void a1(String str, w36 w36Var) {
        p64.h(str, "currentUrl");
        p64.h(w36Var, "currentPageState");
        BrowserScreen.g0(this, w36Var.getIntent(), false, 2, null);
    }

    public void b1(String str) {
        p64.h(str, "url");
        this.defaultOpenUrlListener.invoke(str);
    }

    public String c1(String url) {
        p64.h(url, "url");
        return url;
    }

    public String d1(String previousUrl) {
        p64.h(previousUrl, "previousUrl");
        return previousUrl;
    }

    public final w36 e1(String currentUrl, List<String> webHistory) {
        Object q0;
        int i;
        Object q02;
        Bundle args;
        p64.h(currentUrl, "currentUrl");
        p64.h(webHistory, "webHistory");
        q0 = C0187su0.q0(this.pageStates);
        w36 w36Var = (w36) q0;
        if (p64.c(d1(currentUrl), w36Var == null ? null : w36Var.getUrl()) && (i = w36Var.getArgs().getInt("history_count")) == webHistory.size()) {
            do {
                kr9.i(this.pageStates);
                q02 = C0187su0.q0(this.pageStates);
                w36 w36Var2 = (w36) q02;
                if (w36Var2 == null || (args = w36Var2.getArgs()) == null) {
                    break;
                }
            } while (args.getInt("history_count") == i);
        }
        return (w36) kr9.g(this.pageStates);
    }

    @Override
    protected void h0(boolean z) {
        super.h0(z);
        if (z) {
            R().setOnRefreshListener(new SwipeRefreshLayout.j() {
                @Override
                public final void onRefresh() {
                    StandardBrowserScreen.X0(StandardBrowserScreen.this);
                }
            });
        }
        for (Map.Entry<String, String> entry : ((b) P()).M().entrySet()) {
            O().a(entry.getKey(), entry.getValue());
        }
    }

    @Override
    protected void k0(Bundle bundle) {
        Object q0;
        if (bundle == null) {
            String c1 = c1(((b) P()).P());
            BrowserView O = O();
            p64.g(O, "browserView");
            int size = kr9.a(O).size();
            Z0(c1);
            Bundle bundle2 = new Bundle();
            bundle2.putInt("history_count", size);
            ArrayList<w36> arrayList = this.pageStates;
            String P = ((b) P()).P();
            Intent intent = getIntent();
            p64.g(intent, "intent");
            kr9.j(arrayList, new w36(P, intent, bundle2));
            return;
        }
        O().setVisibility(0);
        O().restoreState(bundle);
        ArrayList<w36> parcelableArrayList = bundle.getParcelableArrayList("page_states");
        if (parcelableArrayList == null) {
            throw new IllegalStateException("No page_states on savedInstanceState");
        }
        this.pageStates = parcelableArrayList;
        BrowserView O2 = O();
        p64.g(O2, "browserView");
        q0 = C0187su0.q0(kr9.a(O2));
        String str = (String) q0;
        w36 w36Var = (w36) kr9.g(this.pageStates);
        if (w36Var != null) {
            if (str == null) {
                str = w36Var.getUrl();
            }
            a1(str, w36Var);
        }
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        p64.h(bundle, "outState");
        bundle.putSerializable("page_states", this.pageStates);
        super.onSaveInstanceState(bundle);
    }
}