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