erisu commented on code in PR #581:
URL: 
https://github.com/apache/cordova-plugin-file/pull/581#discussion_r1362870355


##########
src/android/FileUtils.java:
##########
@@ -593,14 +593,17 @@ private void getReadPermission(String rawArgs, int 
action, CallbackContext callb
         if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
             PermissionHelper.requestPermissions(this, requestCode, 
             new String[]{Manifest.permission.READ_MEDIA_IMAGES, 
Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.READ_MEDIA_AUDIO});
-          } else {
+        } else {
             PermissionHelper.requestPermission(this, requestCode, 
Manifest.permission.READ_EXTERNAL_STORAGE);
-          }
+        }
     }
 
     private void getWritePermission(String rawArgs, int action, 
CallbackContext callbackContext) {
-        int requestCode = pendingRequests.createRequest(rawArgs, action, 
callbackContext);
-        PermissionHelper.requestPermission(this, requestCode, 
Manifest.permission.WRITE_EXTERNAL_STORAGE);
+       int requestCode = pendingRequests.createRequest(rawArgs, action, 
callbackContext);
+        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+        } else {
+          PermissionHelper.requestPermission(this, requestCode, 
Manifest.permission.WRITE_EXTERNAL_STORAGE);
+        }

Review Comment:
   @EYALIN Can you review the above messages and make the updates?
   
   I believe you do not need to modify the `getWritePermission` method, as I 
previously mentioned the reasons why.
   Only `hasWritePermission` needs to be updated. The code could be simplified 
with what I provided in my previous message.
   
   Also, can you rebase your branch against with Cordova's main branch? There 
are conflicts.
   
   And include Norman's suggestion about including a comment explaining about 
the `true` return.
   
   ```
   // Starting with API 33, requesting WRITE_EXTERNAL_STORAGE is an auto 
permission rejection
   ```



-- 
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: issues-unsubscr...@cordova.apache.org

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


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

Reply via email to