Resolve delete on upload for android.
This commit is contained in:
2
app.json
2
app.json
@@ -4,7 +4,7 @@
|
||||
"slug": "imexmobile",
|
||||
"version": "1.7.0",
|
||||
"extra": {
|
||||
"expover": "1",
|
||||
"expover": "2",
|
||||
"eas": {
|
||||
"projectId": "ffe01f3a-d507-4698-82cd-da1f1cad450b"
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Modal,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
@@ -61,22 +62,32 @@ export function UploadProgress({
|
||||
});
|
||||
if (deleteAfterUpload) {
|
||||
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(
|
||||
"ImEX Mobile Deleted",
|
||||
data.pop(),
|
||||
false
|
||||
);
|
||||
//Move the rest.
|
||||
if (data.length > 0) {
|
||||
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
|
||||
data,
|
||||
album,
|
||||
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);
|
||||
|
||||
//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) {
|
||||
console.log("Unable to delete picture.", error);
|
||||
Sentry.captureException(error);
|
||||
|
||||
Reference in New Issue
Block a user