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

View file

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

View file

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

View file

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