优化。
parent
6d40299c3f
commit
678b8e06cb
|
@ -162,11 +162,11 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
|||
} else {
|
||||
message = '检查更新失败: ' + (bodyObj && bodyObj.message ? bodyObj.message : body)
|
||||
}
|
||||
win.webContents.send('update', { key: 'error', error: message })
|
||||
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: message })
|
||||
}
|
||||
} catch (e) {
|
||||
log.error('检查更新失败:', e)
|
||||
win.webContents.send('update', { key: 'error', error: '检查更新失败:' + e.message })
|
||||
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: '检查更新失败:' + e.message })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ function install (app, api) {
|
|||
const type = message.key
|
||||
if (type === 'available') {
|
||||
updateParams.checking = false
|
||||
updateParams.newVersionData = message.value
|
||||
foundNewVersion(message.value)
|
||||
} else if (type === 'notAvailable') {
|
||||
updateParams.checking = false
|
||||
|
@ -45,8 +46,13 @@ function install (app, api) {
|
|||
} else if (type === 'error') {
|
||||
updateParams.checking = false
|
||||
updateParams.downloading = false
|
||||
const error = message.error
|
||||
app.$message.error((error == null ? '未知错误' : (error.stack || error).toString()))
|
||||
if (message.action === 'checkForUpdate' && updateParams.newVersionData) {
|
||||
// 如果检查更新报错了,但刚才成功拿到过一次数据,就拿之前的数据
|
||||
foundNewVersion(updateParams.newVersionData)
|
||||
} else {
|
||||
const error = message.error
|
||||
app.$message.error((error == null ? '未知错误' : (error.stack || error).toString()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue