Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(camera): only request permission to save to the gallery for Android <= 9 #2222

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading