Resolve delete on local upload.

This commit is contained in:
Patrick Fic
2024-02-29 12:00:54 -08:00
parent cd8332e02d
commit c95daa7e5b
2 changed files with 96 additions and 63 deletions

View File

@@ -62,6 +62,39 @@ export function UploadProgress({
if (deleteAfterUpload) {
try {
await MediaLibrary.deleteAssetsAsync(data);
try {
const album = await MediaLibrary.createAlbumAsync(
'ImEX Mobile Deleted',
data.pop(),
false
);
//Move the rest.
if (data.length > 0) {
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
data,
album,
false
);
}
const deleteResult = await MediaLibrary.deleteAlbumsAsync(album);
Toast.show({
type: 'success',
text1: 'Pictures deleted succesfully.',
text2: JSON.stringify(deleteResult),
autoHide: false,
});
} catch (error) {
console.log("🚀 ~ onDone ~ error:", error)
Toast.show({
type: 'error',
text1: 'deleteAlbumsAsync',
text2: JSON.stringify(error),
autoHide: false,
});
}
} catch (error) {
console.log("Unable to delete picture.", error);
Sentry.Native.captureException(error);