Resolve delete on upload for android.
This commit is contained in:
2
app.json
2
app.json
@@ -4,7 +4,7 @@
|
|||||||
"slug": "imexmobile",
|
"slug": "imexmobile",
|
||||||
"version": "1.7.0",
|
"version": "1.7.0",
|
||||||
"extra": {
|
"extra": {
|
||||||
"expover": "1",
|
"expover": "2",
|
||||||
"eas": {
|
"eas": {
|
||||||
"projectId": "ffe01f3a-d507-4698-82cd-da1f1cad450b"
|
"projectId": "ffe01f3a-d507-4698-82cd-da1f1cad450b"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Alert,
|
Alert,
|
||||||
Modal,
|
Modal,
|
||||||
|
Platform,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Text,
|
Text,
|
||||||
View,
|
View,
|
||||||
@@ -61,22 +62,32 @@ export function UploadProgress({
|
|||||||
});
|
});
|
||||||
if (deleteAfterUpload) {
|
if (deleteAfterUpload) {
|
||||||
try {
|
try {
|
||||||
await MediaLibrary.deleteAssetsAsync(data);
|
if (Platform.OS === "android") {
|
||||||
|
//Create a new asset with the first file to delete.
|
||||||
|
// console.log('Trying new delete.');
|
||||||
|
await MediaLibrary.getPermissionsAsync(false);
|
||||||
|
|
||||||
const album = await MediaLibrary.createAlbumAsync(
|
const album = await MediaLibrary.createAlbumAsync(
|
||||||
"ImEX Mobile Deleted",
|
"ImEX Mobile Deleted",
|
||||||
data.pop(),
|
data.pop(),
|
||||||
false
|
|
||||||
);
|
|
||||||
//Move the rest.
|
|
||||||
if (data.length > 0) {
|
|
||||||
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
|
|
||||||
data,
|
|
||||||
album,
|
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
//Move the rest.
|
||||||
|
if (data.length > 0) {
|
||||||
|
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
|
||||||
|
data,
|
||||||
|
album,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const deleteResult = await MediaLibrary.deleteAlbumsAsync(album);
|
||||||
|
|
||||||
|
//Delete the album.
|
||||||
|
|
||||||
|
//This defaults to delete all assets in the album.
|
||||||
|
} else {
|
||||||
|
await MediaLibrary.deleteAssetsAsync(data.map((f) => f.id));
|
||||||
}
|
}
|
||||||
const deleteResult = await MediaLibrary.deleteAlbumsAsync(album);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Unable to delete picture.", error);
|
console.log("Unable to delete picture.", error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user