Upload improvements for imgproxy.

This commit is contained in:
Patrick Fic
2025-10-31 09:38:51 -07:00
parent ab8703a524
commit beb1145f98
11 changed files with 43 additions and 24 deletions

View File

@@ -243,6 +243,7 @@ function* uploadToLocalMediaServer(photos, bodyshop, jobid) {
} catch (error) {
console.log("Uncaught error", error);
}
}
function* uploadToImageProxy(photo, photoBlob, extension, key, bodyshop, jobid) {
@@ -297,7 +298,6 @@ function* uploadToImageProxy(photo, photoBlob, extension, key, bodyshop, jobid)
const sent = progressData.totalBytesSent;
const total = progressData.totalBytesExpectedToSend;
const progress = sent / total;
console.log(progress, sent)
store.dispatch(mediaUploadProgressOne({ ...photo, progress, loaded: sent }));
// onUpload(Number(progress.toFixed(2)) * 100);
},
@@ -347,7 +347,7 @@ function* uploadToImageProxy(photo, photoBlob, extension, key, bodyshop, jobid)
],
},
}));
console.log("Upload and record creation successful for", photo.uri);
} else {
console.log("Error uploading to Cloud", uploadResult);
throw new Error(`Cloud upload failed: ${uploadResult}`);
@@ -393,8 +393,9 @@ function* mediaUploadCompletedAction({ payload: photos }) {
}
try {
const progress = yield select((state) => state.photos.progress);
// Handle the completion of media uploads
const filesToDelete = [...photos]
const filesToDelete = Object.keys(progress).filter((key) => progress[key].status === 'completed').map((key) => progress[key]);
if (Platform.OS === "android") {
//Create a new asset with the first file to delete.