Perf: remove duplicate check of new version, refactor getLatestVersion func

This commit is contained in:
萌萌哒赫萝
2023-04-16 22:48:34 +08:00
parent 15d34ac90a
commit ef917ce26e
2 changed files with 18 additions and 21 deletions

View File

@@ -1,9 +1,5 @@
import db from '~/main/apis/core/datastore'
import { getLatestVersion } from '#/utils/getLatestVersion'
import { autoUpdater } from 'electron-updater'
// const releaseUrl = 'https://api.github.com/repos/Molunerfinn/PicGo/releases'
// const releaseUrlBackup = 'https://picgo-1251750343.cos.ap-chengdu.myqcloud.com'
// const downloadUrl = 'https://github.com/Kuingsmile/PicList/releases/latest'
const checkVersion = async () => {
let showTip = db.get('settings.showUpdateTip')
@@ -12,10 +8,9 @@ const checkVersion = async () => {
showTip = true
}
if (showTip) {
const res: string = await getLatestVersion()
if (res !== '') {
autoUpdater.checkForUpdatesAndNotify()
} else {
try {
await autoUpdater.checkForUpdatesAndNotify()
} catch (err) {
return false
}
} else {