use granular permission of for media perm request (#4609)

zio/stable
Hailey 2024-06-24 11:14:40 -07:00 committed by GitHub
parent 77a512ae32
commit 873d91d466
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View File

@ -20,7 +20,9 @@ const openPermissionAlert = (perm: string) => {
}
export function usePhotoLibraryPermission() {
const [res, requestPermission] = MediaLibrary.usePermissions()
const [res, requestPermission] = MediaLibrary.usePermissions({
granularPermissions: ['photo'],
})
const requestPhotoAccessIfNeeded = async () => {
// On the, we use <input type="file"> to produce a filepicker
// This does not need any permission granting.

View File

@ -24,7 +24,7 @@ export function OpenCameraBtn({gallery, disabled}: Props) {
const {_} = useLingui()
const {requestCameraAccessIfNeeded} = useCameraPermission()
const [mediaPermissionRes, requestMediaPermission] =
MediaLibrary.usePermissions()
MediaLibrary.usePermissions({granularPermissions: ['photo']})
const t = useTheme()
const onPressTakePicture = useCallback(async () => {

View File

@ -59,7 +59,9 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) {
const {_} = useLingui()
const {activeLightbox} = useLightbox()
const [isAltExpanded, setAltExpanded] = React.useState(false)
const [permissionResponse, requestPermission] = MediaLibrary.usePermissions()
const [permissionResponse, requestPermission] = MediaLibrary.usePermissions({
granularPermissions: ['photo'],
})
const saveImageToAlbumWithToasts = React.useCallback(
async (uri: string) => {