breautek commented on code in PR #839:
URL: 
https://github.com/apache/cordova-plugin-camera/pull/839#discussion_r1299979892


##########
src/android/CameraLauncher.java:
##########
@@ -1312,20 +1312,39 @@ public void onScanCompleted(String path, Uri uri) {
     }
 
     public void onRequestPermissionResult(int requestCode, String[] 
permissions,
-                                          int[] grantResults) {
-        for (int r : grantResults) {
-            if (r == PackageManager.PERMISSION_DENIED) {
-                this.callbackContext.sendPluginResult(new 
PluginResult(PluginResult.Status.ERROR, PERMISSION_DENIED_ERROR));
-                return;
+                                          int[] grantResults) throws 
JSONException {
+        String version = android.os.Build.VERSION.RELEASE;
+        if(Integer.parseInt(version) <= 13)
+        {
+            if(PermissionHelper.hasPermission(this, 
Manifest.permission.CAMERA)) {

Review Comment:
   With that being said, the condition seems to be doing `<=` android 13 check. 
But this caveat applies if your app targets `M` (API 23) or later, which is 
virtually all apps today. So I think this check will fail if you have an app 
that declares the `CAMERA` permission on the next Android vesion.



##########
src/android/CameraLauncher.java:
##########
@@ -1312,20 +1312,39 @@ public void onScanCompleted(String path, Uri uri) {
     }
 
     public void onRequestPermissionResult(int requestCode, String[] 
permissions,
-                                          int[] grantResults) {
-        for (int r : grantResults) {
-            if (r == PackageManager.PERMISSION_DENIED) {
-                this.callbackContext.sendPluginResult(new 
PluginResult(PluginResult.Status.ERROR, PERMISSION_DENIED_ERROR));
-                return;
+                                          int[] grantResults) throws 
JSONException {
+        String version = android.os.Build.VERSION.RELEASE;
+        if(Integer.parseInt(version) <= 13)
+        {
+            if(PermissionHelper.hasPermission(this, 
Manifest.permission.CAMERA)) {

Review Comment:
   With that being said, the condition seems to be doing `<=` android 13 check. 
But this caveat applies if your app targets `M` (API 23) or later, which is 
virtually all apps today. So I think this check will fail if you have an app 
that declares the `CAMERA` permission on the next Android version.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to