use granular permission of for media perm request (#4609)
parent
77a512ae32
commit
873d91d466
|
@ -20,7 +20,9 @@ const openPermissionAlert = (perm: string) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function usePhotoLibraryPermission() {
|
export function usePhotoLibraryPermission() {
|
||||||
const [res, requestPermission] = MediaLibrary.usePermissions()
|
const [res, requestPermission] = MediaLibrary.usePermissions({
|
||||||
|
granularPermissions: ['photo'],
|
||||||
|
})
|
||||||
const requestPhotoAccessIfNeeded = async () => {
|
const requestPhotoAccessIfNeeded = async () => {
|
||||||
// On the, we use <input type="file"> to produce a filepicker
|
// On the, we use <input type="file"> to produce a filepicker
|
||||||
// This does not need any permission granting.
|
// This does not need any permission granting.
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function OpenCameraBtn({gallery, disabled}: Props) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {requestCameraAccessIfNeeded} = useCameraPermission()
|
const {requestCameraAccessIfNeeded} = useCameraPermission()
|
||||||
const [mediaPermissionRes, requestMediaPermission] =
|
const [mediaPermissionRes, requestMediaPermission] =
|
||||||
MediaLibrary.usePermissions()
|
MediaLibrary.usePermissions({granularPermissions: ['photo']})
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
|
||||||
const onPressTakePicture = useCallback(async () => {
|
const onPressTakePicture = useCallback(async () => {
|
||||||
|
|
|
@ -59,7 +59,9 @@ function LightboxFooter({imageIndex}: {imageIndex: number}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {activeLightbox} = useLightbox()
|
const {activeLightbox} = useLightbox()
|
||||||
const [isAltExpanded, setAltExpanded] = React.useState(false)
|
const [isAltExpanded, setAltExpanded] = React.useState(false)
|
||||||
const [permissionResponse, requestPermission] = MediaLibrary.usePermissions()
|
const [permissionResponse, requestPermission] = MediaLibrary.usePermissions({
|
||||||
|
granularPermissions: ['photo'],
|
||||||
|
})
|
||||||
|
|
||||||
const saveImageToAlbumWithToasts = React.useCallback(
|
const saveImageToAlbumWithToasts = React.useCallback(
|
||||||
async (uri: string) => {
|
async (uri: string) => {
|
||||||
|
|
Loading…
Reference in New Issue