xiongzhu 3 éve
szülő
commit
d732a29fd6

+ 2 - 0
ios/App/App.xcodeproj/project.pbxproj

@@ -347,6 +347,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
+				DEVELOPMENT_TEAM = 72P5Y6N578;
 				INFOPLIST_FILE = App/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -367,6 +368,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
+				DEVELOPMENT_TEAM = 72P5Y6N578;
 				INFOPLIST_FILE = App/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

+ 2 - 0
ios/App/App/Info.plist

@@ -45,5 +45,7 @@
 	</array>
 	<key>UIViewControllerBasedStatusBarAppearance</key>
 	<true/>
+    <key>com.openinstall.APP_KEY</key>
+    <string>crgkm2</string>
 </dict>
 </plist>

+ 1 - 0
package.json

@@ -43,6 +43,7 @@
     "ionicons": "^6.0.4",
     "less": "^4.1.3",
     "mathjs": "^11.5.0",
+    "mitt": "^3.0.0",
     "normalize.css": "^8.0.1",
     "pinia": "^2.0.26",
     "qrcode": "^1.5.1",

+ 21 - 8
src/App.vue

@@ -8,15 +8,29 @@
 </template>
 
 <script setup>
-import { ConfigProvider as VantConfigProvider } from 'vant'
+import { ConfigProvider as VantConfigProvider, showConfirmDialog } from 'vant'
 import { useBackButton, useIonRouter } from '@ionic/vue'
-import { onMounted } from 'vue'
+import { onMounted, onBeforeUnmount } from 'vue'
 import { useSystemStore } from './stores/system'
 import { App } from '@capacitor/app'
 import { useSettingsStore } from '@/stores/settings'
-const store = useSettingsStore()
+import { useI18n } from 'vue-i18n'
+import { emitter } from '@/utils/eventBus'
 
+const store = useSettingsStore()
+const { t } = useI18n()
 const ionRouter = useIonRouter()
+
+const promptLogin = async () => {
+    console.log('onpromptLogin')
+    const confirm = await showConfirmDialog({
+        title: t('common.alert'),
+        message: t('user.notLogin')
+    }).catch(() => {})
+    if (confirm) {
+        ionRouter.push({ name: 'login' })
+    }
+}
 useBackButton(-1, () => {
     if (!ionRouter.canGoBack()) {
         App.exitApp()
@@ -24,12 +38,11 @@ useBackButton(-1, () => {
 })
 onMounted(() => {
     useSystemStore().getSysConfigs()
+    emitter.on('promptLogin', promptLogin)
+})
+onBeforeUnmount(() => {
+    emitter.off('promptLogin', promptLogin)
 })
-const onClick = () => {
-    $('#tidio-chat-iframe').css('display', 'block')
-    tidioChatApi.display(true)
-    tidioChatApi.open()
-}
 </script>
 <style lang="less" scoped>
 .consult {

+ 22 - 3
src/main.js

@@ -16,6 +16,7 @@ import { Capacitor } from '@capacitor/core'
 import { useBackButton } from '@ionic/vue'
 import { SplashScreen } from '@capacitor/splash-screen'
 import { Openinstall } from 'capacitor-openinstall'
+import { AppsFlyer } from 'appsflyer-capacitor-plugin'
 import { Locale } from 'vant'
 import vantEnUS from 'vant/es/locale/lang/en-US'
 
@@ -88,18 +89,36 @@ document.addEventListener('deviceready', () => {
             )
         }
         Openinstall.init()
-        Openinstall.addListener('wakeUp', data => {
-            console.log('wakeUp', data)
+        const handleData = data => {
             if (data && data.data) {
                 let params = JSON.parse(data.data)
                 if (params.invitor) {
                     localStorage.setItem('invitor', params.invitor)
                 }
             }
+        }
+        Openinstall.addListener('wakeUp', data => {
+            console.log('wakeUp data:', data)
         })
         Openinstall.getInstallCanRetry(data => {
-            console.log('getInstallCanRetry', data)
+            console.log('install data:', data)
+            handleData(data)
         })
+        const afConfig = {
+            appID: 'com.bigauction.mobile', // replace with your app ID.
+            devKey: 'xiQnptYGJ44kMBgmR3esZC', // replace with your dev key.
+            isDebug: true,
+            waitForATTUserAuthorization: 10, // for iOS 14 and higher
+            minTimeBetweenSessions: 6, // default 5 sec
+            registerOnDeepLink: true,
+            registerConversionListener: true,
+            registerOnAppOpenAttribution: false,
+            deepLinkTimeout: 4000, // default 3000 ms
+            useReceiptValidationSandbox: true, // iOS only
+            useUninstallSandbox: true // iOS only
+        }
+
+        AppsFlyer.initSDK(afConfig).then(res => alert(JSON.stringify(res)))
         setTimeout(() => {
             SplashScreen.hide()
         }, 1000)

+ 4 - 11
src/router/index.js

@@ -2,8 +2,7 @@ import { createRouter, createWebHistory } from '@ionic/vue-router'
 import TabsPage from '../views/TabsPage.vue'
 import { Page } from './Page'
 import { useUserStore } from '../stores/user'
-import { showConfirmDialog } from 'vant'
-import i18n from '@/locales'
+import { emitter } from '../utils/eventBus'
 
 const router = createRouter({
     history: createWebHistory(import.meta.env.BASE_URL),
@@ -226,15 +225,9 @@ router.beforeEach(async (to, from, next) => {
             await getUser()
             next()
         } catch (error) {
-            const confirm = await showConfirmDialog({
-                title: i18n.global.t('common.alert'),
-                message: i18n.global.t('user.notLogin')
-            }).catch(() => {
-                next(false)
-            })
-            if (confirm) {
-                next('/login')
-            }
+            console.log(this)
+            next(false)
+            emitter.emit('promptLogin')
         }
     } else {
         if (!user) {

+ 4 - 0
src/utils/eventBus.js

@@ -0,0 +1,4 @@
+import mitt from 'mitt'
+
+const emitter = mitt()
+export { emitter }

+ 1 - 0
src/views/MinePage.vue

@@ -216,6 +216,7 @@ const goSetting = () => {
 }
 const balance = ref({})
 function getBalance() {
+    if (user.value == null) return
     http.get('/user/balance').then(res => {
         balance.value = res
     })

+ 4 - 4
src/views/TabsPage.vue

@@ -1,6 +1,6 @@
 <template>
     <ion-page class="tabs">
-        <ion-tabs ref="tab" @ionTabsDidChange="tabChange">
+        <ion-tabs @ionTabsDidChange="tabChange">
             <img
                 :src="tabIconRank"
                 @click="goRank"
@@ -34,7 +34,8 @@
 </template>
 <script setup>
 import { ref } from 'vue'
-import { useRoute, useRouter } from 'vue-router'
+import { useRoute } from 'vue-router'
+import { useIonRouter } from '@ionic/vue'
 import tabIconHome from '@/assets/tabbar_icon_home.png'
 import tabIconHomePre from '@/assets/tabbar_icon_home_pre.png'
 import tabIconBlf from '@/assets/tabbar_icon_blf.png'
@@ -47,6 +48,7 @@ import tabIconMinePre from '@/assets/tabbar_icon_mine_pre.png'
 import '@/styles/animate.css'
 
 const route = useRoute()
+const router = useIonRouter()
 const activeTab = ref(null)
 if (route.path === '/home') {
     activeTab.value = 'home'
@@ -77,8 +79,6 @@ const tabChange = tabInfo => {
         activeTab.value = 'mine'
     }
 }
-
-const router = useRouter()
 function goRank() {
     router.replace({ name: 'rank' })
     activeTab.value = 'rank'

+ 5 - 0
yarn.lock

@@ -4582,6 +4582,11 @@ minizlib@^2.1.1:
     minipass "^3.0.0"
     yallist "^4.0.0"
 
+mitt@^3.0.0:
+  version "3.0.0"
+  resolved "https://registry.npmmirror.com/mitt/-/mitt-3.0.0.tgz#69ef9bd5c80ff6f57473e8d89326d01c414be0bd"
+  integrity sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==
+
 mkdirp@^1.0.3:
   version "1.0.4"
   resolved "https://registry.npmmirror.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"