feat: 添加对数据库初始化的调用,优化设置存储逻辑
This commit is contained in:
@@ -2,7 +2,6 @@ import { defaultConfig } from '@tamagui/config/v4'
|
||||
import { createTamagui } from 'tamagui'
|
||||
import { bodyFont, headingFont } from './fonts'
|
||||
import { animations } from './animations'
|
||||
import { basicThemes } from 'apps/expo/themes/basic'
|
||||
export const config = createTamagui({
|
||||
...defaultConfig,
|
||||
animations,
|
||||
@@ -10,9 +9,8 @@ export const config = createTamagui({
|
||||
body: bodyFont,
|
||||
heading: headingFont,
|
||||
},
|
||||
settings:{
|
||||
settings: {
|
||||
...defaultConfig.settings,
|
||||
onlyAllowShorthands: false
|
||||
onlyAllowShorthands: false,
|
||||
},
|
||||
basicThemes
|
||||
})
|
||||
|
||||
@@ -55,10 +55,10 @@ class SettingStore {
|
||||
* 自动判断重连
|
||||
*/
|
||||
private _ensureDB = safe(async () => {
|
||||
const { db, isDbClosed } = this
|
||||
const { db, isDbClosed, initDB } = this
|
||||
|
||||
if (!db || isDbClosed) {
|
||||
this.db = await openDatabase({ name: DB_SETTINGS_NAME })
|
||||
await initDB()
|
||||
this.isDbClosed = false
|
||||
}
|
||||
})
|
||||
@@ -182,5 +182,3 @@ class SettingStore {
|
||||
* ```
|
||||
*/
|
||||
export const settingsStore = new SettingStore()
|
||||
|
||||
await settingsStore.initDB()
|
||||
|
||||
Reference in New Issue
Block a user