mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
fix update api bug
This commit is contained in:
@@ -17,16 +17,21 @@ class StatusBar extends React.Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
updateReady: false
|
updateReady: false
|
||||||
}
|
}
|
||||||
}
|
this.updateReadyHandler = (message) => {
|
||||||
|
|
||||||
componentDidMount () {
|
|
||||||
ipc.on('update-ready', function (message) {
|
|
||||||
this.setState({
|
this.setState({
|
||||||
updateReady: true
|
updateReady: true
|
||||||
}, () => {
|
}, () => {
|
||||||
this.updateApp()
|
this.updateApp()
|
||||||
})
|
})
|
||||||
}.bind(this))
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
ipc.on('update-ready', this.updateReadyHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
ipc.removeListener('update-ready', this.updateReadyHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateApp () {
|
updateApp () {
|
||||||
@@ -38,7 +43,7 @@ class StatusBar extends React.Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
remote.getCurrentWindow().webContents.send('update-app')
|
ipc.send('update-app-confirm')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ updater.on('update-downloaded', (info) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
ipc.on('update-app-confirm', function (event, msg) {
|
ipc.on('update-app-confirm', function (event, msg) {
|
||||||
|
console.log('confirmed')
|
||||||
if (isUpdateReady) {
|
if (isUpdateReady) {
|
||||||
updater.install()
|
updater.install()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user