From 4998a41ebb0e37f6ee05b6727203906f218d7db2 Mon Sep 17 00:00:00 2001 From: Cody Jung Date: Sat, 24 Aug 2024 13:19:36 -0500 Subject: [PATCH] Allow app to update on quit Adds the ability to install updates on quit, instead of forcing the user to restart, when they may be in the middle of transferring files. This sets autoInstallOnAppQuit to true, and adds a second button to the update prompt that does nothing. --- app/classes/AppUpdate.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/classes/AppUpdate.js b/app/classes/AppUpdate.js index fe7071bf..5b23511c 100644 --- a/app/classes/AppUpdate.js +++ b/app/classes/AppUpdate.js @@ -100,6 +100,7 @@ export default class AppUpdate { this.autoUpdater.autoDownload = autoUpdateCheck && autoDownload; this.autoUpdater.allowPrerelease = allowPrerelease; + this.autoUpdater.autoInstallOnAppQuit = true; this.autoUpdateCheck = autoUpdateCheck; this.progressbarWindowDomReadyFlag = null; @@ -220,15 +221,18 @@ export default class AppUpdate { const { response: buttonIndex } = await dialog.showMessageBox({ title: 'Install Updates', - message: 'Updates downloaded. Application will quit now...', - buttons: ['Install and Relaunch'], + message: 'Updates downloaded. Install and relaunch?', + buttons: ['Install Now', 'Install on Quit'], }); switch (buttonIndex) { case 0: - default: this.autoUpdater.quitAndInstall(); break; + case 1: + default: + // autoInstallOnAppQuit will trigger the update later + break; } });