Feature: add update progress bar and some optimization

ISSUES CLOSED: #83
This commit is contained in:
萌萌哒赫萝
2023-08-10 00:11:57 -07:00
parent 13852a5c1b
commit 517348886c
13 changed files with 1029 additions and 1056 deletions

View File

@@ -62,9 +62,8 @@ const handleStartUpFiles = (argv: string[], cwd: string) => {
uploadChoosedFiles(win.webContents, files)
}
return true
} else {
return false
}
return false
}
autoUpdater.setFeedURL({
@@ -90,9 +89,19 @@ autoUpdater.on('update-available', (info: UpdateInfo) => {
autoUpdater.downloadUpdate()
}
db.set('settings.showUpdateTip', !result.checkboxChecked)
}).catch((err) => {
logger.error(err)
})
})
autoUpdater.on('download-progress', (progressObj) => {
const percent = {
progress: progressObj.percent
}
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
window.webContents.send('updateProgress', percent)
})
autoUpdater.on('update-downloaded', () => {
dialog.showMessageBox({
type: 'info',
@@ -100,9 +109,13 @@ autoUpdater.on('update-downloaded', () => {
buttons: ['Yes', 'No'],
message: T('TIPS_UPDATE_DOWNLOADED')
}).then((result) => {
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
window.webContents.send('updateProgress', { progress: 100 })
if (result.response === 0) {
autoUpdater.quitAndInstall()
}
}).catch((err) => {
logger.error(err)
})
})