Remove debugging statements.

This commit is contained in:
Patrick Fic
2024-02-29 15:32:28 -08:00
parent 43280e3f3d
commit fa14c76268
3 changed files with 59 additions and 155 deletions

View File

@@ -208,100 +208,22 @@ export function UploadProgress({
//Create a new asset with the first file to delete.
// console.log('Trying new delete.');
await MediaLibrary.getPermissionsAsync(false);
// try {
// const albumremove = await MediaLibrary.removeAssetsFromAlbumAsync(
// filesToDelete,
// filesToDelete[0].albumId
// );
// Toast.show({
// type: 'info',
// text1: 'removeAssetsFromAlbumAsync',
// text2: JSON.stringify(albumremove),
// autoHide: false,
// });
// } catch (error) {
// console.log("🚀 ~ onDone ~ error:", error)
// Toast.show({
// type: 'error',
// text1: 'removeAssetsFromAlbumAsync',
// text2: JSON.stringify(error),
// autoHide: false,
// });
// }
// try {
// const delres = await MediaLibrary.deleteAssetsAsync(
// filesToDelete.map((f) => f.id)
// );
// Toast.show({
// type: 'info',
// text1: 'deleteAssetsAsync',
// text2: JSON.stringify(delres),
// autoHide: false,
// });
// } catch (error) {
// console.log("🚀 ~ onDone ~ error:", error)
// Toast.show({
// type: 'error',
// text1: 'deleteAssetsAsync',
// text2: JSON.stringify(error),
// autoHide: false,
// });
// }
// try {
// const res = Promise.all(
// filesToDelete.map((f) =>
// FileSystem.deleteAsync(f.uri, { idempotent: true })
// )
// );
// Toast.show({
// type: 'info',
// text1: 'FileSystemDelete',
// text2: JSON.stringify(res),
// autoHide: false,
// });
// } catch (error) {
// console.log("🚀 ~ onDone ~ error:", error)
// Toast.show({
// type: 'error',
// text1: 'FileSystemDelete',
// text2: JSON.stringify(error),
// autoHide: false,
// });
// }
try {
const album = await MediaLibrary.createAlbumAsync(
'ImEX Mobile Deleted',
filesToDelete.pop(),
const album = await MediaLibrary.createAlbumAsync(
'ImEX Mobile Deleted',
filesToDelete.pop(),
false
);
//Move the rest.
if (filesToDelete.length > 0) {
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
filesToDelete,
album,
false
);
//Move the rest.
if (filesToDelete.length > 0) {
const moveResult = await MediaLibrary.addAssetsToAlbumAsync(
filesToDelete,
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,
});
}
const deleteResult = await MediaLibrary.deleteAlbumsAsync(album);
//Delete the album.
//This defaults to delete all assets in the album.