1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 18:56:22 +00:00

Create confirm download dialog

This commit is contained in:
Gonçalo Santos
2020-05-14 21:05:51 +01:00
committed by Junyoung Choi
parent 18d65d999a
commit 553832bdfa
2 changed files with 30 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ import DevTools from './DevTools'
require('./lib/ipcClient')
require('../lib/customMeta')
import i18n from 'browser/lib/i18n'
import ConfigManager from './lib/ConfigManager'
const electron = require('electron')
@@ -107,6 +108,21 @@ function updateApp() {
}
}
function downloadUpdate() {
const index = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: i18n.__('Update Boostnote'),
detail: i18n.__('New Boostnote is ready to be downloaded.'),
buttons: [i18n.__('Download now'), i18n.__('Ignore updates')]
})
if (index === 0) {
ipcRenderer.send('update-app-confirm')
} else if (index === 1) {
ConfigManager.set({ autoUpdateEnabled: false })
}
}
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
@@ -147,9 +163,7 @@ ReactDOM.render(
})
ipcRenderer.on('update-found', function() {
notify('Update found!', {
body: 'Preparing to update...'
})
downloadUpdate()
})
ipcRenderer.on('update-not-found', function(_, msg) {