IO-1203 Resolve file deleting issue

This commit is contained in:
Patrick Fic
2021-06-09 15:35:20 -07:00
parent cd55b8b093
commit 04e3a77312

View File

@@ -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
});