feat: implement automatic update checking and downloading functionality in the desktop app, enhancing user experience with seamless updates and corresponding UI settings

This commit is contained in:
wizardchen
2026-04-11 18:27:08 +08:00
committed by lyingbug
parent c4ebc1f60e
commit 9874fcee7c
13 changed files with 527 additions and 23 deletions
@@ -73,6 +73,19 @@
</t-link>
</template>
</t-alert>
<!-- 自动下载更新开关 (Lite edition only) -->
<div class="setting-row" v-if="authStore.isLiteMode">
<div class="setting-info">
<label>{{ $t('settings.autoCheckUpdate') }}</label>
<p class="desc">{{ $t('settings.autoCheckUpdateDesc') }}</p>
</div>
<div class="setting-control">
<t-switch
v-model="isAutoCheckUpdateEnabled"
/>
</div>
</div>
</div>
</div>
</template>
@@ -82,11 +95,13 @@ import { ref, onMounted, computed } from 'vue'
import { MessagePlugin } from 'tdesign-vue-next'
import { useI18n } from 'vue-i18n'
import { useSettingsStore } from '@/stores/settings'
import { useAuthStore } from '@/stores/auth'
import { getSystemInfo } from '@/api/system'
import { useTheme, type ThemeMode } from '@/composables/useTheme'
const { t, locale } = useI18n()
const settingsStore = useSettingsStore()
const authStore = useAuthStore()
const { currentTheme, setTheme } = useTheme()
// 本地状态
@@ -106,6 +121,21 @@ const isMemoryEnabled = computed({
set: (val) => settingsStore.toggleMemory(val)
})
// 自动检查更新状态
const isAutoCheckUpdateEnabled = computed({
get: () => settingsStore.isAutoCheckUpdateEnabled,
set: (val) => {
settingsStore.toggleAutoCheckUpdate(val)
if (val) {
// @ts-ignore
if (window.go && window.go.main && window.go.main.App && window.go.main.App.AutoCheckForUpdates) {
// @ts-ignore
window.go.main.App.AutoCheckForUpdates()
}
}
}
})
// 初始化加载
onMounted(async () => {
// 从 localStorage 加载语言设置