|
@@ -11,6 +11,7 @@ import android.graphics.Bitmap;
|
11
|
11
|
import android.graphics.Color;
|
12
|
12
|
import android.Manifest;
|
13
|
13
|
import android.net.Uri;
|
|
14
|
+import android.net.http.SslError;
|
14
|
15
|
import android.os.Build;
|
15
|
16
|
import android.os.Environment;
|
16
|
17
|
import androidx.annotation.RequiresApi;
|
|
@@ -27,6 +28,7 @@ import android.webkit.DownloadListener;
|
27
|
28
|
import android.webkit.GeolocationPermissions;
|
28
|
29
|
import android.webkit.JavascriptInterface;
|
29
|
30
|
import android.webkit.PermissionRequest;
|
|
31
|
+import android.webkit.SslErrorHandler;
|
30
|
32
|
import android.webkit.URLUtil;
|
31
|
33
|
import android.webkit.ValueCallback;
|
32
|
34
|
import android.webkit.WebChromeClient;
|
|
@@ -135,6 +137,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
135
|
137
|
protected boolean mAllowsFullscreenVideo = false;
|
136
|
138
|
protected @Nullable String mUserAgent = null;
|
137
|
139
|
protected @Nullable String mUserAgentWithApplicationName = null;
|
|
140
|
+ public static boolean mignoreSslErrors = false;
|
138
|
141
|
|
139
|
142
|
public RNCWebViewManager() {
|
140
|
143
|
mWebViewConfig = new WebViewConfig() {
|
|
@@ -529,6 +532,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
529
|
532
|
((RNCWebView) view).setHasScrollEvent(hasScrollEvent);
|
530
|
533
|
}
|
531
|
534
|
|
|
535
|
+ @ReactProp(name = "ignoreSslErrors")
|
|
536
|
+ public void setIgnoreSslErrors(WebView view, @Nullable Boolean ignoreSslErrors) {
|
|
537
|
+ mignoreSslErrors = ignoreSslErrors != null && ignoreSslErrors;
|
|
538
|
+ }
|
|
539
|
+
|
532
|
540
|
@Override
|
533
|
541
|
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
|
534
|
542
|
// Do not register default touch emitter and let WebView implementation handle touches
|
|
@@ -715,6 +723,15 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
715
|
723
|
protected @Nullable
|
716
|
724
|
ReadableArray mUrlPrefixesForDefaultIntent;
|
717
|
725
|
|
|
726
|
+ @Override
|
|
727
|
+ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
|
728
|
+ if (BuildConfig.DEBUG && mignoreSslErrors) {
|
|
729
|
+ handler.proceed();
|
|
730
|
+ }
|
|
731
|
+
|
|
732
|
+ super.onReceivedSslError(view, handler, error);
|
|
733
|
+ }
|
|
734
|
+
|
718
|
735
|
@Override
|
719
|
736
|
public void onPageFinished(WebView webView, String url) {
|
720
|
737
|
super.onPageFinished(webView, url);
|