|
@@ -20,13 +20,12 @@ import { Locale as VantLocale, Lazyload } from 'vant'
|
|
|
import vantEnUS from 'vant/es/locale/lang/en-US'
|
|
import vantEnUS from 'vant/es/locale/lang/en-US'
|
|
|
import { useStorage } from '@vueuse/core'
|
|
import { useStorage } from '@vueuse/core'
|
|
|
import { init as initEruda } from '@/utils/console'
|
|
import { init as initEruda } from '@/utils/console'
|
|
|
-import { codePush, InstallMode } from 'capacitor-codepush'
|
|
|
|
|
-import { SyncStatus } from 'capacitor-codepush/dist/esm/syncStatus'
|
|
|
|
|
import { Network } from '@capacitor/network'
|
|
import { Network } from '@capacitor/network'
|
|
|
import { SafeArea } from 'capacitor-plugin-safe-area'
|
|
import { SafeArea } from 'capacitor-plugin-safe-area'
|
|
|
import qs from 'qs'
|
|
import qs from 'qs'
|
|
|
import { App as AppPlugin } from '@capacitor/app'
|
|
import { App as AppPlugin } from '@capacitor/app'
|
|
|
import { emitter } from '@/utils/eventBus'
|
|
import { emitter } from '@/utils/eventBus'
|
|
|
|
|
+import { checkUpdate } from '@/plugins/updater'
|
|
|
|
|
|
|
|
import 'normalize.css/normalize.css'
|
|
import 'normalize.css/normalize.css'
|
|
|
|
|
|
|
@@ -67,12 +66,11 @@ app.use(IonicVue)
|
|
|
app.use(router)
|
|
app.use(router)
|
|
|
app.use(createPinia())
|
|
app.use(createPinia())
|
|
|
app.use(http)
|
|
app.use(http)
|
|
|
|
|
+VantLocale.use('zh-TW', zhTW)
|
|
|
app.use(Vant)
|
|
app.use(Vant)
|
|
|
app.use(toast)
|
|
app.use(toast)
|
|
|
app.mixin(common)
|
|
app.mixin(common)
|
|
|
-const packageSynced = ref(false)
|
|
|
|
|
-app.provide('packageSynced', packageSynced)
|
|
|
|
|
-VantLocale.use('zh-TW', zhTW)
|
|
|
|
|
|
|
+
|
|
|
app.use(Lazyload)
|
|
app.use(Lazyload)
|
|
|
|
|
|
|
|
// ionic components
|
|
// ionic components
|
|
@@ -91,44 +89,6 @@ router.isReady().then(() => {
|
|
|
// setDefaultOptions({ locale: enUS })
|
|
// setDefaultOptions({ locale: enUS })
|
|
|
// }
|
|
// }
|
|
|
const firstRun = useStorage('firstRun', true)
|
|
const firstRun = useStorage('firstRun', true)
|
|
|
-const checkUpdate = async () => {
|
|
|
|
|
- // if (!location.origin.includes('localhost')) {
|
|
|
|
|
- // packageSynced.value = true
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // await codePush.notifyApplicationReady()
|
|
|
|
|
- // try {
|
|
|
|
|
- // console.log('codePush -> checking for update')
|
|
|
|
|
- // const update = await new Promise((resolve, reject) => {
|
|
|
|
|
- // codePush.checkForUpdate(
|
|
|
|
|
- // p => {
|
|
|
|
|
- // resolve(p)
|
|
|
|
|
- // },
|
|
|
|
|
- // err => {
|
|
|
|
|
- // reject(err)
|
|
|
|
|
- // }
|
|
|
|
|
- // )
|
|
|
|
|
- // })
|
|
|
|
|
- // if (!update) {
|
|
|
|
|
- // console.log('codePush -> no update available')
|
|
|
|
|
- // } else {
|
|
|
|
|
- // console.log('codePush -> there is an update, start download', update)
|
|
|
|
|
- // const downloadedPackage = await update.download(downloadProgress => {
|
|
|
|
|
- // console.log(`Downloading ${downloadProgress.receivedBytes} of ${downloadProgress.totalBytes} bytes.`)
|
|
|
|
|
- // })
|
|
|
|
|
- // console.log('codePush -> package downloaded at: ' + downloadedPackage.localPath)
|
|
|
|
|
- // await downloadedPackage.install({
|
|
|
|
|
- // installMode: InstallMode.IMMEDIATE,
|
|
|
|
|
- // minimumBackgroundDuration: 120,
|
|
|
|
|
- // mandatoryInstallMode: InstallMode.IMMEDIATE
|
|
|
|
|
- // })
|
|
|
|
|
- // console.log('codePush -> install update success')
|
|
|
|
|
- // }
|
|
|
|
|
- // } catch (e) {
|
|
|
|
|
- // console.log('codePush -> an error occurred while checking for updates', e)
|
|
|
|
|
- // }
|
|
|
|
|
- // packageSynced.value = true
|
|
|
|
|
-}
|
|
|
|
|
const initAF = async () => {
|
|
const initAF = async () => {
|
|
|
const appInfo = await AppPlugin.getInfo()
|
|
const appInfo = await AppPlugin.getInfo()
|
|
|
if (/\.dev$/.test(appInfo.id)) {
|
|
if (/\.dev$/.test(appInfo.id)) {
|
|
@@ -248,8 +208,6 @@ if (Capacitor.isNativePlatform()) {
|
|
|
checkUpdate()
|
|
checkUpdate()
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-} else {
|
|
|
|
|
- packageSynced.value = true
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (useStorage('showConsole', 0).value > new Date().getTime()) {
|
|
if (useStorage('showConsole', 0).value > new Date().getTime()) {
|