Skip to content

Commit

Permalink
修复更新超时弹窗在非更新阶段意外弹出的问题(#1797
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Feb 29, 2024
1 parent c001803 commit 07ed408
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- 修复某些情况下歌曲加载时间过长时不会自动跳到下一首的问题
- 修复mg歌词在某些情况下获取失败的问题(#1783
- 修复mg歌单搜索
- 修复更新超时弹窗在非更新阶段意外弹出的问题(#1797

### 其他

Expand Down
33 changes: 19 additions & 14 deletions src/renderer/core/useApp/useUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ export default () => {

// 更新超时定时器
let updateTimeout: number | null = null
if (window.lx.isProd && !(isWin && process.arch.includes('arm'))) {
updateTimeout = window.setTimeout(() => {
updateTimeout = null
void nextTick(() => {
showUpdateModal()
setTimeout(() => {
void dialog({
message: window.i18n.t('update__timeout_top'),
confirmButtonText: window.i18n.t('alert_button_text'),
})
}, 500)
})
}, 60 * 60 * 1000)
const startUpdateTimeout = () => {
if (window.lx.isProd && !(isWin && process.arch.includes('arm'))) {
updateTimeout = window.setTimeout(() => {
updateTimeout = null
void nextTick(() => {
showUpdateModal()
setTimeout(() => {
void dialog({
message: window.i18n.t('update__timeout_top'),
confirmButtonText: window.i18n.t('alert_button_text'),
})
}, 500)
})
}, 60 * 60 * 1000)
}
}

const clearUpdateTimeout = () => {
Expand Down Expand Up @@ -149,7 +151,10 @@ export default () => {
desc: info.releaseNotes as string,
}
versionInfo.isLatest = false
if (appSetting['common.tryAutoUpdate']) versionInfo.status = 'downloading'
if (appSetting['common.tryAutoUpdate']) {
versionInfo.status = 'downloading'
startUpdateTimeout()
}
void nextTick(() => {
showUpdateModal()
})
Expand Down

0 comments on commit 07ed408

Please sign in to comment.