mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
no other operation when an operation is running
This commit is contained in:
@@ -82,7 +82,12 @@ export class BsDownloaderService{
|
||||
return this.ipcService.send<boolean>("bs-download.kill");
|
||||
}
|
||||
|
||||
public async download(bsVersion: BSVersion, isVerification?: boolean): Promise<IpcResponse<DownloadEvent>>{
|
||||
public async download(bsVersion: BSVersion, isVerification?: boolean, isFirstCall: boolean = true): Promise<IpcResponse<DownloadEvent>>{
|
||||
if(isFirstCall && this.progressBarService.isVisible){
|
||||
this.notificationService.notifyError({title: "notifications.shared.errors.titles.operation-running", desc: "notifications.shared.errors.msg.operation-running", duration: 3000});
|
||||
return {success: false};
|
||||
}
|
||||
|
||||
this.progressBarService.show(this.downloadProgress$);
|
||||
this._isVerification = !!isVerification;
|
||||
|
||||
@@ -104,15 +109,15 @@ export class BsDownloaderService{
|
||||
|
||||
let res = await promise;
|
||||
|
||||
if(res.data.type === "[Password]"){
|
||||
if(res.data?.type === "[Password]"){
|
||||
this.authService.deleteSteamSession();
|
||||
res = await this.download(bsVersion);
|
||||
res = await this.download(bsVersion, isVerification, false);
|
||||
}
|
||||
|
||||
this.progressBarService.hide(true);
|
||||
this.resetDownload();
|
||||
if(res.success){ this.notificationService.notifySuccess({title: `notifications.bs-download.success.titles.${isVerification ? "verification-finished" : "download-success"}`, duration: 3000}); }
|
||||
else{ this.notificationService.notifyError({title: `notifications.bs-download.errors.titles.${res.data}`, duration: 3000}); }
|
||||
else if(res.data){ this.notificationService.notifyError({title: `notifications.bs-download.errors.titles.${res.data}`, duration: 3000}); }
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,10 @@ export class BSVersionManagerService {
|
||||
}
|
||||
|
||||
public async cloneVersion(version: BSVersion): Promise<BSVersion>{
|
||||
if(this.progressBarService.isVisible){
|
||||
this.notificationService.notifyError({title: "notifications.shared.errors.titles.operation-running", desc: "notifications.shared.errors.msg.operation-running", duration: 3000});
|
||||
return null;
|
||||
}
|
||||
const modalRes = await this.modalService.openModal<{name: string, color: string}>(ModalType.CLONE_VERSION, version);
|
||||
if(modalRes.exitCode !== ModalExitCode.COMPLETED){ return null; }
|
||||
if(modalRes.data.name?.length < 2){ return null; }
|
||||
|
||||
@@ -70,6 +70,7 @@ export class ProgressBarService{
|
||||
|
||||
public get progression$(): BehaviorSubject<number>{ return this._progression$; }
|
||||
public get visible$(): BehaviorSubject<boolean>{ return this._visible$; }
|
||||
public get isVisible(): boolean{ return this._visible$.value; }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user