From db6b198d18f9e92fc4ef2ea06e25141d2fba4eed Mon Sep 17 00:00:00 2001 From: John Fawcett Date: Sun, 19 Mar 2023 17:38:53 -0500 Subject: Fixes profile edit image selection not prompting users on web (#309) (#321) * Fixes profile edit image selection not prompting users on web (#309) * Fixes linting erros --- src/lib/hooks/usePermissions.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/lib/hooks/usePermissions.ts') diff --git a/src/lib/hooks/usePermissions.ts b/src/lib/hooks/usePermissions.ts index 36a92ac32..19a420d9e 100644 --- a/src/lib/hooks/usePermissions.ts +++ b/src/lib/hooks/usePermissions.ts @@ -2,6 +2,7 @@ import {Alert} from 'react-native' import {Camera} from 'expo-camera' import * as MediaLibrary from 'expo-media-library' import {Linking} from 'react-native' +import {isWeb} from 'platform/detection' const openSettings = () => { Linking.openURL('app-settings:') @@ -24,6 +25,12 @@ const openPermissionAlert = (perm: string) => { export function usePhotoLibraryPermission() { const [mediaLibraryPermissions] = MediaLibrary.usePermissions() const requestPhotoAccessIfNeeded = async () => { + // On the, we use to produce a filepicker + // This does not need any permission granting. + if (isWeb) { + return true + } + if (mediaLibraryPermissions?.status === 'granted') { return true } else { -- cgit 1.4.1