Skip to content

Commit

Permalink
[Move dialog into main process]
Browse files Browse the repository at this point in the history
  • Loading branch information
alexliebowitz committed Jan 5, 2018
1 parent a6725ce commit 02d1417
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Https from 'https';
import Keytar from 'keytar';
import ChildProcess from 'child_process';
import Assert from 'assert';
import { app, BrowserWindow, globalShortcut, ipcMain, Menu, Tray } from 'electron';
import { app, dialog, BrowserWindow, globalShortcut, ipcMain, Menu, Tray } from 'electron';
import { autoUpdater } from 'electron-updater';
import log from 'electron-log';
import mainMenu from './menu/mainMenu';
Expand Down Expand Up @@ -449,18 +449,17 @@ app.on('window-all-closed', () => {
});

app.on('before-quit', event => {
if (process.platform === 'darwin' && updateDownloaded && !showingUpdateCloseAlert) {
// We haven't shown the special dialog that we show on Windows
// if the user declines an update and then quits later
rendererWindow.webContents.send('quitRequested');
showingUpdateCloseAlert = true;
} else if (!readyToQuit) {
if (!readyToQuit) {
// We need to shutdown the daemon before we're ready to actually quit. This
// event will be triggered re-entrantly once preparation is done.
event.preventDefault();
shutdownDaemonAndQuit();
} else {
console.log('Quitting.');
} else if (process.platform == 'win32' && !showingUpdateCloseAlert) {
event.preventDefault();
showingUpdateCloseAlert = true;
dialog.showMessageBox({
message: "foo"
}, () => { quitNow() });
}
});

Expand Down

0 comments on commit 02d1417

Please sign in to comment.