diff --git a/src/common/ipc/update-available.ts b/src/common/ipc/update-available.ts index ed5b18b13d..cdc4144b4a 100644 --- a/src/common/ipc/update-available.ts +++ b/src/common/ipc/update-available.ts @@ -8,6 +8,7 @@ import type { UpdateInfo } from "electron-updater"; export const UpdateAvailableChannel = "update-available"; export const AutoUpdateChecking = "auto-update:checking"; export const AutoUpdateNoUpdateAvailable = "auto-update:no-update"; +export const AutoUpdateQuitAndInstalledChannel = "auto-update:quit-and-install"; export const AutoUpdateLogPrefix = "[UPDATE-CHECKER]"; export type UpdateAvailableFromMain = [backChannel: string, updateInfo: UpdateInfo]; diff --git a/src/main/app-updater.ts b/src/main/app-updater.ts index 77daf6b4b6..e3c2fe1146 100644 --- a/src/main/app-updater.ts +++ b/src/main/app-updater.ts @@ -25,7 +25,7 @@ function handleAutoUpdateBackChannel(event: Electron.IpcMainEvent, ...[arg]: Upd if (arg.doUpdate) { if (arg.now) { logger.info(`${AutoUpdateLogPrefix}: User chose to update now`); - autoUpdater.quitAndInstall(true, true); + quitAndInstallUpdate(); } else { logger.info(`${AutoUpdateLogPrefix}: User chose to update on quit`); } @@ -131,3 +131,7 @@ export async function checkForUpdates(): Promise { logger.error(`${AutoUpdateLogPrefix}: failed with an error`, error); } } + +export function quitAndInstallUpdate() { + autoUpdater.quitAndInstall(true, true); +} \ No newline at end of file