Skip to content

Commit

Permalink
feat(camera): only request permission to save to the gallery for Andr…
Browse files Browse the repository at this point in the history
…oid <= 9 (#2222)
  • Loading branch information
alexgerardojacinto authored Oct 24, 2024
1 parent 7280148 commit 30da38e
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ private boolean checkCameraPermissions(PluginCall call) {
boolean hasGalleryPerms = getPermissionState(SAVE_GALLERY) == PermissionState.GRANTED;

// If we want to save to the gallery, we need two permissions
// actually we only need permissions to save to gallery for Android <= 9 (API 28)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// we might still need to request permission for the camera
if (!hasCameraPerms) {
requestPermissionForAlias(CAMERA, call, "cameraPermissionsCallback");
return false;
}
return true;
}

// we need to request permissions to save to gallery for Android <= 9
if (settings.isSaveToGallery() && !(hasCameraPerms && hasGalleryPerms) && isFirstRequest) {
isFirstRequest = false;
String[] aliases;
Expand Down

0 comments on commit 30da38e

Please sign in to comment.