fix: app quitting when accepting update (#1118)
The app wouldn't completely quit after an update was downloaded and the user has pressed "USE IT NOW".
This commit is contained in:
parent
861131fd77
commit
88399957ef
2 changed files with 3 additions and 6 deletions
|
@ -49,7 +49,7 @@ export default appState => {
|
||||||
setupContextMenu(window);
|
setupContextMenu(window);
|
||||||
|
|
||||||
window.on('close', event => {
|
window.on('close', event => {
|
||||||
if (!appState.isQuitting) {
|
if (!appState.isQuitting && !appState.autoUpdateAccepted) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
window.hide();
|
window.hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,6 @@ autoUpdater.autoDownload = true;
|
||||||
// it will still install on shutdown.
|
// it will still install on shutdown.
|
||||||
let autoUpdateDownloaded = false;
|
let autoUpdateDownloaded = false;
|
||||||
|
|
||||||
// Keeps track of whether the user has accepted an auto-update through the interface.
|
|
||||||
let autoUpdateAccepted = false;
|
|
||||||
|
|
||||||
// This is used to keep track of whether we are showing the special dialog
|
// This is used to keep track of whether we are showing the special dialog
|
||||||
// that we show on Windows after you decline an upgrade and close the app later.
|
// that we show on Windows after you decline an upgrade and close the app later.
|
||||||
let showingAutoUpdateCloseAlert = false;
|
let showingAutoUpdateCloseAlert = false;
|
||||||
|
@ -88,7 +85,7 @@ app.on('will-quit', event => {
|
||||||
if (
|
if (
|
||||||
process.platform === 'win32' &&
|
process.platform === 'win32' &&
|
||||||
autoUpdateDownloaded &&
|
autoUpdateDownloaded &&
|
||||||
!autoUpdateAccepted &&
|
!appState.autoUpdateAccepted &&
|
||||||
!showingAutoUpdateCloseAlert
|
!showingAutoUpdateCloseAlert
|
||||||
) {
|
) {
|
||||||
// We're on Win and have an update downloaded, but the user declined it (or closed
|
// We're on Win and have an update downloaded, but the user declined it (or closed
|
||||||
|
@ -152,7 +149,7 @@ autoUpdater.on('update-downloaded', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('autoUpdateAccepted', () => {
|
ipcMain.on('autoUpdateAccepted', () => {
|
||||||
autoUpdateAccepted = true;
|
appState.autoUpdateAccepted = true;
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue