Merge pull request #1334 from bluesky-social/eric/fix-android-perms-noop

handle stuck state with granular android permissions
This commit is contained in:
Eric Bailey
2023-08-29 19:27:43 -05:00
committed by GitHub
+8 -3
View File
@@ -29,9 +29,14 @@ export function usePhotoLibraryPermission() {
if (res?.granted) {
return true
} else if (!res || res?.status === 'undetermined' || res?.canAskAgain) {
const updatedRes = await requestPermission()
return updatedRes?.granted
} else if (!res || res.status === 'undetermined' || res?.canAskAgain) {
const {canAskAgain, granted, status} = await requestPermission()
if (!canAskAgain && status === 'undetermined') {
openPermissionAlert('photo library')
}
return granted
} else {
openPermissionAlert('photo library')
return false