11<script lang="tsx" setup>
22import { promiseTimeout , useScreenOrientation , watchImmediate } from ' @vueuse/core' ;
3- import mp from ' mixpanel-browser' ;
43import { enUS , zhCN } from ' naive-ui' ;
54import { computed , markRaw , onMounted , ref , watch } from ' vue' ;
65import { useI18n } from ' vue-i18n' ;
76import { useThemeStore } from ' @/stores/theme' ;
8- import { __APP__ , __GA__ , isPortable } from ' @/utils/app' ;
7+ import { __APP__ , isPortable } from ' @/utils/app' ;
98import { bus } from ' @/utils/event' ;
109import { initPortable } from ' @/utils/fs' ;
1110import { triggerWelcomeGuide } from ' @/utils/guide' ;
1211import { setupI18nHooks , ui } from ' @/utils/ui' ;
12+ import { initAnalytics } from ' ./utils/analytics' ;
1313
1414setupI18nHooks ();
1515
1616const i18n = useI18n ();
17- const { t } = useI18n ({ useScope: ' local ' }) ;
17+ const { t } = i18n ;
1818watchImmediate (i18n .locale , (v ) => {
1919 document .documentElement .lang = v ;
2020});
@@ -49,14 +49,14 @@ function alertOrientation() {
4949
5050 return new Promise <void >((resolve ) => {
5151 const modal = ui .dialog .info ({
52- title: t (' orientation.title' ),
52+ title: t (' app. orientation.title' ),
5353 content : () => (
5454 <>
55- <p class = " m-0" >{ t (' orientation.content-1' )} </p >
56- <p class = " mt-1" >{ t (' orientation.content-2' )} </p >
55+ <p class = " m-0" >{ t (' app. orientation.content-1' )} </p >
56+ <p class = " mt-1" >{ t (' app. orientation.content-2' )} </p >
5757 </>
5858 ),
59- positiveText: i18n . t (' confirm' ),
59+ positiveText: t (' confirm' ),
6060 closable: false ,
6161 onPositiveClick : () => closedOrientation = true , // 手动关闭,下次不再弹窗
6262 onAfterLeave: resolve ,
@@ -77,14 +77,6 @@ watch(orientation, () => {
7777 alertOrientation ();
7878});
7979
80- const token = import .meta .env .EXC_MIXPANEL_TOKEN ;
81- mp .init (token , {
82- persistence: ' localStorage' ,
83- track_pageview: __GA__ ,
84- });
85- if (! __GA__ )
86- mp .disable ();
87-
8880// portable 下 localStorage 与文件同步
8981onMounted (async () => {
9082 if (__APP__ && await isPortable ()) // tree-shake
@@ -94,6 +86,8 @@ onMounted(async () => {
9486function hideSpin() {
9587 document .getElementById (' app' )! .removeAttribute (' data-loading' );
9688}
89+
90+ onMounted (initAnalytics );
9791 </script >
9892
9993<template >
@@ -120,17 +114,3 @@ function hideSpin() {
120114 transition : opacity 0.3s ;
121115}
122116 </style >
123-
124- <i18n lang="yaml">
125- en :
126- orientation :
127- title : Prefer Landscape Mode
128- content-1 : ExCaller is designed to be used in landscape mode, and may have UI issues in portrait mode.
129- content-2 : You can open the notification bar and enable "Auto-rotate", then rotate your device to landscape mode.
130-
131- zh-CN :
132- orientation :
133- title : 推荐横屏使用
134- content-1 : ExCaller 被设计为横屏使用,竖屏使用可能出现问题。
135- content-2 : 您可以下拉通知栏打开“自动旋转”,并将设备旋转至横屏模式。
136- </i18n >
0 commit comments