Priyansu431 commented on issue #306:
URL: 
https://github.com/apache/cordova-plugin-file-transfer/issues/306#issuecomment-884796504


   I am also facing same issue.
   
   Replace Whitelist class with AllowList in cordova-plugin-file-transfer > src 
> android > FileTransfer.java
   
   `import org.apache.cordova.Whitelist; ` => `import 
org.apache.cordova.AllowList;`
   
   
   ```
   /* This code exists for compatibility between 3.x and 4.x versions of 
Cordova.
            * Previously the CordovaWebView class had a method, getWhitelist, 
which would
            * return a Whitelist object. Since the fixed whitelist is removed 
in Cordova 4.x,
            * the correct call now is to shouldAllowRequest from the plugin 
manager.
            */
           Boolean shouldAllowRequest = null;
           if (isLocalTransfer) {
               shouldAllowRequest = true;
           }
           if (shouldAllowRequest == null) {
               try {
                   Method gwl = webView.getClass().getMethod("getWhitelist");
                   AllowList whitelist = (AllowList)gwl.invoke(webView);
                   shouldAllowRequest = whitelist.isUrlAllowListed(source);
               } catch (NoSuchMethodException e) {
               } catch (IllegalAccessException e) {
               } catch (InvocationTargetException e) {
               }
           }
   ```
   
   Replace Above code with below code it's work s for me
           
     ```
   /* This code exists for compatibility between 3.x and 4.x versions of 
Cordova.
            * Previously the CordovaWebView class had a method, getWhitelist, 
which would
            * return a Whitelist object. Since the fixed whitelist is removed 
in Cordova 4.x,
            * the correct call now is to shouldAllowRequest from the plugin 
manager.
            */
           Boolean shouldAllowRequest = null;
           if (isLocalTransfer) {
               shouldAllowRequest = true;
           }
           if (shouldAllowRequest == null) {
               try {
                   Method gwl = webView.getClass().getMethod("getWhitelist");
                   AllowList whitelist = (AllowList)gwl.invoke(webView);
                   shouldAllowRequest = whitelist.isUrlAllowListed(source);
               } catch (NoSuchMethodException e) {
               } catch (IllegalAccessException e) {
               } catch (InvocationTargetException e) {
               }
           }
   ```
     https://github.com/Priyansu431/cordova-plugin-file-transfer.git    
           
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to