1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

fix update api bug

This commit is contained in:
Dick Choi
2016-09-15 08:43:53 +09:00
parent 27b09e5b73
commit 7358e68394
2 changed files with 12 additions and 6 deletions

View File

@@ -17,16 +17,21 @@ class StatusBar extends React.Component {
this.state = {
updateReady: false
}
}
componentDidMount () {
ipc.on('update-ready', function (message) {
this.updateReadyHandler = (message) => {
this.setState({
updateReady: true
}, () => {
this.updateApp()
})
}.bind(this))
}
}
componentDidMount () {
ipc.on('update-ready', this.updateReadyHandler)
}
componentWillUnmount () {
ipc.removeListener('update-ready', this.updateReadyHandler)
}
updateApp () {
@@ -38,7 +43,7 @@ class StatusBar extends React.Component {
})
if (index === 0) {
remote.getCurrentWindow().webContents.send('update-app')
ipc.send('update-app-confirm')
}
}

View File

@@ -67,6 +67,7 @@ updater.on('update-downloaded', (info) => {
})
ipc.on('update-app-confirm', function (event, msg) {
console.log('confirmed')
if (isUpdateReady) {
updater.install()
}