Browse Source

fix(android): duplicate `setWebChromeClient()` overwrite (#1417)

Jacob Müller 4 years ago
parent
commit
2f8c4c5067
No account linked to committer's email address

+ 5
- 10
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java View File

@@ -409,7 +409,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
409 409
   public void setMessagingModuleName(WebView view, String moduleName) {
410 410
     ((RNCWebView) view).setMessagingModuleName(moduleName);
411 411
   }
412
-   
412
+
413 413
   @ReactProp(name = "incognito")
414 414
   public void setIncognito(WebView view, boolean enabled) {
415 415
     // Remove all previous cookies
@@ -660,7 +660,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
660 660
         public Bitmap getDefaultVideoPoster() {
661 661
           return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
662 662
         }
663
-        
663
+
664 664
         @Override
665 665
         public void onShowCustomView(View view, CustomViewCallback callback) {
666 666
           if (mVideoView != null) {
@@ -1086,8 +1086,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1086 1086
       }
1087 1087
     }
1088 1088
 
1089
+    WebChromeClient mWebChromeClient;
1089 1090
     @Override
1090 1091
     public void setWebChromeClient(WebChromeClient client) {
1092
+      this.mWebChromeClient = client;
1091 1093
       super.setWebChromeClient(client);
1092 1094
       if (client instanceof RNCWebChromeClient) {
1093 1095
         ((RNCWebChromeClient) client).setProgressChangedFilter(progressChangedFilter);
@@ -1234,16 +1236,9 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
1234 1236
       destroy();
1235 1237
     }
1236 1238
 
1237
-    WebChromeClient mWebChromeClient;
1238
-    @Override
1239
-    public void setWebChromeClient(WebChromeClient client) {
1240
-      this.mWebChromeClient = client;
1241
-      super.setWebChromeClient(client);
1242
-    }
1243
-
1244 1239
     @Override
1245 1240
     public void destroy() {
1246
-      if(mWebChromeClient!=null){
1241
+      if (mWebChromeClient != null) {
1247 1242
         mWebChromeClient.onHideCustomView();
1248 1243
       }
1249 1244
       super.destroy();