Just use a toast for download notifications
The minor convenience of having that notification doesn't justify me adding the library. If I find another reason for me to have notifications then i'll do it.
This commit is contained in:
parent
c50dc4aacf
commit
434f29652f
5
write.ts
5
write.ts
|
@ -1,5 +1,6 @@
|
||||||
import {NativeModules, PermissionsAndroid, Platform} from 'react-native'
|
import {PermissionsAndroid, Platform} from 'react-native'
|
||||||
import {Dirs, FileSystem} from 'react-native-file-access'
|
import {Dirs, FileSystem} from 'react-native-file-access'
|
||||||
|
import {toast} from './toast'
|
||||||
|
|
||||||
export const write = async (name: string, data: string) => {
|
export const write = async (name: string, data: string) => {
|
||||||
const filePath = `${Dirs.DocumentDir}/${name}`
|
const filePath = `${Dirs.DocumentDir}/${name}`
|
||||||
|
@ -15,5 +16,5 @@ export const write = async (name: string, data: string) => {
|
||||||
await FileSystem.writeFile(filePath, data)
|
await FileSystem.writeFile(filePath, data)
|
||||||
if (Platform.OS === 'android')
|
if (Platform.OS === 'android')
|
||||||
await FileSystem.cpExternal(filePath, name, 'downloads')
|
await FileSystem.cpExternal(filePath, name, 'downloads')
|
||||||
NativeModules.DownloadModule.show(name)
|
toast(`Downloaded ${name}`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user