mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Add ConfigurationService and methods for getting
and setting haveBeenUpdated flag
This commit is contained in:
@@ -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<boolean> {
|
||||
@@ -51,4 +59,19 @@ export class AutoUpdaterService {
|
||||
public quitAndInstall() {
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
|
||||
|
||||
public getHaveBeenUpdated(): Observable<boolean> {
|
||||
const haveBeenUpdated = this.ConfigurationService.get(this.HAVE_BEEN_UPDATED_KEY);
|
||||
return new Observable<boolean>((observer) => {
|
||||
observer.next(haveBeenUpdated as boolean);
|
||||
observer.complete();
|
||||
});
|
||||
}
|
||||
|
||||
public setHaveBeenUpdated(value: boolean): void {
|
||||
this.ConfigurationService.set(this.HAVE_BEEN_UPDATED_KEY, value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user