|
|
@@ -15,7 +15,6 @@ import { Capacitor } from '@capacitor/core'
|
|
|
import { useBackButton } from '@ionic/vue'
|
|
|
import { SplashScreen } from '@capacitor/splash-screen'
|
|
|
// import { Openinstall } from 'capacitor-openinstall'
|
|
|
-import { AppsFlyer, AFConstants } from 'appsflyer-capacitor-plugin'
|
|
|
import { Locale as VantLocale, Lazyload } from 'vant'
|
|
|
import vantEnUS from 'vant/es/locale/lang/en-US'
|
|
|
import { useStorage } from '@vueuse/core'
|
|
|
@@ -89,81 +88,6 @@ router.isReady().then(() => {
|
|
|
// setDefaultOptions({ locale: enUS })
|
|
|
// }
|
|
|
const firstRun = useStorage('firstRun', true)
|
|
|
-const initAF = async () => {
|
|
|
- const appInfo = await AppPlugin.getInfo()
|
|
|
- if (/\.dev$/.test(appInfo.id)) {
|
|
|
- return
|
|
|
- }
|
|
|
- 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, event => {
|
|
|
- if (event.callbackName === AFConstants.onConversionDataSuccess) {
|
|
|
- console.log('ConversionData: ', event)
|
|
|
- setTimeout(() => {
|
|
|
- console.log('ConversionData: ', event)
|
|
|
- }, 30000)
|
|
|
- setTimeout(() => {
|
|
|
- console.log('ConversionData: ', event)
|
|
|
- }, 60000)
|
|
|
- if (event.data.invitor) {
|
|
|
- invitor.value = event.data.invitor
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- AppsFlyer.addListener(AFConstants.OAOA_CALLBACK, event => {
|
|
|
- if (event.callbackName === AFConstants.onAppOpenAttribution) {
|
|
|
- console.log('onAppOpenAttribution: ', event.data)
|
|
|
- }
|
|
|
- })
|
|
|
- AppsFlyer.addListener(AFConstants.UDL_CALLBACK, event => {
|
|
|
- if (event.status === 'FOUND') {
|
|
|
- console.log('udl found: ', event.deepLink)
|
|
|
- if (event.invitor) {
|
|
|
- invitor.value = event.invitor
|
|
|
- }
|
|
|
- } else if (event.status === 'ERROR') {
|
|
|
- console.log('udl error: ', event.error)
|
|
|
- }
|
|
|
- })
|
|
|
- AppsFlyer.setAppInviteOneLink({
|
|
|
- onelinkID: 'cQAJ'
|
|
|
- })
|
|
|
- const logAppOpenInterval = setInterval(logAppOpen, 3000)
|
|
|
- function logAppOpen() {
|
|
|
- const appOpenLogged = useStorage('appOpenLogged', false, sessionStorage)
|
|
|
- if (appOpenLogged.value == true) {
|
|
|
- clearInterval(logAppOpenInterval)
|
|
|
- } else {
|
|
|
- AppsFlyer.logEvent({
|
|
|
- eventName: 'af_app_opened'
|
|
|
- })
|
|
|
- .then(r => {
|
|
|
- console.log('logAppOpen:', r.res)
|
|
|
- appOpenLogged.value = true
|
|
|
- clearInterval(logAppOpenInterval)
|
|
|
- })
|
|
|
- .catch(err => console.log('logAppOpen err:', err))
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
const initOpeninstall = () => {
|
|
|
// Openinstall.init()
|