正在查看: Oolka v2.4.42 应用的 RNCWebViewManagerImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Oolka v2.4.42 应用的 RNCWebViewManagerImpl.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.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.common.MapBuilder;
import com.facebook.react.uimanager.ThemedReactContext;
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.Metadata;
import kotlin.io.ConstantsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.StringsKt__StringsJVMKt;
import org.apache.commons.lang3.StringUtils;
import org.apache.fontbox.ttf.NamingTable;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;
@Metadata
public final class RNCWebViewManagerImpl {
@NotNull
public static final a C = new a(null);
public final int A;
public final int B;
public final boolean a;
@NotNull
public final String b;
@NotNull
public h c;
public boolean d;
public boolean e;
public String f;
public String g;
public boolean h;
public ReadableMap i;
public String j;
public String k;
@NotNull
public final String l;
@NotNull
public final String m;
@NotNull
public final String n;
@NotNull
public final String o;
@NotNull
public final String p;
@NotNull
public final String q;
public final int r;
public final int s;
public final int t;
public final int u;
public final int v;
public final int w;
public final int x;
public final int y;
public final int z;
@Metadata
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public a() {
}
}
@Metadata
public static final class b extends com.reactnativecommunity.webview.c {
public b(e eVar) {
super(eVar);
}
@Override
public Bitmap getDefaultVideoPoster() {
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
}
}
@Metadata
public static final class c extends com.reactnativecommunity.webview.c {
public final Activity o;
public final int p;
public c(e eVar, Activity activity, int i) {
super(eVar);
this.o = activity;
this.p = 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.o.getWindow().clearFlags(ConstantsKt.MINIMUM_BLOCK_SIZE);
c.removeView(this.b);
this.c.onCustomViewHidden();
this.b = null;
this.c = null;
this.o.setRequestedOrientation(this.p);
this.a.getThemedReactContext().removeLifecycleEventListener(this);
}
@Override
public void onShowCustomView(@NotNull View view, @NotNull WebChromeClient.CustomViewCallback callback) {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(callback, "callback");
if (this.b != null) {
callback.onCustomViewHidden();
return;
}
this.b = view;
this.c = callback;
this.o.setRequestedOrientation(-1);
this.b.setSystemUiVisibility(7942);
this.o.getWindow().setFlags(ConstantsKt.MINIMUM_BLOCK_SIZE, ConstantsKt.MINIMUM_BLOCK_SIZE);
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 RNCWebViewManagerImpl() {
this(false, 1, null);
}
public static final void f(e webView, RNCWebViewManagerImpl this$0, String str, String str2, String str3, String str4, long j) {
Intrinsics.checkNotNullParameter(webView, "$webView");
Intrinsics.checkNotNullParameter(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 = URLUtil.a(str, str3, str4);
Intrinsics.checkNotNull(a2);
String replace = k.a().replace(a2, "_");
String str5 = "Downloading " + replace;
try {
URL url = new URL(str);
request.addRequestHeader("Cookie", CookieManager.getInstance().getCookie(url.getProtocol() + "://" + url.getHost()));
} catch (MalformedURLException unused) {
String str6 = this$0.b;
}
request.addRequestHeader("User-Agent", str2);
request.setTitle(replace);
request.setDescription(str5);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(1);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, replace);
nativeModule.setDownloadRequest(request);
if (nativeModule.grantFileDownloaderPermissions(this$0.h(), this$0.i())) {
nativeModule.downloadFile(this$0.h());
}
} catch (IllegalArgumentException unused2) {
String str7 = this$0.b;
}
}
public static final void k(WebView webView) {
}
public final void A(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
if (Build.VERSION.SDK_INT > 28) {
if (androidx.webkit.d.a("FORCE_DARK")) {
androidx.webkit.b.b(webView.getSettings(), z ? 2 : 0);
}
if (z && androidx.webkit.d.a("FORCE_DARK_STRATEGY")) {
androidx.webkit.b.c(webView.getSettings(), 2);
}
}
}
public final void B(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setGeolocationEnabled(z);
}
public final void C(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
this.h = z;
j0(webView);
}
public final void D(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setHasScrollEvent(z);
}
public final void E(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e 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(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().a = str;
}
public final void G(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().b = str;
}
public final void H(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().f = z;
}
public final void I(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().e = z;
}
public final void J(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setInjectedJavaScriptObject(str);
}
public final void K(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setJavaScriptCanOpenWindowsAutomatically(z);
}
public final void L(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setJavaScriptEnabled(z);
}
public final void M(String str) {
this.g = str;
}
public final void N(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setMediaPlaybackRequiresUserGesture(z);
}
public final void O(@NotNull n viewWrapper, ReadableArray readableArray) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
if (readableArray == null) {
webView.setMenuCustomItems(null);
return;
}
ArrayList arrayList = readableArray.toArrayList();
Intrinsics.checkNotNull(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(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setMessagingEnabled(z);
}
public final void Q(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().h = str;
}
public final void R(@NotNull n viewWrapper, int i) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setMinimumFontSize(i);
}
public final void S(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
if (str == null || Intrinsics.areEqual("never", str)) {
webView.getSettings().setMixedContentMode(1);
} else if (Intrinsics.areEqual("always", str)) {
webView.getSettings().setMixedContentMode(0);
} else if (Intrinsics.areEqual("compatibility", str)) {
webView.getSettings().setMixedContentMode(2);
}
}
public final void T(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().n = z;
}
public final void U(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e 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(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
if (androidx.webkit.d.a("PAYMENT_REQUEST")) {
androidx.webkit.b.d(webView.getSettings(), z);
}
}
public final void W(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setSaveFormData(!z);
}
public final void X(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
webView.getSettings().setLoadWithOverviewMode(z);
webView.getSettings().setUseWideViewPort(z);
}
public final void Y(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setBuiltInZoomControls(z);
}
public final void Z(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setDisplayZoomControls(z);
}
public final void a0(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setSupportMultipleWindows(z);
}
public final void b0(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setHorizontalScrollBarEnabled(z);
}
@NotNull
public final e c(@NotNull ThemedReactContext context) {
Intrinsics.checkNotNullParameter(context, "context");
return new e(context);
}
public final void c0(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setVerticalScrollBarEnabled(z);
}
@NotNull
public final n d(@NotNull ThemedReactContext context) {
Intrinsics.checkNotNullParameter(context, "context");
return e(context, c(context));
}
public final void d0(@NotNull n viewWrapper, ReadableMap readableMap) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
this.i = readableMap;
}
@NotNull
public final n e(@NotNull ThemedReactContext context, @NotNull final e webView) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(webView, "webView");
j0(webView);
context.addLifecycleEventListener(webView);
this.c.a(webView);
WebSettings settings = webView.getSettings();
Intrinsics.checkNotNullExpressionValue(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));
webView.setDownloadListener(new DownloadListener() {
@Override
public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
RNCWebViewManagerImpl.f(e.this, this, str, str2, str3, str4, j);
}
});
return new n(context, webView);
}
public final void e0(@NotNull n viewWrapper, int i) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setTextZoom(i);
}
public final void f0(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
CookieManager.getInstance().setAcceptThirdPartyCookies(viewWrapper.getWebView(), z);
}
public final Map<String, Integer> g() {
return MapBuilder.builder().put("goBack", Integer.valueOf(this.r)).put("goForward", Integer.valueOf(this.s)).put("reload", Integer.valueOf(this.t)).put("stopLoading", Integer.valueOf(this.u)).put("postMessage", Integer.valueOf(this.v)).put("injectJavaScript", Integer.valueOf(this.w)).put("loadUrl", Integer.valueOf(this.x)).put("requestFocus", Integer.valueOf(this.y)).put("clearFormData", Integer.valueOf(this.z)).put("clearCache", Integer.valueOf(this.A)).put("clearHistory", Integer.valueOf(this.B)).build();
}
public final void g0(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
this.j = str;
h0(viewWrapper);
}
public final String h() {
String str = this.f;
return str == null ? this.p : str;
}
public final void h0(n nVar) {
e webView = nVar.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()));
}
}
public final String i() {
String str = this.g;
return str == null ? this.q : str;
}
public final void i0(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
WebView.setWebContentsDebuggingEnabled(z);
}
public final void j(n nVar, ReadableMap readableMap) {
byte[] bArr;
e webView = nVar.getWebView();
if (readableMap != null) {
if (readableMap.hasKey("html")) {
String string = readableMap.getString("html");
String string2 = readableMap.hasKey("baseUrl") ? readableMap.getString("baseUrl") : "";
Intrinsics.checkNotNull(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 || !Intrinsics.areEqual(url, string3)) {
if (readableMap.hasKey("method") && StringsKt__StringsJVMKt.equals(readableMap.getString("method"), this.n, true)) {
if (readableMap.hasKey("body")) {
String string4 = readableMap.getString("body");
try {
Intrinsics.checkNotNull(string4);
Charset forName = Charset.forName("UTF-8");
Intrinsics.checkNotNullExpressionValue(forName, "forName(...)");
bArr = string4.getBytes(forName);
Intrinsics.checkNotNullExpressionValue(bArr, "getBytes(...)");
} catch (UnsupportedEncodingException unused) {
Intrinsics.checkNotNull(string4);
bArr = string4.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bArr, "getBytes(...)");
}
} else {
bArr = null;
}
if (bArr == null) {
bArr = new byte[0];
}
Intrinsics.checkNotNull(string3);
webView.postUrl(string3, bArr);
return;
}
HashMap hashMap = new HashMap();
if (readableMap.hasKey("headers")) {
if (this.a) {
ReadableArray array = readableMap.getArray("headers");
Intrinsics.checkNotNull(array);
Iterator it = array.toArrayList().iterator();
while (it.hasNext()) {
Object next = it.next();
Intrinsics.checkNotNull(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(NamingTable.TAG);
if (str == null) {
str = "";
}
String str2 = (String) hashMap2.get("value");
if (str2 == null) {
str2 = "";
}
Locale ENGLISH = Locale.ENGLISH;
Intrinsics.checkNotNullExpressionValue(ENGLISH, "ENGLISH");
String lowerCase = str.toLowerCase(ENGLISH);
Intrinsics.checkNotNullExpressionValue(lowerCase, "toLowerCase(...)");
if (Intrinsics.areEqual("user-agent", lowerCase)) {
webView.getSettings().setUserAgentString(str2);
} else {
hashMap.put(str, str2);
}
}
} else {
ReadableMap map = readableMap.getMap("headers");
Intrinsics.checkNotNull(map);
ReadableMapKeySetIterator keySetIterator = map.keySetIterator();
Intrinsics.checkNotNullExpressionValue(keySetIterator, "keySetIterator(...)");
while (keySetIterator.hasNextKey()) {
String nextKey = keySetIterator.nextKey();
Intrinsics.checkNotNull(nextKey);
Locale ENGLISH2 = Locale.ENGLISH;
Intrinsics.checkNotNullExpressionValue(ENGLISH2, "ENGLISH");
String lowerCase2 = nextKey.toLowerCase(ENGLISH2);
Intrinsics.checkNotNullExpressionValue(lowerCase2, "toLowerCase(...)");
if (Intrinsics.areEqual("user-agent", lowerCase2)) {
webView.getSettings().setUserAgentString(map.getString(nextKey));
} else {
hashMap.put(nextKey, map.getString(nextKey));
}
}
}
}
Intrinsics.checkNotNull(string3);
webView.loadUrl(string3, hashMap);
return;
}
return;
}
}
webView.loadUrl(this.o);
}
public final void j0(e eVar) {
Activity currentActivity = eVar.getThemedReactContext().getCurrentActivity();
if (this.d && currentActivity != null) {
c cVar = new c(eVar, currentActivity, currentActivity.getRequestedOrientation());
cVar.f(this.e);
cVar.g(this.h);
eVar.setWebChromeClient(cVar);
return;
}
com.reactnativecommunity.webview.c cVar2 = (com.reactnativecommunity.webview.c) eVar.getWebChromeClient();
if (cVar2 != null) {
cVar2.onHideCustomView();
}
b bVar = new b(eVar);
bVar.f(this.e);
bVar.g(this.h);
eVar.setWebChromeClient(bVar);
}
public final void l(@NotNull n viewWrapper) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
ReadableMap readableMap = this.i;
if (readableMap != null) {
j(viewWrapper, readableMap);
}
this.i = null;
}
public final void m(@NotNull n viewWrapper) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
webView.getThemedReactContext().removeLifecycleEventListener(webView);
webView.c();
webView.q = null;
}
public final void n(@NotNull n viewWrapper, @NotNull String commandId, @NotNull ReadableArray args) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
Intrinsics.checkNotNullParameter(commandId, "commandId");
Intrinsics.checkNotNullParameter(args, "args");
e 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.o.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(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setAllowFileAccess(z);
}
public final void p(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setAllowFileAccessFromFileURLs(z);
}
public final void q(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setAllowUniversalAccessFromFileURLs(z);
}
public final void r(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e webView = viewWrapper.getWebView();
this.d = z;
j0(webView);
}
public final void s(@NotNull n viewWrapper, boolean z) {
WebChromeClient webChromeClient;
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
e 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(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().setLayerType(Intrinsics.areEqual(str, "hardware") ? 2 : Intrinsics.areEqual(str, "software") ? 1 : 0, null);
}
public final void u(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
if (str != null) {
this.k = WebSettings.getDefaultUserAgent(viewWrapper.getWebView().getContext()) + StringUtils.SPACE + str;
} else {
this.k = null;
}
h0(viewWrapper);
}
public final void v(@NotNull n viewWrapper, ReadableMap readableMap) {
Intrinsics.checkNotNullParameter(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(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setCacheMode(z ? -1 : 2);
}
public final void x(@NotNull n viewWrapper, String str) {
Intrinsics.checkNotNullParameter(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(@NotNull n viewWrapper, boolean z) {
Intrinsics.checkNotNullParameter(viewWrapper, "viewWrapper");
viewWrapper.getWebView().getSettings().setDomStorageEnabled(z);
}
public final void z(String str) {
this.f = str;
}
public RNCWebViewManagerImpl(boolean z) {
this.a = z;
this.b = "RNCWebViewManagerImpl";
this.c = new h() {
@Override
public final void a(WebView webView) {
RNCWebViewManagerImpl.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 RNCWebViewManagerImpl(boolean z, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? false : z);
}
}