From 7420044f2fd04e0f52fccbb8e701de6a17383d9b Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 6 Aug 2024 14:51:06 -0700 Subject: [PATCH] fix check-for-updates --- emain/updater.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/emain/updater.ts b/emain/updater.ts index a9b335446..70fcb358b 100644 --- a/emain/updater.ts +++ b/emain/updater.ts @@ -66,7 +66,7 @@ export class Updater { /** * Sets the app update status and sends it to the main window - * @param value The AppUpdateStatus to set, either "ready" or "unavailable" + * @param value The status to set */ private set status(value: UpdaterStatus) { this._status = value; @@ -105,17 +105,15 @@ export class Updater { !this.lastUpdateCheck || Math.abs(now.getTime() - this.lastUpdateCheck.getTime()) > autoUpdateOpts.intervalms ) { - fireAndForget(() => - autoUpdater.checkForUpdates().then(() => { - if (userInput && this.status === "up-to-date") { - const dialogOpts: Electron.MessageBoxOptions = { - type: "info", - message: "There are currently no updates available.", - }; - electron.dialog.showMessageBox(electron.BrowserWindow.getFocusedWindow(), dialogOpts); - } - }) - ); + const result = await autoUpdater.checkForUpdates(); + console.log("check for updates result:", result.updateInfo.version, result); + if (userInput && !result.downloadPromise) { + const dialogOpts: Electron.MessageBoxOptions = { + type: "info", + message: "There are currently no updates available.", + }; + electron.dialog.showMessageBox(electron.BrowserWindow.getFocusedWindow(), dialogOpts); + } this.lastUpdateCheck = now; } }