pass setUploadProgressView to UploadManager and use it with single file upload
This commit is contained in:
parent
ccd435819b
commit
2104be3866
|
@ -394,6 +394,7 @@ const ImageEditorOverlay = (props: IProps) => {
|
|||
};
|
||||
|
||||
uploadManager.prepareForNewUpload();
|
||||
uploadManager.showUploadProgressDialog();
|
||||
|
||||
uploadManager.queueFilesForUpload(
|
||||
[file],
|
||||
|
|
|
@ -169,6 +169,7 @@ export default function Uploader(props: Props) {
|
|||
setUploadStage,
|
||||
setUploadFilenames: setUploadFileNames,
|
||||
setHasLivePhotos,
|
||||
setUploadProgressView,
|
||||
},
|
||||
props.setFiles,
|
||||
publicCollectionGalleryContext
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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>>;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue