Skip to content

Commit 9886d8d

Browse files
committed
Fix updater
1 parent 6740162 commit 9886d8d

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

app/updater.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,21 @@ autoUpdater.on('error', error => {
2424
})
2525

2626
autoUpdater.on('update-available', () => {
27-
dialog.showMessageBox(
28-
{
27+
dialog
28+
.showMessageBox({
2929
type: 'info',
3030
title: 'Found Updates',
3131
message: 'Found updates, do you want update now?',
3232
buttons: ['Sure', 'No']
33-
},
34-
buttonIndex => {
35-
if (buttonIndex === 0) {
33+
})
34+
.then(({ response }) => {
35+
if (response === 0) {
3636
autoUpdater.downloadUpdate()
3737
} else {
3838
updater.enabled = true
3939
updater = null
4040
}
41-
}
42-
)
41+
})
4342
})
4443

4544
autoUpdater.on('update-not-available', () => {
@@ -52,15 +51,14 @@ autoUpdater.on('update-not-available', () => {
5251
})
5352

5453
autoUpdater.on('update-downloaded', () => {
55-
dialog.showMessageBox(
56-
{
54+
dialog
55+
.showMessageBox({
5756
title: 'Install Updates',
5857
message: 'Updates downloaded, application will be quit for update...'
59-
},
60-
() => {
58+
})
59+
.then(() => {
6160
setImmediate(() => autoUpdater.quitAndInstall())
62-
}
63-
)
61+
})
6462
})
6563

6664
// export this to MenuItem click callback

0 commit comments

Comments
 (0)