导航菜单

页面标题

页面副标题

CityMall v1.42.1 - k.java 源代码

正在查看: CityMall v1.42.1 应用的 k.java JAVA 源代码文件

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


package com.reactnativecommunity.webview;

import android.app.Activity;
import android.app.DownloadManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.webkit.WebSettingsCompat;
import androidx.webkit.WebViewFeature;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.uimanager.p0;
import com.simpl.android.fingerprint.BuildConfig;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import org.json.JSONException;
import org.json.JSONObject;

public final class k {
    public static final a C = new a(null);
    private final int A;
    private final int B;
    private final boolean a;
    private final String b;
    private RNCWebViewConfig c;
    private boolean d;
    private boolean e;
    private String f;
    private String g;
    private boolean h;
    private ReadableMap i;
    private String j;
    private String k;
    private final String l;
    private final String m;
    private final String n;
    private final String o;
    private final String p;
    private final String q;
    private final int r;
    private final int s;
    private final int t;
    private final int u;
    private final int v;
    private final int w;
    private final int x;
    private final int y;
    private final int z;

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

        private a() {
        }
    }

    public static final class b extends com.reactnativecommunity.webview.c {
        b(f fVar) {
            super(fVar);
        }

        @Override
        public Bitmap getDefaultVideoPoster() {
            return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
        }
    }

    public static final class c extends com.reactnativecommunity.webview.c {
        final Activity y;
        final int z;

        c(f fVar, Activity activity, int i) {
            super(fVar);
            this.y = activity;
            this.z = i;
        }

        @Override
        public Bitmap getDefaultVideoPoster() {
            return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
        }

        @Override
        public void onHideCustomView() {
            if (this.b == null) {
                return;
            }
            ViewGroup c = c();
            if (c.getRootView() != this.a.getRootView()) {
                this.a.getRootView().setVisibility(0);
            } else {
                this.a.setVisibility(0);
            }
            this.y.getWindow().clearFlags(512);
            c.removeView(this.b);
            this.c.onCustomViewHidden();
            this.b = null;
            this.c = null;
            this.y.setRequestedOrientation(this.z);
            this.a.getThemedReactContext().removeLifecycleEventListener(this);
        }

        @Override
        public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
            kotlin.jvm.internal.j.i(view, "view");
            kotlin.jvm.internal.j.i(callback, "callback");
            if (this.b != null) {
                callback.onCustomViewHidden();
                return;
            }
            this.b = view;
            this.c = callback;
            this.y.setRequestedOrientation(-1);
            this.b.setSystemUiVisibility(7942);
            this.y.getWindow().setFlags(512, 512);
            this.b.setBackgroundColor(-16777216);
            ViewGroup c = c();
            c.addView(this.b, com.reactnativecommunity.webview.c.n);
            if (c.getRootView() != this.a.getRootView()) {
                this.a.getRootView().setVisibility(8);
            } else {
                this.a.setVisibility(8);
            }
            this.a.getThemedReactContext().addLifecycleEventListener(this);
        }
    }

    public k() {
        this(false, 1, null);
    }

    public static final void f(f webView, k this$0, String str, String str2, String str3, String str4, long j) {
        kotlin.jvm.internal.j.i(webView, "$webView");
        kotlin.jvm.internal.j.i(this$0, "this$0");
        webView.setIgnoreErrFailedForThisURL(str);
        RNCWebViewModule nativeModule = webView.getReactApplicationContext().getNativeModule(RNCWebViewModule.class);
        if (nativeModule == null) {
            return;
        }
        try {
            DownloadManager.Request request = new DownloadManager.Request(Uri.parse(str));
            String a2 = q.a(str, str3, str4);
            kotlin.jvm.internal.j.f(a2);
            String f = l.a().f(a2, "_");
            String str5 = "Downloading " + f;
            try {
                URL url = new URL(str);
                request.addRequestHeader("Cookie", CookieManager.getInstance().getCookie(url.getProtocol() + "://" + url.getHost()));
            } catch (MalformedURLException e) {
                Log.w(this$0.b, "Error getting cookie for DownloadManager", e);
            }
            request.addRequestHeader("User-Agent", str2);
            request.setTitle(f);
            request.setDescription(str5);
            request.allowScanningByMediaScanner();
            request.setNotificationVisibility(1);
            request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, f);
            nativeModule.setDownloadRequest(request);
            if (nativeModule.grantFileDownloaderPermissions(this$0.h(), this$0.i())) {
                nativeModule.downloadFile(this$0.h());
            }
        } catch (IllegalArgumentException e2) {
            Log.w(this$0.b, "Unsupported URI, aborting download", e2);
        }
    }

    private final String h() {
        String str = this.f;
        return str == null ? this.p : str;
    }

    private final void h0(p pVar) {
        f webView = pVar.getWebView();
        if (this.j != null) {
            webView.getSettings().setUserAgentString(this.j);
        } else if (this.k != null) {
            webView.getSettings().setUserAgentString(this.k);
        } else {
            webView.getSettings().setUserAgentString(WebSettings.getDefaultUserAgent(webView.getContext()));
        }
    }

    private final String i() {
        String str = this.g;
        return str == null ? this.q : str;
    }

    private final void j(p pVar, ReadableMap readableMap) {
        byte[] bArr;
        f webView = pVar.getWebView();
        if (readableMap != null) {
            if (readableMap.hasKey("html")) {
                String string = readableMap.getString("html");
                String string2 = readableMap.hasKey("baseUrl") ? readableMap.getString("baseUrl") : BuildConfig.FLAVOR;
                kotlin.jvm.internal.j.f(string);
                webView.loadDataWithBaseURL(string2, string, this.m, this.l, null);
                return;
            }
            if (readableMap.hasKey("uri")) {
                String string3 = readableMap.getString("uri");
                String url = webView.getUrl();
                if (url == null || !kotlin.jvm.internal.j.d(url, string3)) {
                    if (readableMap.hasKey("method") && kotlin.text.k.t(readableMap.getString("method"), this.n, true)) {
                        if (readableMap.hasKey("body")) {
                            String string4 = readableMap.getString("body");
                            try {
                                kotlin.jvm.internal.j.f(string4);
                                Charset forName = Charset.forName("UTF-8");
                                kotlin.jvm.internal.j.h(forName, "forName(...)");
                                bArr = string4.getBytes(forName);
                                kotlin.jvm.internal.j.h(bArr, "getBytes(...)");
                            } catch (UnsupportedEncodingException unused) {
                                kotlin.jvm.internal.j.f(string4);
                                bArr = string4.getBytes(kotlin.text.d.b);
                                kotlin.jvm.internal.j.h(bArr, "getBytes(...)");
                            }
                        } else {
                            bArr = null;
                        }
                        if (bArr == null) {
                            bArr = new byte[0];
                        }
                        kotlin.jvm.internal.j.f(string3);
                        webView.postUrl(string3, bArr);
                        return;
                    }
                    HashMap hashMap = new HashMap();
                    if (readableMap.hasKey("headers")) {
                        if (this.a) {
                            ReadableArray array = readableMap.getArray("headers");
                            kotlin.jvm.internal.j.f(array);
                            Iterator it = array.toArrayList().iterator();
                            while (it.hasNext()) {
                                Object next = it.next();
                                kotlin.jvm.internal.j.g(next, "null cannot be cast to non-null type java.util.HashMap<kotlin.String, kotlin.String>{ kotlin.collections.TypeAliasesKt.HashMap<kotlin.String, kotlin.String> }");
                                HashMap hashMap2 = (HashMap) next;
                                String str = (String) hashMap2.get("name");
                                if (str == null) {
                                    str = BuildConfig.FLAVOR;
                                }
                                String str2 = (String) hashMap2.get("value");
                                if (str2 == null) {
                                    str2 = BuildConfig.FLAVOR;
                                }
                                Locale ENGLISH = Locale.ENGLISH;
                                kotlin.jvm.internal.j.h(ENGLISH, "ENGLISH");
                                String lowerCase = str.toLowerCase(ENGLISH);
                                kotlin.jvm.internal.j.h(lowerCase, "toLowerCase(...)");
                                if (kotlin.jvm.internal.j.d("user-agent", lowerCase)) {
                                    webView.getSettings().setUserAgentString(str2);
                                } else {
                                    hashMap.put(str, str2);
                                }
                            }
                        } else {
                            ReadableMap map = readableMap.getMap("headers");
                            kotlin.jvm.internal.j.f(map);
                            ReadableMapKeySetIterator keySetIterator = map.keySetIterator();
                            while (keySetIterator.hasNextKey()) {
                                String nextKey = keySetIterator.nextKey();
                                Locale ENGLISH2 = Locale.ENGLISH;
                                kotlin.jvm.internal.j.h(ENGLISH2, "ENGLISH");
                                String lowerCase2 = nextKey.toLowerCase(ENGLISH2);
                                kotlin.jvm.internal.j.h(lowerCase2, "toLowerCase(...)");
                                if (kotlin.jvm.internal.j.d("user-agent", lowerCase2)) {
                                    webView.getSettings().setUserAgentString(map.getString(nextKey));
                                } else {
                                    hashMap.put(nextKey, map.getString(nextKey));
                                }
                            }
                        }
                    }
                    kotlin.jvm.internal.j.f(string3);
                    webView.loadUrl(string3, hashMap);
                    return;
                }
                return;
            }
        }
        webView.loadUrl(this.o);
    }

    private final void j0(f fVar) {
        Activity currentActivity = fVar.getThemedReactContext().getCurrentActivity();
        if (this.d && currentActivity != null) {
            c cVar = new c(fVar, currentActivity, currentActivity.getRequestedOrientation());
            cVar.f(this.e);
            cVar.g(this.h);
            fVar.setWebChromeClient(cVar);
            return;
        }
        com.reactnativecommunity.webview.c cVar2 = (com.reactnativecommunity.webview.c) fVar.getWebChromeClient();
        if (cVar2 != null) {
            cVar2.onHideCustomView();
        }
        b bVar = new b(fVar);
        bVar.f(this.e);
        bVar.g(this.h);
        fVar.setWebChromeClient(bVar);
    }

    public static final void k(WebView webView) {
    }

    public final void A(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        if (Build.VERSION.SDK_INT > 28) {
            if (WebViewFeature.a("FORCE_DARK")) {
                WebSettingsCompat.b(webView.getSettings(), z ? 2 : 0);
            }
            if (z && WebViewFeature.a("FORCE_DARK_STRATEGY")) {
                WebSettingsCompat.c(webView.getSettings(), 2);
            }
        }
    }

    public final void B(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setGeolocationEnabled(z);
    }

    public final void C(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        this.h = z;
        j0(webView);
    }

    public final void D(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setHasScrollEvent(z);
    }

    public final void E(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        if (z) {
            CookieManager.getInstance().removeAllCookies(null);
            webView.getSettings().setCacheMode(2);
            webView.clearHistory();
            webView.clearCache(true);
            webView.clearFormData();
            webView.getSettings().setSavePassword(false);
            webView.getSettings().setSaveFormData(false);
        }
    }

    public final void F(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().a = str;
    }

    public final void G(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().b = str;
    }

    public final void H(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().f = z;
    }

    public final void I(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().e = z;
    }

    public final void J(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setInjectedJavaScriptObject(str);
    }

    public final void K(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setJavaScriptCanOpenWindowsAutomatically(z);
    }

    public final void L(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setJavaScriptEnabled(z);
    }

    public final void M(String str) {
        this.g = str;
    }

    public final void N(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setMediaPlaybackRequiresUserGesture(z);
    }

    public final void O(p viewWrapper, ReadableArray readableArray) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        if (readableArray == null) {
            webView.setMenuCustomItems(null);
            return;
        }
        ArrayList arrayList = readableArray.toArrayList();
        kotlin.jvm.internal.j.g(arrayList, "null cannot be cast to non-null type kotlin.collections.List<kotlin.collections.Map<kotlin.String, kotlin.String>>");
        webView.setMenuCustomItems(arrayList);
    }

    public final void P(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setMessagingEnabled(z);
    }

    public final void Q(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().h = str;
    }

    public final void R(p viewWrapper, int i) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setMinimumFontSize(i);
    }

    public final void S(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        if (str == null || kotlin.jvm.internal.j.d("never", str)) {
            webView.getSettings().setMixedContentMode(1);
        } else if (kotlin.jvm.internal.j.d("always", str)) {
            webView.getSettings().setMixedContentMode(0);
        } else if (kotlin.jvm.internal.j.d("compatibility", str)) {
            webView.getSettings().setMixedContentMode(2);
        }
    }

    public final void T(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().n = z;
    }

    public final void U(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        int i = 0;
        if (str != null) {
            int hashCode = str.hashCode();
            if (hashCode == -1414557169) {
                str.equals("always");
            } else if (hashCode != 104712844) {
                if (hashCode == 951530617 && str.equals("content")) {
                    i = 1;
                }
            } else if (str.equals("never")) {
                i = 2;
            }
        }
        webView.setOverScrollMode(i);
    }

    public final void V(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        if (WebViewFeature.a("PAYMENT_REQUEST")) {
            WebSettingsCompat.d(webView.getSettings(), z);
        }
    }

    public final void W(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setSaveFormData(!z);
    }

    public final void X(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        webView.getSettings().setLoadWithOverviewMode(z);
        webView.getSettings().setUseWideViewPort(z);
    }

    public final void Y(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setBuiltInZoomControls(z);
    }

    public final void Z(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setDisplayZoomControls(z);
    }

    public final void a0(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setSupportMultipleWindows(z);
    }

    public final void b0(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setHorizontalScrollBarEnabled(z);
    }

    public final f c(p0 context) {
        kotlin.jvm.internal.j.i(context, "context");
        return new f(context);
    }

    public final void c0(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setVerticalScrollBarEnabled(z);
    }

    public final p d(p0 context) {
        kotlin.jvm.internal.j.i(context, "context");
        return e(context, c(context));
    }

    public final void d0(p viewWrapper, ReadableMap readableMap) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        this.i = readableMap;
    }

    public final p e(p0 context, final f webView) {
        kotlin.jvm.internal.j.i(context, "context");
        kotlin.jvm.internal.j.i(webView, "webView");
        j0(webView);
        context.addLifecycleEventListener(webView);
        this.c.a(webView);
        WebSettings settings = webView.getSettings();
        kotlin.jvm.internal.j.h(settings, "getSettings(...)");
        settings.setBuiltInZoomControls(true);
        settings.setDisplayZoomControls(false);
        settings.setDomStorageEnabled(true);
        settings.setSupportMultipleWindows(true);
        settings.setAllowFileAccess(false);
        settings.setAllowContentAccess(false);
        settings.setAllowFileAccessFromFileURLs(false);
        settings.setAllowUniversalAccessFromFileURLs(false);
        settings.setMixedContentMode(1);
        webView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        if (b3.a.b) {
            WebView.setWebContentsDebuggingEnabled(true);
        }
        webView.setDownloadListener(new DownloadListener() {
            @Override
            public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                k.f(f.this, this, str, str2, str3, str4, j);
            }
        });
        return new p(context, webView);
    }

    public final void e0(p viewWrapper, int i) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setTextZoom(i);
    }

    public final void f0(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        CookieManager.getInstance().setAcceptThirdPartyCookies(viewWrapper.getWebView(), z);
    }

    public final Map g() {
        return Z2.e.a().b("goBack", Integer.valueOf(this.r)).b("goForward", Integer.valueOf(this.s)).b("reload", Integer.valueOf(this.t)).b("stopLoading", Integer.valueOf(this.u)).b("postMessage", Integer.valueOf(this.v)).b("injectJavaScript", Integer.valueOf(this.w)).b("loadUrl", Integer.valueOf(this.x)).b("requestFocus", Integer.valueOf(this.y)).b("clearFormData", Integer.valueOf(this.z)).b("clearCache", Integer.valueOf(this.A)).b("clearHistory", Integer.valueOf(this.B)).a();
    }

    public final void g0(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        this.j = str;
        h0(viewWrapper);
    }

    public final void i0(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        WebView.setWebContentsDebuggingEnabled(z);
    }

    public final void l(p viewWrapper) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        ReadableMap readableMap = this.i;
        if (readableMap != null) {
            j(viewWrapper, readableMap);
        }
        this.i = null;
    }

    public final void m(p viewWrapper) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        webView.getThemedReactContext().removeLifecycleEventListener(webView);
        webView.c();
        webView.A = null;
    }

    public final void n(p viewWrapper, String commandId, ReadableArray args) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        kotlin.jvm.internal.j.i(commandId, "commandId");
        kotlin.jvm.internal.j.i(args, "args");
        f webView = viewWrapper.getWebView();
        switch (commandId.hashCode()) {
            case -1241591313:
                if (commandId.equals("goBack")) {
                    webView.goBack();
                    return;
                }
                return;
            case -948122918:
                if (commandId.equals("stopLoading")) {
                    webView.stopLoading();
                    return;
                }
                return;
            case -934641255:
                if (commandId.equals("reload")) {
                    webView.reload();
                    return;
                }
                return;
            case -759238347:
                if (commandId.equals("clearCache")) {
                    webView.clearCache(args.getBoolean(0));
                    return;
                }
                return;
            case -318289731:
                if (commandId.equals("goForward")) {
                    webView.goForward();
                    return;
                }
                return;
            case -265032709:
                if (commandId.equals("clearFormData")) {
                    webView.clearFormData();
                    return;
                }
                return;
            case 336631465:
                if (commandId.equals("loadUrl")) {
                    String string = args.getString(0);
                    if (string == null) {
                        throw new RuntimeException("Arguments for loading an url are null!");
                    }
                    webView.y.b(false);
                    webView.loadUrl(string);
                    return;
                }
                return;
            case 903120263:
                if (commandId.equals("clearHistory")) {
                    webView.clearHistory();
                    return;
                }
                return;
            case 1280029577:
                if (commandId.equals("requestFocus")) {
                    webView.requestFocus();
                    return;
                }
                return;
            case 1490029383:
                if (commandId.equals("postMessage")) {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("data", args.getString(0));
                        webView.h("(function () {var event;var data = " + jSONObject + ";try {event = new MessageEvent('message', data);} catch (e) {event = document.createEvent('MessageEvent');event.initMessageEvent('message', true, true, data.data, data.origin, data.lastEventId, data.source);}document.dispatchEvent(event);})();");
                        return;
                    } catch (JSONException e) {
                        throw new RuntimeException(e);
                    }
                }
                return;
            case 2104576510:
                if (commandId.equals("injectJavaScript")) {
                    webView.h(args.getString(0));
                    return;
                }
                return;
            default:
                return;
        }
    }

    public final void o(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setAllowFileAccess(z);
    }

    public final void p(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setAllowFileAccessFromFileURLs(z);
    }

    public final void q(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setAllowUniversalAccessFromFileURLs(z);
    }

    public final void r(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        this.d = z;
        j0(webView);
    }

    public final void s(p viewWrapper, boolean z) {
        WebChromeClient webChromeClient;
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        f webView = viewWrapper.getWebView();
        this.e = z;
        if (Build.VERSION.SDK_INT < 26 || (webChromeClient = webView.getWebChromeClient()) == null || !(webChromeClient instanceof com.reactnativecommunity.webview.c)) {
            return;
        }
        ((com.reactnativecommunity.webview.c) webChromeClient).f(z);
    }

    public final void t(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setLayerType(kotlin.jvm.internal.j.d(str, "hardware") ? 2 : kotlin.jvm.internal.j.d(str, "software") ? 1 : 0, null);
    }

    public final void u(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        if (str != null) {
            this.k = WebSettings.getDefaultUserAgent(viewWrapper.getWebView().getContext()) + " " + str;
        } else {
            this.k = null;
        }
        h0(viewWrapper);
    }

    public final void v(p viewWrapper, ReadableMap readableMap) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setBasicAuthCredential((readableMap != null && readableMap.hasKey("username") && readableMap.hasKey("password")) ? new com.reactnativecommunity.webview.a(readableMap.getString("username"), readableMap.getString("password")) : null);
    }

    public final void w(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setCacheMode(z ? -1 : 2);
    }

    public final void x(p viewWrapper, String str) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        WebSettings settings = viewWrapper.getWebView().getSettings();
        int i = -1;
        if (str != null) {
            switch (str.hashCode()) {
                case -2059164003:
                    if (str.equals("LOAD_NO_CACHE")) {
                        i = 2;
                        break;
                    }
                    break;
                case -1215135800:
                    str.equals("LOAD_DEFAULT");
                    break;
                case -873877826:
                    if (str.equals("LOAD_CACHE_ELSE_NETWORK")) {
                        i = 1;
                        break;
                    }
                    break;
                case 1548620642:
                    if (str.equals("LOAD_CACHE_ONLY")) {
                        i = 3;
                        break;
                    }
                    break;
            }
        }
        settings.setCacheMode(i);
    }

    public final void y(p viewWrapper, boolean z) {
        kotlin.jvm.internal.j.i(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setDomStorageEnabled(z);
    }

    public final void z(String str) {
        this.f = str;
    }

    public k(boolean z) {
        this.a = z;
        this.b = "RNCWebViewManagerImpl";
        this.c = new RNCWebViewConfig() {
            @Override
            public final void a(WebView webView) {
                k.k(webView);
            }
        };
        this.l = "UTF-8";
        this.m = "text/html";
        this.n = "POST";
        this.o = "about:blank";
        this.p = "Downloading";
        this.q = "Cannot download files as permission was denied. Please provide permission to write to storage, in order to download files.";
        this.r = 1;
        this.s = 2;
        this.t = 3;
        this.u = 4;
        this.v = 5;
        this.w = 6;
        this.x = 7;
        this.y = 8;
        this.z = 1000;
        this.A = 1001;
        this.B = 1002;
    }

    public k(boolean z, int i, DefaultConstructorMarker defaultConstructorMarker) {
        this((i & 1) != 0 ? false : z);
    }
}