diff --git a/publish/changeLog.md b/publish/changeLog.md index 14019c0b..00131e4d 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,8 +1,3 @@ -#### 优化 +### 优化 -- 大幅减少程序**播放时**对CPU与GPU的使用,经测试CPU使用减少60%以上,GPU使用减少90%以上,这应该能解决MAC系统上的温度上涨的问题 - -#### 修复 - -- 修复酷我源**搜索提示**、**排行榜**无法获取的问题 -- 修复咪咕源无法播放的问题 +- 优化更新弹窗机制及其内容描述 diff --git a/src/main/utils/autoUpdate.js b/src/main/utils/autoUpdate.js index 4aa145a9..d496103d 100644 --- a/src/main/utils/autoUpdate.js +++ b/src/main/utils/autoUpdate.js @@ -92,14 +92,14 @@ module.exports = isFirstCheckedUpdate => { }) autoUpdater.on('error', err => { sendStatusToWindow('Error in auto-updater.') - handleSendEvent({ type: 'update-error', info: err }) + handleSendEvent({ type: 'update-error', info: err.message }) }) autoUpdater.on('download-progress', progressObj => { let log_message = 'Download speed: ' + progressObj.bytesPerSecond log_message = log_message + ' - Downloaded ' + progressObj.percent + '%' log_message = log_message + ' (' + progressObj.transferred + '/' + progressObj.total + ')' sendStatusToWindow(log_message) - handleSendEvent({ type: 'download-progress', info: progressObj }) + handleSendEvent({ type: 'update-progress', info: progressObj }) }) autoUpdater.on('update-downloaded', info => { sendStatusToWindow('Update downloaded.') diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 4e3a72fa..1229b1f2 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -108,33 +108,39 @@ export default { } ipcRenderer.on('update-available', (e, info) => { // this.showUpdateModal(true) - console.log(info) - this.setNewVersion({ + // console.log(info) + this.getVersionInfo().catch(() => ({ version: info.version, + desc: info.releaseNotes, + })).then(body => { + // console.log(body) + this.setNewVersion(body) + this.$nextTick(() => { + this.setVersionModalVisible({ isShow: true }) + }) }) }) - ipcRenderer.on('update-error', err => { - console.log(err) - if (!this.updateTimeout) return - this.setVersionModalVisible({ isError: true }) + ipcRenderer.on('update-error', (event, err) => { + // console.log(err) this.clearUpdateTimeout() + this.setVersionModalVisible({ isError: true }) this.$nextTick(() => { this.showUpdateModal() }) }) - ipcRenderer.on('update-progress', progress => { - console.log(progress) + ipcRenderer.on('update-progress', (event, progress) => { + // console.log(progress) this.setDownloadProgress(progress) }) ipcRenderer.on('update-downloaded', info => { - console.log(info) + // console.log(info) this.clearUpdateTimeout() - this.setVersionModalVisible({ isError: false }) - this.showUpdateModal() + this.setVersionModalVisible({ isDownloaded: true }) + this.$nextTick(() => { + this.showUpdateModal() + }) }) ipcRenderer.on('update-not-available', () => { - if (!this.updateTimeout) return - if (this.setting.ignoreVersion) this.setSetting(Object.assign({}, this.setting, { ignoreVersion: null })) this.clearUpdateTimeout() this.setNewVersion({ version: this.version.version, @@ -143,11 +149,11 @@ export default { // 更新超时定时器 this.updateTimeout = setTimeout(() => { this.updateTimeout = null - this.setVersionModalVisible({ isError: true }) + this.setVersionModalVisible({ isTimeOut: true }) this.$nextTick(() => { this.showUpdateModal() }) - }, 180000) + }, 60 * 30 * 1000) this.initData() this.globalObj.apiSource = this.setting.apiSource @@ -192,12 +198,18 @@ export default { showUpdateModal() { (this.version.newVersion && this.version.newVersion.history ? Promise.resolve(this.version.newVersion) : this.getVersionInfo().then(body => { this.setNewVersion(body) - if (body.version !== this.setting.ignoreVersion) this.setSetting(Object.assign({}, this.setting, { ignoreVersion: null })) return body - })).then(body => { - if (body.version === this.version.version) return - if (this.version.isError && body.version === this.setting.ignoreVersion) return - + })).catch(() => { + this.setVersionModalVisible({ isUnknow: true }) + let result = { + version: '0.0.0', + desc: null, + } + this.setNewVersion(result) + return result + }).then(result => { + if (result.version === this.version.version) return + console.log(this.version) this.$nextTick(() => { this.setVersionModalVisible({ isShow: true }) }) diff --git a/src/renderer/components/material/VersionModal.vue b/src/renderer/components/material/VersionModal.vue index dce871dc..4235e062 100644 --- a/src/renderer/components/material/VersionModal.vue +++ b/src/renderer/components/material/VersionModal.vue @@ -1,7 +1,31 @@