diff --git a/src/main/services/auto-updater.service.ts b/src/main/services/auto-updater.service.ts index 667e26cf..8dec8d84 100644 --- a/src/main/services/auto-updater.service.ts +++ b/src/main/services/auto-updater.service.ts @@ -2,12 +2,18 @@ import { autoUpdater } from "electron-updater"; import log from "electron-log"; import { UtilsService } from "./utils.service"; import { gt } from "semver"; +import { Observable } from "rxjs"; +import { ConfigurationService } from "./configuration.service"; export class AutoUpdaterService { private static instance: AutoUpdaterService; private readonly utilsService: UtilsService; + private readonly ConfigurationService: ConfigurationService + + private readonly HAVE_BEEN_UPDATED_KEY : string; + public static getInstance(): AutoUpdaterService { if (!AutoUpdaterService.instance) { AutoUpdaterService.instance = new AutoUpdaterService(); @@ -20,6 +26,8 @@ export class AutoUpdaterService { autoUpdater.autoDownload = false; this.utilsService = UtilsService.getInstance(); + this.ConfigurationService = ConfigurationService.getInstance(); + this.HAVE_BEEN_UPDATED_KEY = "haveBeenUpdated"; } public isUpdateAvailable(): Promise { @@ -51,4 +59,19 @@ 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); + } + + }