mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 17:55:11 +00:00
fix: daemon doesn't quit when quitting the app for an auto-update (https://github.com/lbryio/lbry-app/issues/1142)
Fix https://github.com/lbryio/lbry-app/issues/1142
This commit is contained in:
parent
88399957ef
commit
034398859e
1 changed files with 8 additions and 14 deletions
|
@ -14,15 +14,6 @@ import createWindow from './createWindow';
|
||||||
|
|
||||||
autoUpdater.autoDownload = true;
|
autoUpdater.autoDownload = true;
|
||||||
|
|
||||||
// This is set to true if an auto update has been downloaded through the Electron
|
|
||||||
// auto-update system and is ready to install. If the user declined an update earlier,
|
|
||||||
// it will still install on shutdown.
|
|
||||||
let autoUpdateDownloaded = false;
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
let showingAutoUpdateCloseAlert = false;
|
|
||||||
|
|
||||||
// Keep a global reference, if you don't, they will be closed automatically when the JavaScript
|
// Keep a global reference, if you don't, they will be closed automatically when the JavaScript
|
||||||
// object is garbage collected.
|
// object is garbage collected.
|
||||||
let rendererWindow;
|
let rendererWindow;
|
||||||
|
@ -84,16 +75,16 @@ app.on('activate', () => {
|
||||||
app.on('will-quit', event => {
|
app.on('will-quit', event => {
|
||||||
if (
|
if (
|
||||||
process.platform === 'win32' &&
|
process.platform === 'win32' &&
|
||||||
autoUpdateDownloaded &&
|
appState.autoUpdateDownloaded &&
|
||||||
!appState.autoUpdateAccepted &&
|
!appState.autoUpdateAccepted &&
|
||||||
!showingAutoUpdateCloseAlert
|
!appState.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 postponed it (or closed
|
||||||
// the app without accepting it). Now the user is closing the app, so the new update
|
// the app without accepting it). Now the user is closing the app, so the new update
|
||||||
// will install. On Mac this is silent, but on Windows they get a confusing permission
|
// will install. On Mac this is silent, but on Windows they get a confusing permission
|
||||||
// escalation dialog, so we show Windows users a warning dialog first.
|
// escalation dialog, so we show Windows users a warning dialog first.
|
||||||
|
|
||||||
showingAutoUpdateCloseAlert = true;
|
appState.showingAutoUpdateCloseAlert = true;
|
||||||
dialog.showMessageBox(
|
dialog.showMessageBox(
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -126,6 +117,9 @@ app.on('will-finish-launching', () => {
|
||||||
|
|
||||||
app.on('before-quit', () => {
|
app.on('before-quit', () => {
|
||||||
appState.isQuitting = true;
|
appState.isQuitting = true;
|
||||||
|
if (appState.autoUpdateAccepted) {
|
||||||
|
if (daemon) daemon.quit();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('upgrade', (event, installerPath) => {
|
ipcMain.on('upgrade', (event, installerPath) => {
|
||||||
|
@ -145,7 +139,7 @@ ipcMain.on('upgrade', (event, installerPath) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on('update-downloaded', () => {
|
||||||
autoUpdateDownloaded = true;
|
appState.autoUpdateDownloaded = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('autoUpdateAccepted', () => {
|
ipcMain.on('autoUpdateAccepted', () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue