Move quitAndInstall() to separate function

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2022-05-30 13:04:18 +03:00
1 parent 91edfc7206
commit c0cfd3e42d
2 files changed
+6 -1

No files matched your search

+1
View File
@@ -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];
+5 -1
View File
@@ -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<void> {
logger.error(`${AutoUpdateLogPrefix}: failed with an error`, error);
}
}
export function quitAndInstallUpdate() {
autoUpdater.quitAndInstall(true, true);
}