Skip to content

A full-featured download manager.

refactor: dialog.showMessageBox promisify

Dr_rOotdcd2d50c830f
diff --git a/src/main/Application.js b/src/main/Application.js
index afe39074..2140b643 100644
--- a/src/main/Application.js
+++ b/src/main/Application.js
@@ -72,7 +72,7 @@ export default class Application extends EventEmitter {
type: 'error',
title: this.i18n.t('app.system-error-title'),
message: this.i18n.t('app.system-error-message', { message })
- }, () => {
+ }).then(_ => {
setTimeout(() => {
app.quit()
}, 100)
diff --git a/src/main/core/UpdateManager.js b/src/main/core/UpdateManager.js
index a98ad4d4..46c4141d 100644
--- a/src/main/core/UpdateManager.js
+++ b/src/main/core/UpdateManager.js
@@ -66,8 +66,8 @@ export default class UpdateManager extends EventEmitter {
message: this.i18n.t('app.update-available-message'),
buttons: [this.i18n.t('app.yes'), this.i18n.t('app.no')],
cancelId: 1
- }, (buttonIndex) => {
- if (buttonIndex === 0) {
+ }).then(({ response }) => {
+ if (response === 0) {
this.updater.downloadUpdate()
}
})
@@ -102,7 +102,7 @@ export default class UpdateManager extends EventEmitter {
dialog.showMessageBox({
title: this.i18n.t('app.check-for-updates-title'),
message: this.i18n.t('app.update-downloaded-message')
- }, () => {
+ }).then(_ => {
this.emit('will-updated')
setImmediate(() => {
this.updater.quitAndInstall()
diff --git a/src/renderer/components/Preference/Advanced.vue b/src/renderer/components/Preference/Advanced.vue
index 8aa0044d..4765f62a 100644
--- a/src/renderer/components/Preference/Advanced.vue
+++ b/src/renderer/components/Preference/Advanced.vue
@@ -320,8 +320,8 @@
message: this.$t('preferences.factory-reset-confirm'),
buttons: [this.$t('app.yes'), this.$t('app.no')],
cancelId: 1
- }, (buttonIndex) => {
- if (buttonIndex === 0) {
+ }).then(({ response }) => {
+ if (response === 0) {
this.$electron.ipcRenderer.send('command', 'application:reset')
}
})
diff --git a/src/renderer/components/Task/TaskItemActions.vue b/src/renderer/components/Task/TaskItemActions.vue
index 4d5800ce..f6cdf05c 100644
--- a/src/renderer/components/Task/TaskItemActions.vue
+++ b/src/renderer/components/Task/TaskItemActions.vue
@@ -257,8 +257,8 @@
cancelId: 1,
checkboxLabel: this.$t('task.delete-task-label'),
checkboxChecked: isChecked
- }, (buttonIndex, checkboxChecked) => {
- if (buttonIndex === 0) {
+ }).then(({ response, checkboxChecked }) => {
+ if (response === 0) {
self.removeTaskItem(task, checkboxChecked)
}
})
@@ -275,8 +275,8 @@
cancelId: 1,
checkboxLabel: this.$t('task.remove-record-label'),
checkboxChecked: isChecked
- }, (buttonIndex, checkboxChecked) => {
- if (buttonIndex === 0) {
+ }).then(({ response, checkboxChecked }) => {
+ if (response === 0) {
self.removeTaskRecord(task, checkboxChecked)
}
})