added logic to update progress bar while preparing files
This commit is contained in:
parent
a9672056f1
commit
4bf02568d6
1 changed files with 6 additions and 3 deletions
|
@ -2,7 +2,8 @@ import { getEndpoint } from 'utils/common/apiUtil';
|
||||||
import HTTPService from './HTTPService';
|
import HTTPService from './HTTPService';
|
||||||
import * as Comlink from 'comlink';
|
import * as Comlink from 'comlink';
|
||||||
import EXIF from "exif-js";
|
import EXIF from "exif-js";
|
||||||
import { fileAttribute, collectionLatestFile, } from './fileService';
|
import { fileAttribute } from './fileService';
|
||||||
|
import { collectionLatestFile } from "./collectionService"
|
||||||
import { FILE_TYPE } from 'pages/gallery';
|
import { FILE_TYPE } from 'pages/gallery';
|
||||||
const CryptoWorker: any =
|
const CryptoWorker: any =
|
||||||
typeof window !== 'undefined' &&
|
typeof window !== 'undefined' &&
|
||||||
|
@ -103,17 +104,19 @@ class UploadService {
|
||||||
metadataFiles.push(file);
|
metadataFiles.push(file);
|
||||||
});
|
});
|
||||||
this.totalFilesCount = actualFiles.length;
|
this.totalFilesCount = actualFiles.length;
|
||||||
this.perStepProgress = 100 / (2 * actualFiles.length);
|
this.perStepProgress = 100 / (3 * actualFiles.length);
|
||||||
|
|
||||||
let formatedFiles: formatedFile[] = await Promise.all(actualFiles.map(async (recievedFile: File) => {
|
let formatedFiles: formatedFile[] = await Promise.all(actualFiles.map(async (recievedFile: File) => {
|
||||||
const file = await this.formatData(recievedFile);
|
const file = await this.formatData(recievedFile);
|
||||||
|
this.changeProgressBarProps(progressBarProps);
|
||||||
return file;
|
return file;
|
||||||
}));
|
}));
|
||||||
await Promise.all(metadataFiles.map(async (recievedFile: File) => {
|
await Promise.all(metadataFiles.map(async (recievedFile: File) => {
|
||||||
this.updateMetadata(recievedFile)
|
this.updateMetadata(recievedFile)
|
||||||
|
this.changeProgressBarProps(progressBarProps);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
console.log(formatedFiles);
|
||||||
progressBarProps.setUploadStage(UPLOAD_STAGES.ENCRYPTION);
|
progressBarProps.setUploadStage(UPLOAD_STAGES.ENCRYPTION);
|
||||||
const encryptedFiles: encryptedFile[] = await Promise.all(formatedFiles.map(async (file: formatedFile) => {
|
const encryptedFiles: encryptedFile[] = await Promise.all(formatedFiles.map(async (file: formatedFile) => {
|
||||||
const encryptedFile = await this.encryptFiles(worker, file, collectionLatestFile.collection.key);
|
const encryptedFile = await this.encryptFiles(worker, file, collectionLatestFile.collection.key);
|
||||||
|
|
Loading…
Add table
Reference in a new issue