diff --git a/src/main/ipcs/bs-launcher-ipcs.ts b/src/main/ipcs/bs-launcher-ipcs.ts index d60ba476..eee40cce 100644 --- a/src/main/ipcs/bs-launcher-ipcs.ts +++ b/src/main/ipcs/bs-launcher-ipcs.ts @@ -32,9 +32,4 @@ ipc.on("restore-original-oculus-folder", (_, reply) => { )); }); -ipc.on("have-been-updated", (_, reply) => { - const updaterService = AutoUpdaterService.getInstance(); - reply(from(updaterService.getHaveBeenUpdated())); -}); - diff --git a/src/main/services/auto-updater.service.ts b/src/main/services/auto-updater.service.ts index 8dec8d84..b54448eb 100644 --- a/src/main/services/auto-updater.service.ts +++ b/src/main/services/auto-updater.service.ts @@ -59,19 +59,4 @@ export class AutoUpdaterService { public quitAndInstall() { autoUpdater.quitAndInstall(); } - - - public getHaveBeenUpdated(): Observable { - const haveBeenUpdated = this.ConfigurationService.get(this.HAVE_BEEN_UPDATED_KEY); - return new Observable((observer) => { - observer.next(haveBeenUpdated as boolean); - observer.complete(); - }); - } - - public setHaveBeenUpdated(value: boolean): void { - this.ConfigurationService.set(this.HAVE_BEEN_UPDATED_KEY, value); - } - - } diff --git a/src/renderer/services/auto-updater.service.ts b/src/renderer/services/auto-updater.service.ts index 2ca51119..9d57b367 100644 --- a/src/renderer/services/auto-updater.service.ts +++ b/src/renderer/services/auto-updater.service.ts @@ -5,6 +5,7 @@ import { ProgressBarService } from "./progress-bar.service"; import { I18nService } from "./i18n.service"; import { ModalService } from "renderer/services/modale.service"; import { ChangelogModal } from "renderer/components/modal/modal-types/chabgelog-modal/changelog-modal.component"; +import { ConfigurationService } from "./configuration.service"; export interface Changelog { [version: string]: ChangelogVersion; @@ -27,7 +28,7 @@ export class AutoUpdaterService { private modal: ModalService; - private readonly changelog: BehaviorSubject; + private configurationService: ConfigurationService; public static getInstance(): AutoUpdaterService { if (!AutoUpdaterService.instance) { @@ -41,6 +42,7 @@ export class AutoUpdaterService { this.ipcService = IpcService.getInstance(); this.i18nService = I18nService.getInstance(); this.modal = ModalService.getInstance(); + this.configurationService = ConfigurationService.getInstance(); this.downloadProgress$ = this.ipcService.watch("update-download-progress").pipe(map(res => (res.success ? res.data : 0))); @@ -63,10 +65,15 @@ export class AutoUpdaterService { this.ipcService.sendLazy("install-update"); } - public getHaveBeenUpdated(): Observable{ - return this.ipcService.sendV2("have-been-updated"); + public getHaveBeenUpdated(): boolean { + return this.configurationService.get("have-been-updated"); } + public setHaveBeenUpdated(value: boolean){ + this.configurationService.set("have-been-updated", value); + } + + private async getChangelog(): Promise { const path = `https://raw.githubusercontent.com/Zagrios/bs-manager/feature/add-changelog-modal/178/assets/jsons/changelogs/${this.i18nService.currentLanguage.split("-")[0]}.json` const response = await fetch(path); @@ -102,10 +109,12 @@ export class AutoUpdaterService { public async showChangelog(): Promise{ try{ - const currentVersion = await lastValueFrom(this.getAppVersion()); - const changelog = await this.getChangelogVersion(currentVersion); + if(this.getHaveBeenUpdated()){ + const currentVersion = await lastValueFrom(this.getAppVersion()); + const changelog = await this.getChangelogVersion(currentVersion); - this.modal.openModal(ChangelogModal, changelog); + this.modal.openModal(ChangelogModal, changelog); + } } catch(error){ this.ipcService.sendLazy("log-error", {args: error});