IO-1203 Resolve file deleting issue
This commit is contained in:
@@ -52,6 +52,7 @@ export function UploadProgress({
|
||||
files: {}, //uri is the key, value is progress
|
||||
});
|
||||
|
||||
let filesToDelete = [];
|
||||
const client = useApolloClient();
|
||||
|
||||
const { t } = useTranslation();
|
||||
@@ -66,7 +67,7 @@ export function UploadProgress({
|
||||
|
||||
function handleOnSuccess(id) {
|
||||
logImEXEvent("imexmobile_successful_upload");
|
||||
|
||||
filesToDelete.push(id);
|
||||
setProgress((progress) => ({
|
||||
...progress,
|
||||
action: t("mediabrowser.labels.converting"),
|
||||
@@ -189,15 +190,17 @@ export function UploadProgress({
|
||||
|
||||
if (deleteAfterUpload) {
|
||||
try {
|
||||
await MediaLibrary.deleteAssetsAsync(Object.keys(progress.files));
|
||||
await MediaLibrary.deleteAssetsAsync(filesToDelete);
|
||||
} catch (error) {
|
||||
console.log("Unable to delete picture.", error);
|
||||
}
|
||||
}
|
||||
filesToDelete = [];
|
||||
setProgress({
|
||||
loading: false,
|
||||
speed: 0,
|
||||
action: null,
|
||||
|
||||
uploadInProgress: false,
|
||||
files: {}, //uri is the key, value is progress
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user