导航菜单

页面标题

页面副标题

BAM Crawford v6.14.1 - j.java 源代码

正在查看: BAM Crawford v6.14.1 应用的 j.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 com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.uimanager.v0;
import com.subsplash.thechurchapp.handlers.system.EmailHandler;
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 ok.u;
import okhttp3.HttpUrl;
import okhttp3.internal.ws.WebSocketProtocol;
import org.json.JSONException;
import org.json.JSONObject;

public final class j {
    public static final a A = new a(null);
    private boolean c;
    private boolean d;
    private String e;
    private String f;
    private boolean g;
    private String h;
    private String i;
    private final String a = "RNCWebViewManagerImpl";
    private g b = new g() {
        @Override
        public final void a(WebView webView) {
            j.j(webView);
        }
    };
    private final String j = "UTF-8";
    private final String k = "text/html";
    private final String l = "POST";
    private final String m = "about:blank";
    private final String n = "Downloading";
    private final String o = "Cannot download files as permission was denied. Please provide permission to write to storage, in order to download files.";
    private final int p = 1;
    private final int q = 2;
    private final int r = 3;
    private final int s = 4;
    private final int t = 5;
    private final int u = 6;
    private final int v = 7;
    private final int w = 8;
    private final int x = 1000;
    private final int y = WebSocketProtocol.CLOSE_CLIENT_GOING_AWAY;
    private final int z = 1002;

    public static final class a {
        private a() {
        }

        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

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

        @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 D;
        final int E;

        c(d dVar, Activity activity, int i) {
            super(dVar);
            this.D = activity;
            this.E = i;
        }

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

        @Override
        public void onHideCustomView() {
            if (this.q == null) {
                return;
            }
            ViewGroup c = c();
            if (c.getRootView() != this.p.getRootView()) {
                this.p.getRootView().setVisibility(0);
            } else {
                this.p.setVisibility(0);
            }
            this.D.getWindow().clearFlags(512);
            c.removeView(this.q);
            this.r.onCustomViewHidden();
            this.q = null;
            this.r = null;
            this.D.setRequestedOrientation(this.E);
            this.p.getThemedReactContext().removeLifecycleEventListener(this);
        }

        @Override
        public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
            kotlin.jvm.internal.k.e(view, "view");
            kotlin.jvm.internal.k.e(callback, "callback");
            if (this.q != null) {
                callback.onCustomViewHidden();
                return;
            }
            this.q = view;
            this.r = callback;
            this.D.setRequestedOrientation(-1);
            this.q.setSystemUiVisibility(7942);
            this.D.getWindow().setFlags(512, 512);
            this.q.setBackgroundColor(-16777216);
            ViewGroup c = c();
            c.addView(this.q, com.reactnativecommunity.webview.c.C);
            if (c.getRootView() != this.p.getRootView()) {
                this.p.getRootView().setVisibility(8);
            } else {
                this.p.setVisibility(8);
            }
            this.p.getThemedReactContext().addLifecycleEventListener(this);
        }
    }

    private final void e0(o oVar) {
        d webView = oVar.getWebView();
        if (this.h != null) {
            webView.getSettings().setUserAgentString(this.h);
        } else if (this.i != null) {
            webView.getSettings().setUserAgentString(this.i);
        } else {
            webView.getSettings().setUserAgentString(WebSettings.getDefaultUserAgent(webView.getContext()));
        }
    }

    public static final void f(d webView, j this$0, String str, String str2, String str3, String str4, long j) {
        kotlin.jvm.internal.k.e(webView, "$webView");
        kotlin.jvm.internal.k.e(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 fileName = p.a(str, str3, str4);
            kotlin.jvm.internal.k.d(fileName, "fileName");
            String e = k.a().e(fileName, "_");
            String str5 = "Downloading " + e;
            try {
                URL url = new URL(str);
                request.addRequestHeader("Cookie", CookieManager.getInstance().getCookie(url.getProtocol() + "://" + url.getHost()));
            } catch (MalformedURLException e2) {
                Log.w(this$0.a, "Error getting cookie for DownloadManager", e2);
            }
            request.addRequestHeader("User-Agent", str2);
            request.setTitle(e);
            request.setDescription(str5);
            request.allowScanningByMediaScanner();
            request.setNotificationVisibility(1);
            request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, e);
            nativeModule.setDownloadRequest(request);
            if (nativeModule.grantFileDownloaderPermissions(this$0.h(), this$0.i())) {
                nativeModule.downloadFile(this$0.h());
            }
        } catch (IllegalArgumentException e3) {
            Log.w(this$0.a, "Unsupported URI, aborting download", e3);
        }
    }

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

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

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

    public static final void j(WebView webView) {
    }

    public final void A(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        this.g = z;
        g0(webView);
    }

    public final void B(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setHasScrollEvent(z);
    }

    public final void C(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d 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 D(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().p = str;
    }

    public final void E(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().q = str;
    }

    public final void F(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().t = z;
    }

    public final void G(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().s = z;
    }

    public final void H(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setInjectedJavaScriptObject(str);
    }

    public final void I(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setJavaScriptCanOpenWindowsAutomatically(z);
    }

    public final void J(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setJavaScriptEnabled(z);
    }

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

    public final void L(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setMediaPlaybackRequiresUserGesture(z);
    }

    public final void M(o viewWrapper, ReadableArray value) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        kotlin.jvm.internal.k.e(value, "value");
        d webView = viewWrapper.getWebView();
        ArrayList arrayList = value.toArrayList();
        kotlin.jvm.internal.k.c(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 N(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setMessagingEnabled(z);
    }

    public final void O(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().v = str;
    }

    public final void P(o viewWrapper, int i) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setMinimumFontSize(i);
    }

    public final void Q(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        if (str == null || kotlin.jvm.internal.k.a("never", str)) {
            webView.getSettings().setMixedContentMode(1);
        } else if (kotlin.jvm.internal.k.a("always", str)) {
            webView.getSettings().setMixedContentMode(0);
        } else if (kotlin.jvm.internal.k.a("compatibility", str)) {
            webView.getSettings().setMixedContentMode(2);
        }
    }

    public final void R(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().B = z;
    }

    public final void S(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d 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 T(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setSaveFormData(!z);
    }

    public final void U(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        webView.getSettings().setLoadWithOverviewMode(z);
        webView.getSettings().setUseWideViewPort(z);
    }

    public final void V(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setBuiltInZoomControls(z);
    }

    public final void W(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setDisplayZoomControls(z);
    }

    public final void X(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setSupportMultipleWindows(z);
    }

    public final void Y(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setHorizontalScrollBarEnabled(z);
    }

    public final void Z(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setVerticalScrollBarEnabled(z);
    }

    public final void a0(o viewWrapper, ReadableMap readableMap, boolean z) {
        boolean l;
        byte[] bArr;
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        if (readableMap != null) {
            boolean hasKey = readableMap.hasKey("html");
            String str = HttpUrl.FRAGMENT_ENCODE_SET;
            if (hasKey) {
                String string = readableMap.getString("html");
                if (readableMap.hasKey("baseUrl")) {
                    str = readableMap.getString("baseUrl");
                }
                kotlin.jvm.internal.k.b(string);
                webView.loadDataWithBaseURL(str, string, this.k, this.j, null);
                return;
            }
            if (readableMap.hasKey("uri")) {
                String string2 = readableMap.getString("uri");
                String url = webView.getUrl();
                if (url == null || !kotlin.jvm.internal.k.a(url, string2)) {
                    if (readableMap.hasKey("method")) {
                        l = u.l(readableMap.getString("method"), this.l, true);
                        if (l) {
                            if (readableMap.hasKey(EmailHandler.BODY)) {
                                String string3 = readableMap.getString(EmailHandler.BODY);
                                try {
                                    kotlin.jvm.internal.k.b(string3);
                                    Charset forName = Charset.forName("UTF-8");
                                    kotlin.jvm.internal.k.d(forName, "forName(charsetName)");
                                    bArr = string3.getBytes(forName);
                                    kotlin.jvm.internal.k.d(bArr, "this as java.lang.String).getBytes(charset)");
                                } catch (UnsupportedEncodingException unused) {
                                    kotlin.jvm.internal.k.b(string3);
                                    bArr = string3.getBytes(ok.d.b);
                                    kotlin.jvm.internal.k.d(bArr, "this as java.lang.String).getBytes(charset)");
                                }
                            } else {
                                bArr = null;
                            }
                            if (bArr == null) {
                                bArr = new byte[0];
                            }
                            kotlin.jvm.internal.k.b(string2);
                            webView.postUrl(string2, bArr);
                            return;
                        }
                    }
                    HashMap hashMap = new HashMap();
                    if (readableMap.hasKey("headers")) {
                        if (z) {
                            ReadableArray array = readableMap.getArray("headers");
                            kotlin.jvm.internal.k.b(array);
                            Iterator it = array.toArrayList().iterator();
                            while (it.hasNext()) {
                                Object next = it.next();
                                kotlin.jvm.internal.k.c(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 str2 = (String) hashMap2.get("name");
                                if (str2 == null) {
                                    str2 = HttpUrl.FRAGMENT_ENCODE_SET;
                                }
                                String str3 = (String) hashMap2.get("value");
                                if (str3 == null) {
                                    str3 = HttpUrl.FRAGMENT_ENCODE_SET;
                                }
                                Locale ENGLISH = Locale.ENGLISH;
                                kotlin.jvm.internal.k.d(ENGLISH, "ENGLISH");
                                String lowerCase = str2.toLowerCase(ENGLISH);
                                kotlin.jvm.internal.k.d(lowerCase, "this as java.lang.String).toLowerCase(locale)");
                                if (kotlin.jvm.internal.k.a("user-agent", lowerCase)) {
                                    webView.getSettings().setUserAgentString(str3);
                                } else {
                                    hashMap.put(str2, str3);
                                }
                            }
                        } else {
                            ReadableMap map = readableMap.getMap("headers");
                            kotlin.jvm.internal.k.b(map);
                            ReadableMapKeySetIterator keySetIterator = map.keySetIterator();
                            kotlin.jvm.internal.k.d(keySetIterator, "headers!!.keySetIterator()");
                            while (keySetIterator.hasNextKey()) {
                                String key = keySetIterator.nextKey();
                                kotlin.jvm.internal.k.d(key, "key");
                                Locale ENGLISH2 = Locale.ENGLISH;
                                kotlin.jvm.internal.k.d(ENGLISH2, "ENGLISH");
                                String lowerCase2 = key.toLowerCase(ENGLISH2);
                                kotlin.jvm.internal.k.d(lowerCase2, "this as java.lang.String).toLowerCase(locale)");
                                if (kotlin.jvm.internal.k.a("user-agent", lowerCase2)) {
                                    webView.getSettings().setUserAgentString(map.getString(key));
                                } else {
                                    hashMap.put(key, map.getString(key));
                                }
                            }
                        }
                    }
                    kotlin.jvm.internal.k.b(string2);
                    webView.loadUrl(string2, hashMap);
                    return;
                }
                return;
            }
        }
        webView.loadUrl(this.m);
    }

    public final void b0(o viewWrapper, int i) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setTextZoom(i);
    }

    public final d c(v0 context) {
        kotlin.jvm.internal.k.e(context, "context");
        return new d(context);
    }

    public final void c0(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        CookieManager.getInstance().setAcceptThirdPartyCookies(viewWrapper.getWebView(), z);
    }

    public final o d(v0 context) {
        kotlin.jvm.internal.k.e(context, "context");
        return e(context, c(context));
    }

    public final void d0(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        this.h = str;
        e0(viewWrapper);
    }

    public final o e(v0 context, final d webView) {
        kotlin.jvm.internal.k.e(context, "context");
        kotlin.jvm.internal.k.e(webView, "webView");
        g0(webView);
        context.addLifecycleEventListener(webView);
        this.b.a(webView);
        WebSettings settings = webView.getSettings();
        kotlin.jvm.internal.k.d(settings, "webView.settings");
        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));
        webView.setDownloadListener(new DownloadListener() {
            @Override
            public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                j.f(d.this, this, str, str2, str3, str4, j);
            }
        });
        return new o(context, webView);
    }

    public final void f0(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        WebView.setWebContentsDebuggingEnabled(z);
    }

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

    public final void k(o viewWrapper) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        webView.getThemedReactContext().removeLifecycleEventListener(webView);
        webView.c();
        webView.E = null;
    }

    public final void l(o viewWrapper, String commandId, ReadableArray args) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        kotlin.jvm.internal.k.e(commandId, "commandId");
        kotlin.jvm.internal.k.e(args, "args");
        d 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")) {
                    webView.C.b(false);
                    webView.loadUrl(args.getString(0));
                    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 m(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setAllowFileAccess(z);
    }

    public final void n(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setAllowFileAccessFromFileURLs(z);
    }

    public final void o(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setAllowUniversalAccessFromFileURLs(z);
    }

    public final void p(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        this.c = z;
        g0(webView);
    }

    public final void q(o viewWrapper, boolean z) {
        WebChromeClient webChromeClient;
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        this.d = 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 r(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().setLayerType(kotlin.jvm.internal.k.a(str, "hardware") ? 2 : kotlin.jvm.internal.k.a(str, "software") ? 1 : 0, null);
    }

    public final void s(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        if (str != null) {
            this.i = WebSettings.getDefaultUserAgent(viewWrapper.getWebView().getContext()) + " " + str;
        } else {
            this.i = null;
        }
        e0(viewWrapper);
    }

    public final void t(o viewWrapper, ReadableMap readableMap) {
        kotlin.jvm.internal.k.e(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 u(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setCacheMode(z ? -1 : 2);
    }

    public final void v(o viewWrapper, String str) {
        kotlin.jvm.internal.k.e(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 w(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setDomStorageEnabled(z);
    }

    public final void x(String str) {
        this.e = str;
    }

    public final void y(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        d webView = viewWrapper.getWebView();
        if (Build.VERSION.SDK_INT > 28) {
            if (f1.c.a("FORCE_DARK")) {
                f1.b.b(webView.getSettings(), z ? 2 : 0);
            }
            if (z && f1.c.a("FORCE_DARK_STRATEGY")) {
                f1.b.c(webView.getSettings(), 2);
            }
        }
    }

    public final void z(o viewWrapper, boolean z) {
        kotlin.jvm.internal.k.e(viewWrapper, "viewWrapper");
        viewWrapper.getWebView().getSettings().setGeolocationEnabled(z);
    }
}