Resolve delete on local upload.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user