From 5e420ec9c48ff4961e3842402793458b4157a56c Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sun, 11 Feb 2024 22:10:05 +1300 Subject: [PATCH] Delete unused file write.ts --- write.ts | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 write.ts diff --git a/write.ts b/write.ts deleted file mode 100644 index b8f9251..0000000 --- a/write.ts +++ /dev/null @@ -1,21 +0,0 @@ -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 - ); - return granted === PermissionsAndroid.RESULTS.GRANTED; - }; - const granted = await permission(); - if (!granted) return; - await FileSystem.writeFile(filePath, data); - if (Platform.OS === "android") { - await FileSystem.cpExternal(filePath, name, "downloads"); - } - toast(`Downloaded ${name}`); -};