refactor: revert app restart behaviour after an update is downloaded

pull/3281/head
yougotwill 1 month ago
parent 8892e319df
commit 403a5a1e37

@ -1,12 +1,7 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
/* eslint-disable no-console */
import { app, type BrowserWindow } from 'electron';
import {
autoUpdater,
DOWNLOAD_PROGRESS,
UPDATE_DOWNLOADED,
type UpdateInfo,
} from 'electron-updater';
import { autoUpdater, DOWNLOAD_PROGRESS, type UpdateInfo } from 'electron-updater';
import * as fs from 'fs-extra';
import * as path from 'path';
import { gt as isVersionGreaterThan, parse as parseVersion } from 'semver';
@ -36,18 +31,6 @@ autoUpdater.on(DOWNLOAD_PROGRESS, eventDownloadProgress => {
);
});
autoUpdater.on(UPDATE_DOWNLOADED, () => {
isUpdating = true;
console.log('[updater] update downloaded');
// https://github.com/electron-userland/electron-builder/issues/6058#issuecomment-1130344017
setTimeout(() => {
console.info('[updater] calling quitAndInstall...');
autoUpdater.quitAndInstall();
app.exit();
isUpdating = false;
}, 1000);
});
export async function start(
getMainWindow: () => BrowserWindow | null,
i18n: SetupI18nReturnType,
@ -208,8 +191,9 @@ async function checkForUpdates(
return;
}
logger.info('[updater] calling windowMarkShouldQuit...');
logger.info('[updater] calling windowMarkShouldQuit then quitAndInstall...');
windowMarkShouldQuit();
autoUpdater.quitAndInstall();
} finally {
isUpdating = false;
}

Loading…
Cancel
Save