Skip to content

Commit

Permalink
Made the update message box synchronous
Browse files Browse the repository at this point in the history
  • Loading branch information
Kræn Hansen committed Nov 12, 2018
1 parent 1ec4275 commit 89e2478
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions src/main/Updater.ts
Expand Up @@ -181,25 +181,20 @@ export class Updater {
const currentVersion = electron.app.getVersion();
const lastestVersion = info.version;

electron.dialog.showMessageBox(
{
type: 'info',
message: `A new version of ${appName} is available!`,
detail: `${appName} ${lastestVersion} is available – you have ${currentVersion}. Would you like to update it now?`,
buttons: ['Yes', 'No'],
defaultId: 0,
cancelId: 1,
},
response => {
if (response === 0) {
this.install();
}
},
);
}
// Show a dialog synchronously
const response = electron.dialog.showMessageBox({
type: 'info',
message: `A new version of ${appName} is available!`,
detail: `${appName} ${lastestVersion} is available – you have ${currentVersion}. Would you like to update it now?`,
buttons: ['Yes', 'No'],
defaultId: 0,
cancelId: 1,
});

private install() {
autoUpdater.quitAndInstall();
// Quit and install
if (response === 0) {
autoUpdater.quitAndInstall();
}
}

private showError(message: string, detail: string = '') {
Expand Down

0 comments on commit 89e2478

Please sign in to comment.