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

chore: [IOBP-517] Removes unnecessary gallery permission on iOS #5433

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
16 changes: 7 additions & 9 deletions ts/utils/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ export const requestIOPermission = async (
permission: RNPermissions.Permission,
rationale?: RNPermissions.Rationale
): Promise<boolean> => {
// Be aware that some permissions may return "unavailable" event if the library
// documents them as supported. One notorious case is the iOS PHOTO_LIBRARY_ADD_ONLY
// permission. If such permission is automatically handled by the system upon request
// (such as PHOTO_LIBRARY_ADD_ONLY is), then you should not use this function to
// check nor to request such permission
const checkResult = await RNPermissions.check(permission);
if (checkResult === "granted") {
const checkResult = await checkIOPermission(permission);
if (checkResult) {
return true;
}

Expand All @@ -33,6 +28,11 @@ export const requestIOPermission = async (
export const checkIOPermission = async (
permission: RNPermissions.Permission
): Promise<boolean> => {
// Be aware that some permissions may return "unavailable" event if the library
// documents them as supported. One notorious case is the iOS PHOTO_LIBRARY_ADD_ONLY
// permission. If such permission is automatically handled by the system upon request
// (such as PHOTO_LIBRARY_ADD_ONLY is), then you should not use this function to
// check nor to request such permission
const checkResult = await RNPermissions.check(permission);
return checkResult === "granted";
};
Expand Down Expand Up @@ -69,8 +69,6 @@ export const requestMediaPermission = async () => {
? RNPermissions.PERMISSIONS.ANDROID.READ_MEDIA_IMAGES
: RNPermissions.PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE
);
case "ios":
return requestIOPermission(RNPermissions.PERMISSIONS.IOS.PHOTO_LIBRARY);
default:
return false;
}
Expand Down
Loading