mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-04 06:32:10 +08:00
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import { initSetting, showPactModal } from '@/core/common'
|
|
import registerPlaybackService from '@/plugins/player/service'
|
|
import initTheme from './theme'
|
|
import initI18n from './i18n'
|
|
import initPlayer from './player'
|
|
import dataInit from './dataInit'
|
|
import initSync from './sync'
|
|
// import syncSetting from './syncSetting'
|
|
import { setUserApi } from '@/core/apiSource'
|
|
import commonActions from '@/store/common/action'
|
|
import settingState from '@/store/setting/state'
|
|
import { checkUpdate } from '@/core/version'
|
|
import { bootLog } from '@/utils/bootLog'
|
|
import { cheatTip } from '@/utils/tools'
|
|
|
|
let isFirstPush = true
|
|
const handlePushedHomeScreen = async() => {
|
|
await cheatTip()
|
|
if (settingState.setting['common.isAgreePact']) {
|
|
if (isFirstPush) {
|
|
isFirstPush = false
|
|
void checkUpdate()
|
|
}
|
|
} else {
|
|
if (isFirstPush) isFirstPush = false
|
|
showPactModal()
|
|
}
|
|
}
|
|
|
|
let isInited = false
|
|
export default async() => {
|
|
if (isInited) return handlePushedHomeScreen
|
|
bootLog('Initing...')
|
|
commonActions.setFontSize(global.lx.fontSize)
|
|
bootLog('Font size changed.')
|
|
const setting = await initSetting()
|
|
bootLog('Setting inited.')
|
|
// console.log(setting)
|
|
|
|
await initTheme(setting)
|
|
bootLog('Theme inited.')
|
|
await initI18n(setting)
|
|
bootLog('I18n inited.')
|
|
|
|
setUserApi(setting['common.apiSource'])
|
|
bootLog('Api inited.')
|
|
|
|
registerPlaybackService()
|
|
bootLog('Playback Service Registered.')
|
|
await initPlayer(setting)
|
|
bootLog('Player inited.')
|
|
await dataInit(setting)
|
|
bootLog('Data inited.')
|
|
|
|
void initSync(setting)
|
|
bootLog('Sync inited.')
|
|
|
|
// syncSetting()
|
|
|
|
isInited = true
|
|
|
|
return handlePushedHomeScreen
|
|
}
|