diff --git a/ts/utils/permission.ts b/ts/utils/permission.ts index 098e301df12..3a14659338c 100644 --- a/ts/utils/permission.ts +++ b/ts/utils/permission.ts @@ -11,13 +11,8 @@ export const requestIOPermission = async ( permission: RNPermissions.Permission, rationale?: RNPermissions.Rationale ): Promise => { - // 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; } @@ -33,6 +28,11 @@ export const requestIOPermission = async ( export const checkIOPermission = async ( permission: RNPermissions.Permission ): Promise => { + // 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"; }; @@ -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; }