diff options
author | John Fawcett <jrf0110@gmail.com> | 2023-03-19 17:38:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-19 17:38:53 -0500 |
commit | db6b198d18f9e92fc4ef2ea06e25141d2fba4eed (patch) | |
tree | 0d52e8d8c154e5cb4ffb64ad883360371c1fdecc /src/lib/hooks | |
parent | ea2b2583b84259c2c6ddb8c971ef30448d59b090 (diff) | |
download | voidsky-db6b198d18f9e92fc4ef2ea06e25141d2fba4eed.tar.zst |
* Fixes profile edit image selection not prompting users on web (#309) * Fixes linting erros
Diffstat (limited to 'src/lib/hooks')
-rw-r--r-- | src/lib/hooks/usePermissions.ts | 7 |
1 files changed, 7 insertions, 0 deletions
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 <input type="file"> to produce a filepicker + // This does not need any permission granting. + if (isWeb) { + return true + } + if (mediaLibraryPermissions?.status === 'granted') { return true } else { |