fix saved local path

This commit is contained in:
Jorrin
2024-04-13 22:12:29 +02:00
parent 8d1ec8f1dc
commit 5def4e8461

View File

@@ -132,14 +132,12 @@ export const useDownloadManager = () => {
); );
try { try {
updateDownloadItem(download.id, { status: "importing" }); updateDownloadItem(download.id, { status: "importing" });
const asset = await MediaLibrary.createAssetAsync(fileUri); const asset = await MediaLibrary.createAssetAsync(fileUri);
const { localUri } = await MediaLibrary.getAssetInfoAsync(asset);
await FileSystem.deleteAsync(fileUri); await FileSystem.deleteAsync(fileUri);
updateDownloadItem(download.id, { updateDownloadItem(download.id, {
status: "finished", status: "finished",
localPath: localUri, localPath: asset.uri,
}); });
console.log("File saved to media library and original deleted"); console.log("File saved to media library and original deleted");
showToast("Download finished", { showToast("Download finished", {