feat: 优化应用激活逻辑,增加 IndexedDB 测试失败时的提前返回处理

This commit is contained in:
kuaifan 2025-11-03 00:34:32 +08:00
parent 43746634a5
commit 5121739fe4
2 changed files with 9 additions and 2 deletions

View File

@ -650,11 +650,16 @@ export default {
this.appActivated && $A.eeuiAppHideWebviewSnapshot() this.appActivated && $A.eeuiAppHideWebviewSnapshot()
}, 500) }, 500)
// APP // APP
window.__onAppActive = () => { window.__onAppActive = async () => {
this.appActivated = true this.appActivated = true
// IndexedDB ,
if (!await $A.IDBTest()) {
return;
}
this.autoTheme() this.autoTheme()
$A.updateTimezone() $A.updateTimezone()
$A.IDBTest()
$A.eeuiAppHideWebviewSnapshot() $A.eeuiAppHideWebviewSnapshot()
this.$store.dispatch("safeAreaInsets") this.$store.dispatch("safeAreaInsets")
const nowYmd = $A.daytz().format('YYYY-MM-DD') const nowYmd = $A.daytz().format('YYYY-MM-DD')

View File

@ -1574,6 +1574,7 @@ const timezone = require("dayjs/plugin/timezone");
await localforage.setItem('__test__', $A.dayjs().valueOf()) await localforage.setItem('__test__', $A.dayjs().valueOf())
} }
$A.openLog && console.log('IDBTest OK') $A.openLog && console.log('IDBTest OK')
return true;
} catch (error) { } catch (error) {
if ($A.openLog) { if ($A.openLog) {
console.error('IDBTest Error: ', error) console.error('IDBTest Error: ', error)
@ -1586,6 +1587,7 @@ const timezone = require("dayjs/plugin/timezone");
} else { } else {
$A.reloadUrl(); $A.reloadUrl();
} }
return false;
} }
}, },