xiongzhu 2 سال پیش
والد
کامیت
069981dd1e

BIN
8kO189UyXtWu7IG.zip


+ 2 - 0
android/app/src/main/AndroidManifest.xml

@@ -82,4 +82,6 @@
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="com.google.android.gms.permission.AD_ID" />
+
 </manifest>

BIN
android/app/src/main/assets/cdvasset.manifest


+ 2 - 1
capacitor.config.json

@@ -20,7 +20,8 @@
     },
     "plugins": {
         "SplashScreen": {
-            "launchAutoHide": false
+            "launchShowDuration": 2000,
+            "androidScaleType": "CENTER_CROP"
         },
         "CodePush": {
             "IOS_DEPLOY_KEY": "eAdEIJJkMhuRwBKVpDXvbay6Ay0yEJAbzi0Ur",

+ 60 - 55
src/main.js

@@ -22,6 +22,7 @@ import vantEnUS from 'vant/es/locale/lang/en-US'
 import { useStorage } from '@vueuse/core'
 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 { Facebook } from 'capacitor-facebook'
 
@@ -77,9 +78,6 @@ if (navigator.language === 'zh-CN') {
 } else {
     setDefaultOptions({ locale: enUS })
 }
-document.addEventListener('online', () => {
-    console.log('online')
-})
 document.addEventListener('deviceready', () => {
     console.log('deviceready')
     if (Capacitor.isNativePlatform()) {
@@ -111,54 +109,20 @@ document.addEventListener('deviceready', () => {
         //     console.log('install data:', data)
         //     handleData(data)
         // })
-        const afConfig = {
-            appID: 'id1665426567', // replace with your app ID.
-            devKey: Capacitor.getPlatform() === 'android' ? 'xiQnptYGJ44kMBgmR3esZC' : 'QFfmCXsWbhqgRiXsWx7b2o', // 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 => {
-                console.log('initSDK: ', res)
-            })
-            .catch(e => {
-                console.log('initSDK error: ', e)
-            })
-        AppsFlyer.addListener(AFConstants.CONVERSION_CALLBACK, res => {
-            console.log('CONVERSION_CALLBACK:', res)
-        })
-        AppsFlyer.addListener(AFConstants.OAOA_CALLBACK, res => {
-            console.log('OAOA_CALLBACK: ', res)
-        })
-        AppsFlyer.addListener(AFConstants.UDL_CALLBACK, res => {
-            console.log('UDL_CALLBACK: ', res)
-        })
-        AppsFlyer.setAppInviteOneLink({
-            onelinkID: 'cQAJ'
-        })
-
-        setTimeout(() => {
-            SplashScreen.hide()
-        }, 1000)
-        window.codePush = codePush
-        window.InstallMode = InstallMode
-        const checkUpdate = () => {
+        const checkUpdate = async () => {
+            if (!location.origin.includes('localhost')) return
             codePush
                 .sync(
                     {
                         updateDialog: false,
-                        installMode: InstallMode.IMMEDIATE,
+                        installMode:
+                            localStorage.getItem('firstRun') === '1'
+                                ? InstallMode.ON_NEXT_RESTART
+                                : InstallMode.IMMEDIATE,
                         ignoreFailedUpdates: false
                     },
                     downloadProgress => {
+                        console.log(downloadProgress)
                         if (downloadProgress) {
                             console.log(
                                 `Downloading ${downloadProgress.receivedBytes} of ${downloadProgress.totalBytes}`
@@ -167,15 +131,18 @@ document.addEventListener('deviceready', () => {
                     }
                 )
                 .then(status => {
-                    console.log('codePush sync status:', status)
+                    console.log('codePush sync status:', SyncStatus[status])
+                    if (status === SyncStatus.UP_TO_DATE) {
+                        initAF()
+                    }
                 })
+            localStorage.setItem('firstRun', '1')
         }
-        Network.addListener('networkStatusChange', status => {
-            console.log('networkStatusChange:', status)
-            if (status.connected) {
-                //checkUpdate()
-            }
-        })
+        // Network.addListener('networkStatusChange', status => {
+        //     if (status.connected) {
+        //         //checkUpdate()
+        //     }
+        // })
         Network.getStatus().then(status => {
             console.log('networkStatus:', status)
             if (status.connected) {
@@ -184,11 +151,49 @@ document.addEventListener('deviceready', () => {
         })
     }
 })
+const initAF = () => {
+    const afConfig = {
+        appID: 'id1665426567', // replace with your app ID.
+        devKey: Capacitor.getPlatform() === 'android' ? 'xiQnptYGJ44kMBgmR3esZC' : 'QFfmCXsWbhqgRiXsWx7b2o', // replace with your dev key.
+        isDebug: false,
+        waitForATTUserAuthorization: 10, // for iOS 14 and higher
+        registerOnDeepLink: true,
+        registerConversionListener: true,
+        registerOnAppOpenAttribution: true,
+        deepLinkTimeout: 4000, // default 3000 ms
+        useReceiptValidationSandbox: true, // iOS only
+        useUninstallSandbox: true // iOS only
+    }
+
+    AppsFlyer.initSDK(afConfig)
+        .then(res => {
+            console.log('AppsFlyer initSDK success')
+        })
+        .catch(e => {
+            console.log('initSDK error: ', e)
+        })
+    AppsFlyer.addListener(AFConstants.CONVERSION_CALLBACK, res => {
+        console.log('CONVERSION_CALLBACK:', res)
+    })
+    AppsFlyer.addListener(AFConstants.OAOA_CALLBACK, res => {
+        console.log('OAOA_CALLBACK: ', res)
+    })
+    AppsFlyer.addListener(AFConstants.UDL_CALLBACK, event => {
+        if (event.callbackName === AFConstants.onConversionDataSuccess) {
+            console.log('ConversionData: ', event.data)
+            if (event.data.invitor) {
+                localStorage.setItem('invitor', event.data.invitor)
+            }
+        }
+    })
+    AppsFlyer.setAppInviteOneLink({
+        onelinkID: 'cQAJ'
+    })
+}
 Facebook.init({ appId: '683776590201632', pixelId: '557748303040652' }).then(() => {
     console.log('FacebookSDK initialized')
 })
 
-// if (useStorage('showConsole', 0).value > new Date().getTime()) {
-//     initEruda()
-// }
-initEruda()
+if (useStorage('showConsole', 0).value > new Date().getTime()) {
+    initEruda()
+}

+ 12 - 12
src/utils/console.js

@@ -34,18 +34,18 @@ function init() {
             import('eruda-code').then(res => {
                 eruda.add(res.default)
             })
-            import('eruda-features').then(res => {
-                eruda.add(res.default)
-            })
-            import('eruda-fps').then(res => {
-                eruda.add(res.default)
-            })
-            import('eruda-timing').then(res => {
-                eruda.add(res.default)
-            })
-            import('eruda-memory').then(res => {
-                eruda.add(res.default)
-            })
+            // import('eruda-features').then(res => {
+            //     eruda.add(res.default)
+            // })
+            // import('eruda-fps').then(res => {
+            //     eruda.add(res.default)
+            // })
+            // import('eruda-timing').then(res => {
+            //     eruda.add(res.default)
+            // })
+            // import('eruda-memory').then(res => {
+            //     eruda.add(res.default)
+            // })
         })
         .catch(e => {
             loading = false

+ 1 - 1
src/views/DistributionPage.vue

@@ -168,7 +168,7 @@ export default {
             function loadQR(text) {
                 return new Promise((resolve, reject) => {
                     qrcode.toDataURL(
-                        `${location.origin}/static/download.html?invitor=${userId}`,
+                        `https://ifirstcash.onelink.me/cQAJ/d0785cqz?invitor=${userId}`,
                         { width: 335, height: 335, margin: 0 },
                         function (err, url) {
                             if (err) {