Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

John Fawcett and committed by
GitHub
db6b198d ea2b2583

+19 -2
+7
src/lib/hooks/usePermissions.ts
··· 2 2 import {Camera} from 'expo-camera' 3 3 import * as MediaLibrary from 'expo-media-library' 4 4 import {Linking} from 'react-native' 5 + import {isWeb} from 'platform/detection' 5 6 6 7 const openSettings = () => { 7 8 Linking.openURL('app-settings:') ··· 24 25 export function usePhotoLibraryPermission() { 25 26 const [mediaLibraryPermissions] = MediaLibrary.usePermissions() 26 27 const requestPhotoAccessIfNeeded = async () => { 28 + // On the, we use <input type="file"> to produce a filepicker 29 + // This does not need any permission granting. 30 + if (isWeb) { 31 + return true 32 + } 33 + 27 34 if (mediaLibraryPermissions?.status === 'granted') { 28 35 return true 29 36 } else {
+12
src/lib/media/picker.web.tsx
··· 111 111 // helpers 112 112 // = 113 113 114 + /** 115 + * Opens the select file dialog in the browser. 116 + * NOTE: 117 + * If in the future someone updates this method to use: 118 + * https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker 119 + * Check that the `showOpenFilePicker` API does not require any permissions 120 + * granted to use. As of this writing, it does not, but that could change 121 + * in the future. If the user does need to go through a permissions granting 122 + * flow, then checkout the usePhotoLibraryPermission() hook in 123 + * src/lib/hooks/usePermissions.ts 124 + * so that it gets appropriately updated. 125 + */ 114 126 function selectFile(opts: PickerOpts): Promise<PickedFile> { 115 127 return new Promise((resolve, reject) => { 116 128 var input = document.createElement('input')
-2
src/view/shell/index.web.tsx
··· 7 7 import {ErrorBoundary} from '../com/util/ErrorBoundary' 8 8 import {Lightbox} from '../com/lightbox/Lightbox' 9 9 import {ModalsContainer} from '../com/modals/Modal' 10 - import {Text} from 'view/com/util/text/Text' 11 10 import {Composer} from './Composer.web' 12 - import {usePalette} from 'lib/hooks/usePalette' 13 11 import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle' 14 12 import {s, colors} from 'lib/styles' 15 13 import {RoutesContainer, FlatNavigator} from '../../Navigation'