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