diff --git a/src/main/services/bs-installer.service.ts b/src/main/services/bs-installer.service.ts index 1536d5bd..1975017d 100644 --- a/src/main/services/bs-installer.service.ts +++ b/src/main/services/bs-installer.service.ts @@ -129,6 +129,7 @@ export class BSInstallerService{ } else if(out[0] === "[Error]" as DownloadEventType){ reject(out[1]); + this.utils.newIpcSenc("bs-download.[Error]", {success: false, data: out[1]}); this.killDownloadProcess(); log.error("Download Event, Error", data.toString()); } diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index 70271f15..c8b61ef6 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -11,7 +11,7 @@ import { ThemeService } from "./services/theme.service"; import { NotificationOverlay } from "./components/notification/notification-overlay.component"; import { BsDownloaderService } from "./services/bs-downloader.service"; import { NotificationService } from "./services/notification.service"; -import { distinctUntilChanged, filter, throttleTime } from "rxjs"; +import { debounceTime, distinctUntilChanged, filter } from "rxjs"; export default function App() { @@ -25,9 +25,13 @@ export default function App() { else { document.documentElement.classList.remove('dark'); } }); - bsDownloadService.downloadWarning$.pipe(throttleTime(1000), filter(v => !!v), distinctUntilChanged()).subscribe(() => { + bsDownloadService.downloadWarning$.pipe(filter(v => !!v), distinctUntilChanged(), debounceTime(100)).subscribe(() => { notificationService.notifyWarning({title: "Warning", desc: "Your connection seems unstable"}); }); + + bsDownloadService.downloadError$.pipe(filter(v => !!v), distinctUntilChanged(), debounceTime(100)).subscribe(err => { + notificationService.notifyError({title: "Error", desc: err}); + }) }, []) diff --git a/src/renderer/pages/available-versions-list.components.tsx b/src/renderer/pages/available-versions-list.components.tsx index fedef23b..d5310674 100644 --- a/src/renderer/pages/available-versions-list.components.tsx +++ b/src/renderer/pages/available-versions-list.components.tsx @@ -33,8 +33,9 @@ export function AvailableVersionsList() { bsDownloaderService.download(versionSelected).then(res => { progressBarService.hide(true); - if(res.success){ notificationService.notifySuccess({title: 'Download Complete', duration: 3000}); } - else{ notificationService.notifyError({title: 'Error', desc: res.data as any as string}); } + if(res.success){ + notificationService.notifySuccess({title: 'Download Complete', duration: 3000}); + } }); } diff --git a/src/renderer/services/bs-downloader.service.ts b/src/renderer/services/bs-downloader.service.ts index 8b4cbd70..ff16eeb6 100644 --- a/src/renderer/services/bs-downloader.service.ts +++ b/src/renderer/services/bs-downloader.service.ts @@ -20,6 +20,7 @@ export class BsDownloaderService{ public readonly downloadProgress$: BehaviorSubject = new BehaviorSubject(0); public readonly downloadWarning$: BehaviorSubject = new BehaviorSubject(null); + public readonly downloadError$: BehaviorSubject = new BehaviorSubject(null); public readonly selectedBsVersion$: BehaviorSubject = new BehaviorSubject(null); @@ -42,7 +43,9 @@ export class BsDownloaderService{ this.ipcService.watch("bs-download.[SteamID]").subscribe(response => response.success && this.authService.setSteamID(response.data)); - this.ipcService.watch("bs-download.[Warning]").subscribe(response => response.success && this.downloadWarning$.next(response.data)); + this.ipcService.watch("bs-download.[Warning]").subscribe(response => this.downloadWarning$.next(response.data)); + + this.ipcService.watch("bs-download.[Error]").subscribe(response => this.downloadError$.next(response.data)); this.ipcService.watch("bs-download.[2FA]").subscribe(async response => { if(!response.success){ return; }