minor fixes

This commit is contained in:
Abhinav 2022-09-02 08:31:53 +05:30
parent 1669d1a8b4
commit dc65cbf7d8
4 changed files with 12 additions and 15 deletions

View file

@ -57,7 +57,6 @@ interface Props {
setCollectionSelectorAttributes: SetCollectionSelectorAttributes;
setCollectionNamerAttributes: SetCollectionNamerAttributes;
setLoading: SetLoading;
uploadInProgress: boolean;
setUploadInProgress: (value: boolean) => void;
showCollectionSelector: () => void;
setFiles: SetFiles;
@ -175,7 +174,7 @@ export default function Uploader(props: Props) {
webFiles?.length > 0 ||
appContext.sharedFiles?.length > 0
) {
if (props.uploadInProgress) {
if (uploadManager.isUploadRunning()) {
if (watchFolderService.isUploadRunning()) {
// pause watch folder service on user upload
watchFolderService.pauseRunningSync();
@ -383,7 +382,7 @@ export default function Uploader(props: Props) {
filesWithCollectionToUploadIn,
collections
);
} else if (watchFolderService.isServicePaused()) {
} else if (watchFolderService.isSyncPaused()) {
// resume the service after user upload is done
watchFolderService.resumePausedSync();
}

View file

@ -668,7 +668,6 @@ export default function Gallery() {
)}
setLoading={setBlockingLoad}
setCollectionNamerAttributes={setCollectionNamerAttributes}
uploadInProgress={uploadInProgress}
setUploadInProgress={setUploadInProgress}
setFiles={setFiles}
setCollections={setCollections}

View file

@ -67,6 +67,10 @@ class UploadManager {
this.setFiles = setFiles;
}
public isUploadRunning() {
return this.uploadInProgress;
}
private resetState() {
this.filesToBeUploaded = [];
this.remainingFiles = [];
@ -435,16 +439,7 @@ class UploadManager {
this.failedFiles.push(fileWithCollection);
break;
case UPLOAD_RESULT.ALREADY_UPLOADED:
if (isElectron()) {
await watchFolderService.onFileUpload(
fileWithCollection,
uploadedFile
);
}
await this.updateFilePaths(
uploadedFile,
fileWithCollection
);
decryptedFile = uploadedFile;
break;
case UPLOAD_RESULT.ADDED_SYMLINK:
decryptedFile = uploadedFile;
@ -474,6 +469,10 @@ class UploadManager {
) {
this.updateExistingFiles(decryptedFile);
await this.updateFilePaths(decryptedFile, fileWithCollection);
await this.watchFolderCallback(
fileWithCollection,
uploadedFile
);
}
return fileUploadResult;
} catch (e) {

View file

@ -45,7 +45,7 @@ class watchFolderService {
return this.uploadRunning;
}
isServicePaused() {
isSyncPaused() {
return this.isPaused;
}