pass setUploadProgressView to UploadManager and use it with single file upload

This commit is contained in:
Abhinav 2023-10-19 07:45:52 +05:30
parent ccd435819b
commit 2104be3866
5 changed files with 14 additions and 0 deletions

View file

@ -394,6 +394,7 @@ const ImageEditorOverlay = (props: IProps) => {
};
uploadManager.prepareForNewUpload();
uploadManager.showUploadProgressDialog();
uploadManager.queueFilesForUpload(
[file],

View file

@ -169,6 +169,7 @@ export default function Uploader(props: Props) {
setUploadStage,
setUploadFilenames: setUploadFileNames,
setHasLivePhotos,
setUploadProgressView,
},
props.setFiles,
publicCollectionGalleryContext

View file

@ -22,6 +22,7 @@ class UIService {
private uploadStage: UPLOAD_STAGES = UPLOAD_STAGES.START;
private filenames: Map<number, string> = new Map();
private hasLivePhoto: boolean = false;
private uploadProgressView: boolean = false;
// STAGE LEVEL STATES
private perFileProgress: number;
@ -35,6 +36,7 @@ class UIService {
this.progressUpdater.setUploadStage(this.uploadStage);
this.progressUpdater.setUploadFilenames(this.filenames);
this.progressUpdater.setHasLivePhotos(this.hasLivePhoto);
this.progressUpdater.setUploadProgressView(this.uploadProgressView);
this.progressUpdater.setUploadCounter({
finished: this.filesUploadedCount,
total: this.totalFilesCount,
@ -84,6 +86,11 @@ class UIService {
this.progressUpdater.setHasLivePhotos(hasLivePhoto);
}
setUploadProgressView(uploadProgressView: boolean) {
this.uploadProgressView = uploadProgressView;
this.progressUpdater.setUploadProgressView(uploadProgressView);
}
increaseFileUploaded() {
this.filesUploadedCount++;
this.updateProgressBarUI();

View file

@ -88,6 +88,10 @@ class UploadManager {
UIService.setUploadStage(UPLOAD_STAGES.START);
}
showUploadProgressDialog() {
UIService.setUploadProgressView(true);
}
async updateExistingFilesAndCollections(collections: Collection[]) {
if (this.publicUploadProps.accessedThroughSharedURL) {
this.existingFiles = await getLocalPublicFiles(

View file

@ -39,4 +39,5 @@ export interface ProgressUpdater {
>;
setUploadFilenames: React.Dispatch<React.SetStateAction<UploadFileNames>>;
setHasLivePhotos: React.Dispatch<React.SetStateAction<boolean>>;
setUploadProgressView: React.Dispatch<React.SetStateAction<boolean>>;
}