diff --git a/DrawerMenu.tsx b/DrawerMenu.tsx index 68dd5c9..0189025 100644 --- a/DrawerMenu.tsx +++ b/DrawerMenu.tsx @@ -1,6 +1,5 @@ import {NavigationProp, useNavigation} from '@react-navigation/native' import {useCallback, useState} from 'react' -import {Platform} from 'react-native' import DocumentPicker from 'react-native-document-picker' import {FileSystem} from 'react-native-file-access' import {Divider, IconButton, Menu} from 'react-native-paper' @@ -154,16 +153,8 @@ export default function DrawerMenu({name}: {name: keyof DrawerParamList}) { icon="more-vert" /> }> - {Platform.OS === 'android' && ( - <> - - - - )} + + armv7 + UIFileSharingEnabled + + LSSupportsOpeningDocumentsInPlace + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/write.ts b/write.ts index 16d9387..89bd098 100644 --- a/write.ts +++ b/write.ts @@ -1,9 +1,11 @@ -import {NativeModules, PermissionsAndroid} from 'react-native' +import {PermissionsAndroid, Platform} from 'react-native' import {Dirs, FileSystem} from 'react-native-file-access' +import {toast} from './toast' export const write = async (name: string, data: string) => { const filePath = `${Dirs.DocumentDir}/${name}` const permission = async () => { + if (Platform.OS !== 'android') return true const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, ) @@ -12,7 +14,7 @@ export const write = async (name: string, data: string) => { const granted = await permission() if (!granted) return await FileSystem.writeFile(filePath, data) - if (!FileSystem.exists(filePath)) return - await FileSystem.cpExternal(filePath, name, 'downloads') - NativeModules.DownloadModule.show(name) + if (Platform.OS === 'android') + await FileSystem.cpExternal(filePath, name, 'downloads') + toast(`Downloaded ${name}`) }