Переглянути джерело

v1.0.0开发:事件打点接口开发

#Suyghur 2 роки тому
батько
коміт
993c0a8b9b
30 змінених файлів з 666 додано та 678 видалено
  1. 1 1
      build.gradle
  2. 12 12
      channel_registry/channel_huawei/build.gradle
  3. 3 1
      demo/build.gradle
  4. 2 2
      demo/src/main/assets/yyxx_game/ext_log.json
  5. 0 15
      demo/src/main/assets/yyxx_game/yyxx_cfg.properties
  6. 0 2
      demo/src/main/assets/yyxx_game/yyxx_comm.properties
  7. 14 13
      demo/src/main/kotlin/com/eyuancomm/demo/DemoActivity.kt
  8. 1 2
      demo/src/main/kotlin/com/eyuancomm/demo/EnvActivity.kt
  9. 3 6
      library_comm/build.gradle
  10. 17 0
      library_comm/buildJar.gradle
  11. 8 0
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/EYuanCommSdk.kt
  12. 1 4
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/Function.kt
  13. 0 2
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/SdkEvent.kt
  14. 2 1
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/ext/CountDownTimerExt.kt
  15. 11 3
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/CommSdkImpl.kt
  16. 0 3
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/VolleyRequest.kt
  17. 0 14
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/utils/ParamsUtils.kt
  18. 1 2
      library_impl/build.gradle
  19. BIN
      libs/apklink.jar
  20. BIN
      libs/eyuancommsdk-comm-1.0.0.jar
  21. 4 7
      module_eyuan/library_eyuan/build.gradle
  22. 0 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/impl/center/BindEmailContainer.kt
  23. 1 2
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/impl/login/UserSignInImpl.kt
  24. 264 264
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/trace/channel/TraceAdjustImpl.kt
  25. 168 168
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/trace/channel/TraceFacebookImpl.kt
  26. 140 140
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/trace/channel/TraceFirebaseImpl.kt
  27. BIN
      module_eyuan/library_eyuan/src/main/res/drawable-xhdpi/yyxx_float_logo_img.png
  28. BIN
      module_eyuan/library_eyuan/src/main/res/drawable-xhdpi/yyxx_float_logo_left_img.png
  29. BIN
      module_eyuan/library_eyuan/src/main/res/drawable-xhdpi/yyxx_float_logo_right_img.png
  30. 13 13
      settings.gradle

+ 1 - 1
build.gradle

@@ -4,7 +4,7 @@ apply from: "config.gradle"
 buildscript {
     ext {
         kotlin_version = '1.6.0'
-        coroutines_version = '1.5.2'
+        coroutines_version = '1.6.0'
     }
     repositories {
         google()

+ 12 - 12
channel_registry/channel_huawei/build.gradle

@@ -67,17 +67,17 @@ dependencies {
 //    api files('libs/facebook-comm-12.3.0.jar')
 //    api files('libs/facebook-core-12.3.0.jar')
 //    api files('libs/facebook-login-12.3.0.jar')
-    implementation 'com.facebook.android:facebook-login:12.3.0'
-    implementation 'com.google.android.gms:play-services-auth:20.1.0'
+//    implementation 'com.facebook.android:facebook-login:12.3.0'
+//    implementation 'com.google.android.gms:play-services-auth:20.1.0'
 
-//    api project(':component:google-auth:play-services-auth')
-//    api project(':component:google-auth:play-services-auth-api-phone')
-//    api project(':component:google-auth:play-services-auth-base')
-//    api project(':component:google-auth:play-services-base')
-//    api project(':component:google-auth:play-services-basement')
-//    api project(':component:google-auth:play-services-tasks')
-//
-//    api project(':component:facebook-auth:facebook-comm')
-//    api project(':component:facebook-auth:facebook-core')
-//    api project(':component:facebook-auth:facebook-login')
+    api project(':component:google-auth:play-services-auth')
+    api project(':component:google-auth:play-services-auth-api-phone')
+    api project(':component:google-auth:play-services-auth-base')
+    api project(':component:google-auth:play-services-base')
+    api project(':component:google-auth:play-services-basement')
+    api project(':component:google-auth:play-services-tasks')
+
+    api project(':component:facebook-auth:facebook-comm')
+    api project(':component:facebook-auth:facebook-core')
+    api project(':component:facebook-auth:facebook-login')
 }

+ 3 - 1
demo/build.gradle

@@ -70,7 +70,7 @@ android {
 dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
     implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
-    implementation 'androidx.appcompat:appcompat:1.4.1'
+//    implementation 'androidx.appcompat:appcompat:1.4.1'
 
 //    implementation 'io.github.yyxxgame.sdk:eyuancomm-sdk-ktx-comm:1.0.0-rc3'
 //    implementation 'io.github.yyxxgame.sdk:eyuancomm-sdk-ktx-impl:1.0.0-rc3'
@@ -80,6 +80,8 @@ dependencies {
     implementation project(':library_impl')
     implementation project(':module_eyuan:library_eyuan')
     implementation project(':module_eyuan:library_hk_language')
+
+//    compileOnly files('../libs/eyuancommsdk-comm-1.0.0.jar')
 //    implementation project(':channel_registry:channel_oppo')
 //    implementation project(':channel_registry:channel_huawei2')
 

+ 2 - 2
demo/src/main/assets/yyxx_game/ext_log.json

@@ -1,4 +1,4 @@
 {
-  "tutorial": "9pwnih",
-  "finish_marry": "avl1zv"
+  "tutorial": "t9ghwz",
+  "finish_marry": "n6ompb"
 }

+ 0 - 15
demo/src/main/assets/yyxx_game/yyxx_cfg.properties

@@ -1,15 +0,0 @@
-YYXX_GCP_CODE=G010199
-#分包标识
-YYXX_GAME_CODE=100001
-# 事件打点应用ID
-YYXX_ADJUST_APP_ID=q1lh43zvrv9c
-# Google AppId
-YYXX_GOOGLE_APP_ID=70429070957
-# Google Server Client Id
-YYXX_GOOGLE_CLIENT_ID=70429070957-7clr9u565jrjgbgg474ksg8q2esq2okj.apps.googleusercontent.com
-# Facebook AppId
-YYXX_FACEBOOK_ID=229604925839347
-#debug模式(cp出正式包请关闭)
-YYXX_OWN_DEBUG=true
-#地区环境
-YYXX_DO_MAIN_ENV=2

+ 0 - 2
demo/src/main/assets/yyxx_game/yyxx_comm.properties

@@ -3,8 +3,6 @@ YYXX_GCP_CODE=Y010402
 YYXX_GAME_CODE=100001
 # 渠道Id
 YYXX_CHANNEL_ID=4
-# Google Server Client Id
-YYXX_GOOGLE_CLIENT_ID=70429070957-7clr9u565jrjgbgg474ksg8q2esq2okj.apps.googleusercontent.com
 # 事件打点应用ID
 YYXX_ADJUST_APP_ID=ymyq28xetdkw
 # debug模式(cp出正式包请关闭)

+ 14 - 13
demo/src/main/kotlin/com/eyuancomm/demo/DemoActivity.kt

@@ -1,5 +1,7 @@
 package com.eyuancomm.demo
 
+import android.app.Activity
+import android.app.AlertDialog
 import android.content.Intent
 import android.os.Bundle
 import android.os.Handler
@@ -11,13 +13,11 @@ import android.widget.Button
 import android.widget.LinearLayout
 import android.widget.ScrollView
 import android.widget.TextView
-import androidx.appcompat.app.AlertDialog
-import androidx.appcompat.app.AppCompatActivity
 import cn.yyxx.eyuancomm.comm.EYuanCommSdk
 import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkEvent
 import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
 import cn.yyxx.eyuancomm.comm.internal.ICallback
-import cn.yyxx.eyuancomm.comm.utils.Logger
 import cn.yyxx.support.hawkeye.LogUtils
 import cn.yyxx.support.hawkeye.ToastUtils
 import kotlin.system.exitProcess
@@ -27,7 +27,7 @@ import kotlin.system.exitProcess
  * @author #Suyghur.
  * Created on 2021/06/09
  */
-class DemoActivity : AppCompatActivity(), View.OnClickListener {
+class DemoActivity : Activity(), View.OnClickListener {
 
     private val events = mutableListOf(
         Item(0, "00 接口环境切换"),
@@ -38,7 +38,7 @@ class DemoActivity : AppCompatActivity(), View.OnClickListener {
         Item(5, "05 角色升级上报"),
         Item(6, "06 应用内购"),
         Item(7, "07 crashlytics崩溃测试"),
-//        Item(8, "08 当前账号取消关联")
+        Item(8, "08 模拟CP事件上报")
     )
 
     private lateinit var layout: LinearLayout
@@ -161,14 +161,15 @@ class DemoActivity : AppCompatActivity(), View.OnClickListener {
                     })
                 }
                 7 -> throw RuntimeException("Test Crashlytics Feature")
-//                8 -> {
-//                    AGConnectAuth.getInstance().deleteUser()
-//                    EYuanCommSdk.getInstance().logout(this@DemoActivity, object : ICallback {
-//                        override fun onResult(code: Int, result: String) {
-//                            ToastUtils.toastInfo(this@DemoActivity, "---- demo提示不做翻译 ----\n取消关联后将登出当前账号,请重新登录\n ---- demo提示不做翻译 ----")
-//                        }
-//                    })
-//                }
+                8 -> {
+                    val tutorialEvent = SdkEvent()
+                    tutorialEvent.eventName = "tutorial"
+                    EYuanCommSdk.getInstance().traceEvent(this@DemoActivity, tutorialEvent)
+
+                    val marryEvent = SdkEvent()
+                    marryEvent.eventName = "finish_marry"
+                    EYuanCommSdk.getInstance().traceEvent(this@DemoActivity, marryEvent)
+                }
 
             }
         }

+ 1 - 2
demo/src/main/kotlin/com/eyuancomm/demo/EnvActivity.kt

@@ -6,7 +6,6 @@ import android.os.Bundle
 import android.view.View
 import android.widget.Button
 import android.widget.LinearLayout
-import androidx.appcompat.app.AppCompatActivity
 import cn.yyxx.support.HostModelUtils
 import cn.yyxx.support.hawkeye.ToastUtils
 
@@ -14,7 +13,7 @@ import cn.yyxx.support.hawkeye.ToastUtils
  * @author #Suyghur.
  * Created on 2021/06/17
  */
-class EnvActivity : AppCompatActivity(), View.OnClickListener {
+class EnvActivity : Activity(), View.OnClickListener {
 
     companion object {
         fun start(activity: Activity) {

+ 3 - 6
library_comm/build.gradle

@@ -65,18 +65,15 @@ dependencies {
     implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
     implementation "androidx.core:core-ktx:1.7.0"
     // 日志采集框架
-    implementation 'io.github.suyghur.dolin:zap:1.0.0'
-
-    implementation 'com.adjust.sdk:adjust-android:4.28.2'
-
+    api 'io.github.suyghur.dolin:zap:1.0.0'
     //mmkv
     api 'com.tencent:mmkv-static:1.2.10'
 
-    //日志采集框架
-    api 'io.github.suyghur.dolin:zap:1.0.0'
+    implementation 'com.adjust.sdk:adjust-android:4.28.2'
 
     api files("../libs/yyxx_support_1.0.2.jar")
     api files("../libs/oaid_sdk_1.0.25.jar")
 }
 
+apply from: 'buildJar.gradle'
 apply from: 'publish.gradle'

+ 17 - 0
library_comm/buildJar.gradle

@@ -0,0 +1,17 @@
+def SDK_BASENAME = "eyuancommsdk-comm"
+def SDK_VERSION = "1.0.0"
+def SEPARATOR = "-"
+def sdkDestinationPath = "build/jar/"
+def zipFile = file('build/intermediates/aar_main_jar/release/classes.jar')
+
+task deleteBaseBuild(type: Delete) {
+    delete sdkDestinationPath
+}
+
+task makeJar(type: Jar) {
+    from zipTree(zipFile)
+    baseName = SDK_BASENAME + SEPARATOR + SDK_VERSION
+    destinationDir = file(sdkDestinationPath)
+}
+
+makeJar.dependsOn(deleteBaseBuild, build)

+ 8 - 0
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/EYuanCommSdk.kt

@@ -10,6 +10,7 @@ import android.webkit.WebView
 import cn.yyxx.eyuancomm.Version
 import cn.yyxx.eyuancomm.comm.entity.Function
 import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkEvent
 import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
 import cn.yyxx.eyuancomm.comm.impl.CommSdkImpl
 import cn.yyxx.eyuancomm.comm.internal.ICallback
@@ -254,6 +255,13 @@ class EYuanCommSdk private constructor() {
         commSdkImpl?.openExitView(activity, callback)
     }
 
+    fun traceEvent(context: Context, sdkEvent: SdkEvent) {
+        if (checkSdkImplNull(Function.TRACE_EVENT, null)) {
+            return
+        }
+        commSdkImpl?.traceEvent(context, sdkEvent)
+    }
+
     fun onStart(activity: Activity) {
         if (checkSdkImplNull(Function.ON_START, null)) {
             return

+ 1 - 4
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/Function.kt

@@ -12,13 +12,12 @@ object Function {
     const val LOGIN = "login"
     const val LOGOUT = "logout"
     const val CHARGE = "charge"
-    const val NOTIFY_ORDER = "notifyOrder"
-    const val GET_ORDER_EXT = "getOrderExt"
     const val HAS_EXIT_VIEW = "hasExitView"
     const val OPEN_EXIT_VIEW = "openExitView"
     const val ROLE_CREATE = "roleCreate"
     const val ROLE_LAUNCHER = "roleLauncher"
     const val ROLE_LEVEL_UP = "roleLevelUp"
+    const val TRACE_EVENT = "traceEvent"
     const val ON_START = "onStart"
     const val ON_RESUME = "onResume"
     const val ON_RESTART = "onRestart"
@@ -28,8 +27,6 @@ object Function {
     const val ON_NEW_INTENT = "onNewIntent"
     const val ON_ACTIVITY_RESULT = "onActivityResult"
     const val GET_CURRENT_USER_ID = "getCurrentUserId"
-    const val GET_CHANNEL_VERSION = "GET_CHANNEL_VERSION"
-    const val GET_CHANNEL_NAME = "GET_CHANNEL_NAME"
     const val SET_ON_FLOAT_BALL_LOGOUT = "setOnFloatBallLogout"
     const val SHOW_FLOAT_BALL = "showFloatBall"
     const val HIDE_FLOAT_BALL = "hideFloatBall"

+ 0 - 2
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/SdkEvent.kt

@@ -7,6 +7,4 @@ package cn.yyxx.eyuancomm.comm.entity
 class SdkEvent {
     var eventName: String = ""
     var eventParams: String = ""
-    var standard: Boolean = false
-    var fbAliasName: String = ""
 }

+ 2 - 1
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/ext/CountDownTimerExt.kt

@@ -20,8 +20,9 @@ fun countDownCoroutines(total: Int, onTick: (Int) -> Unit, onFinish: () -> Unit,
             emit(i)
             delay(1000)
         }
-    }.flowOn(Dispatchers.Main)
+    }.flowOn(Dispatchers.Default)
         .onCompletion { onFinish.invoke() }
         .onEach { onTick.invoke(it) }
+        .flowOn(Dispatchers.Main)
         .launchIn(scope)
 }

+ 11 - 3
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/CommSdkImpl.kt

@@ -6,10 +6,8 @@ import android.content.Context
 import android.content.Intent
 import android.text.TextUtils
 import cn.yyxx.eyuancomm.comm.EYuanCommInstaller
+import cn.yyxx.eyuancomm.comm.entity.*
 import cn.yyxx.eyuancomm.comm.entity.Function
-import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
-import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
 import cn.yyxx.eyuancomm.comm.internal.ICallback
 import cn.yyxx.eyuancomm.comm.network.SdkRequest
 import cn.yyxx.eyuancomm.comm.trace.TraceEventManager
@@ -410,6 +408,16 @@ internal class CommSdkImpl(context: Context) {
         SdkProxyManager.call(Function.OPEN_EXIT_VIEW, arrayOf(Activity::class.java, ICallback::class.java), arrayOf(activity, callback))
     }
 
+    fun traceEvent(context: Context, sdkEvent: SdkEvent) {
+        if (checkSdkProxyNull(Function.TRACE_EVENT, null)) {
+            return
+        }
+        if (checkSdkNonInit(Function.TRACE_EVENT, null)) {
+            return
+        }
+        TraceEventManager.instance.extEvent(context, sdkEvent)
+    }
+
     fun onStart(activity: Activity) {
         if (checkSdkProxyNull(Function.ON_START, null)) {
             return

+ 0 - 3
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/VolleyRequest.kt

@@ -17,9 +17,6 @@ import cn.yyxx.support.volley.entity.FileEntity
 import cn.yyxx.support.volley.source.*
 import cn.yyxx.support.volley.source.toolbox.HttpHeaderParser
 import cn.yyxx.support.volley.source.toolbox.JsonObjectRequest
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
 import kotlinx.coroutines.runBlocking
 import org.json.JSONException
 import org.json.JSONObject

+ 0 - 14
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/utils/ParamsUtils.kt

@@ -16,7 +16,6 @@ object ParamsUtils {
     private const val YYXX_GAME_CODE = "YYXX_GAME_CODE"
     private const val YYXX_CHANNEL_ID = "YYXX_CHANNEL_ID"
     private const val YYXX_ADJSUT_APP_ID = "YYXX_ADJUST_APP_ID"
-    private const val YYXX_GOOGLE_CLIENT_ID = "YYXX_GOOGLE_CLIENT_ID"
     private const val YYXX_DO_MAIN_ENV = "YYXX_DO_MAIN_ENV"
 
     @JvmStatic
@@ -71,19 +70,6 @@ object ParamsUtils {
         return ""
     }
 
-    @JvmStatic
-    fun getGoogleClientId(context: Context): String {
-        try {
-            val clientId = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GOOGLE_CLIENT_ID)
-            if (!TextUtils.isEmpty(clientId)) {
-                return clientId
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return ""
-    }
-
     @JvmStatic
     fun getDoMainEnv(context: Context): Int {
         try {

+ 1 - 2
library_impl/build.gradle

@@ -46,6 +46,5 @@ dependencies {
     compileOnly project(':module_eyuan:library_eyuan')
     compileOnly project(':channel_registry:channel_oppo')
     compileOnly project(':channel_registry:channel_vivo')
-    compileOnly project(':channel_registry:channel_huawei2')
-
+    compileOnly project(':channel_registry:channel_huawei')
 }

BIN
libs/apklink.jar


BIN
libs/eyuancommsdk-comm-1.0.0.jar


+ 4 - 7
module_eyuan/library_eyuan/build.gradle

@@ -71,16 +71,13 @@ dependencies {
     implementation 'com.google.android.gms:play-services-auth:20.1.0'
     //4.0.0的billing库消耗商品会回调两次,后续在排查,先用3.0.3
     implementation 'com.android.billingclient:billing-ktx:3.0.3'
-    implementation 'com.google.firebase:firebase-analytics-ktx:20.1.0'
-    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.8'
+    implementation 'com.google.firebase:firebase-analytics-ktx:20.1.1'
+    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.9'
 
     //facebook
-    implementation 'com.facebook.android:facebook-android-sdk:12.3.0'
+    implementation 'com.facebook.android:facebook-login:13.0.0'
+    implementation 'com.facebook.android:facebook-share:13.0.0'
 
-    //adjust
-    implementation 'com.adjust.sdk:adjust-android:4.28.2'
-
-    compileOnly files('../../libs/yyxx_support_1.0.2.jar')
     compileOnly project(':module_eyuan:library_hk_language')
     compileOnly project(':library_comm')
 }

+ 0 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/impl/center/BindEmailContainer.kt

@@ -187,7 +187,6 @@ class BindEmailContainer(context: Context, private val callback: (Int, String) -
                     text = "${second}s"
                 }
             }, {
-                btnCaptCha.isEnabled = true
                 with(btnCaptCha) {
                     isEnabled = true
                     text = ResUtils.getResString(context, "yyxx_tv_get_captcha")

+ 1 - 2
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/impl/login/UserSignInImpl.kt

@@ -6,7 +6,6 @@ import android.content.Intent
 import android.text.TextUtils
 import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
 import cn.yyxx.eyuancomm.comm.widget.ScaleLoadingDialog
 import cn.yyxx.eyuancomm.core.entity.LoginType
 import cn.yyxx.eyuancomm.core.entity.Session
@@ -45,7 +44,7 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
 
     init {
         this.fbCallback = CallbackManager.Factory.create()
-        val googleServerClientId = ParamsUtils.getGoogleClientId(activity)
+        val googleServerClientId = ResUtils.getResString(activity, "default_web_client_id")
         val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
             .requestEmail()
             .requestIdToken(googleServerClientId)

+ 264 - 264
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/trace/channel/TraceAdjustImpl.kt

@@ -1,264 +1,264 @@
-package cn.yyxx.eyuancomm.core.trace.channel
-
-import android.app.Activity
-import android.app.Application
-import android.content.Context
-import android.text.TextUtils
-import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
-import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVManager
-import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
-import cn.yyxx.eyuancomm.core.entity.LoginType
-import cn.yyxx.eyuancomm.core.entity.SdkEvent
-import cn.yyxx.eyuancomm.core.internal.ITrace
-import cn.yyxx.support.JsonUtils
-import cn.yyxx.support.hawkeye.LogUtils
-import com.adjust.sdk.Adjust
-import com.adjust.sdk.AdjustConfig
-import com.adjust.sdk.AdjustEvent
-import com.adjust.sdk.LogLevel
-import org.json.JSONObject
-import java.io.BufferedReader
-import java.io.InputStreamReader
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/17
- */
-class TraceAdjustImpl(val callback: OnAdjustIdRead) : ITrace {
-
-    private var isInitSuccess = false
-    private var sdkConfig: JSONObject? = null
-    private var extConfig: JSONObject? = null
-
-
-    override fun onInitialize(application: Application) {
-
-        this.sdkConfig = getSdkLogJson(application)
-        this.extConfig = getExtLogJson(application)
-
-        if (sdkConfig == null) {
-            Logger.e("adjust log 初始化失败,读取sdk_log.json异常")
-            return
-        }
-
-        val appId = ParamsUtils.getAdjustAppId(application)
-        if (TextUtils.isEmpty(appId)) {
-            Logger.e("adjust log 初始化失败,app id为空")
-            isInitSuccess = false
-            return
-        }
-
-        val environment = if (LogUtils.DEBUG) {
-            AdjustConfig.ENVIRONMENT_SANDBOX
-        } else {
-            AdjustConfig.ENVIRONMENT_PRODUCTION
-        }
-
-        val config = AdjustConfig(application, appId, environment, true)
-        config.setLogLevel(LogLevel.VERBOSE)
-        config.setOnAttributionChangedListener {
-            callback.onRead(it.adid)
-        }
-        Adjust.onCreate(config)
-        if (MMKVManager.instance.eventKV.decodeBool("adjust_activities")) {
-            isInitSuccess = true
-            return
-        }
-        sdkConfig?.apply {
-            if (JsonUtils.hasJsonKey(this, "open_app")) {
-                Adjust.trackEvent(AdjustEvent(this.getString("open_app")))
-                Logger.d("adjust log open app success")
-                MMKVManager.instance.eventKV.encode("adjust_activities", true)
-                isInitSuccess = true
-            }
-        }
-    }
-
-    override fun onLogin(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("adjust log failed , user is null")
-            return
-        }
-
-        sdkConfig?.apply {
-            when (SdkLoginInfo.instance.loginType) {
-                LoginType.TYPE_GUEST_LOGIN -> {
-                    if (JsonUtils.hasJsonKey(this, "login_success_quick")) {
-                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_quick")))
-                        Logger.d("adjust log guest login success")
-                    }
-                }
-                LoginType.TYPE_FACEBOOK_LOGIN -> {
-                    if (JsonUtils.hasJsonKey(this, "login_success_fb")) {
-                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_fb")))
-                        Logger.d("adjust log facebook login success")
-                    }
-                }
-                LoginType.TYPE_GOOGLE_LOGIN -> {
-                    if (JsonUtils.hasJsonKey(this, "login_success_google")) {
-                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_google")))
-                        Logger.d("adjust log google login success")
-                    }
-                }
-                LoginType.TYPE_ACCOUNT_LOGIN -> {
-                    if (JsonUtils.hasJsonKey(this, "login_success_account")) {
-                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_account")))
-                        Logger.d("adjust log account login success")
-                    }
-                }
-            }
-        }
-    }
-
-    override fun onRegister(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("adjust log failed , user is null")
-            return
-        }
-
-        sdkConfig?.apply {
-            if (JsonUtils.hasJsonKey(this, "sign_up")) {
-                Adjust.trackEvent(AdjustEvent(this.getString("sign_up")))
-                Logger.d("adjust log register success")
-            }
-        }
-    }
-
-    override fun onCharge(context: Context, chargeInfo: SdkChargeInfo) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("adjust log failed , user is null")
-            return
-        }
-
-        sdkConfig?.apply {
-            if (!MMKVManager.instance.eventKV.decodeBool("adjust_first_purchase")) {
-                if (JsonUtils.hasJsonKey(this, "first_purchase")) {
-                    val event = AdjustEvent(this.getString("first_purchase"))
-                    event.setRevenue(chargeInfo.amount.toDouble() / 100, "USD")
-                    event.setOrderId(chargeInfo.orderId)
-                    Adjust.trackEvent(event)
-                    Logger.d("adjust log first charge success")
-                    MMKVManager.instance.eventKV.encode("adjust_first_purchase", true)
-                }
-            }
-
-            if (JsonUtils.hasJsonKey(this, "ecommerce_purchase")) {
-                val event = AdjustEvent(this.getString("ecommerce_purchase"))
-                event.setRevenue(chargeInfo.amount.toDouble() / 100, "USD")
-                event.setOrderId(chargeInfo.orderId)
-                Adjust.trackEvent(event)
-                Logger.d("adjust log charge success")
-            }
-        }
-    }
-
-    override fun onCreate(activity: Activity) {
-    }
-
-    override fun onResume(activity: Activity) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-        Adjust.onResume()
-    }
-
-    override fun onPause(activity: Activity) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-        Adjust.onPause()
-    }
-
-    override fun onSdkEvent(context: Context, sdkEvent: SdkEvent) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-
-        sdkConfig?.apply {
-            if (JsonUtils.hasJsonKey(this, sdkEvent.eventName)) {
-                Adjust.trackEvent(AdjustEvent(this.getString(sdkEvent.eventName)))
-                Logger.d("adjust log sdk event ${sdkEvent.eventName} success")
-            }
-        }
-    }
-
-    override fun onExtEvent(context: Context, sdkEvent: SdkEvent) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-
-        extConfig?.apply {
-            if (JsonUtils.hasJsonKey(this, sdkEvent.eventName)) {
-                Adjust.trackEvent(AdjustEvent(this.getString(sdkEvent.eventName)))
-                Logger.d("adjust log ext event ${sdkEvent.eventName} success")
-            }
-        }
-    }
-
-    private fun getSdkLogJson(context: Context): JSONObject? {
-        val path = "yyxx_game/sdk_log.json"
-        val sb = StringBuilder()
-        try {
-            val assetManager = context.assets
-            BufferedReader(InputStreamReader(assetManager.open(path))).use {
-                var line = ""
-                while (true) {
-                    line = it.readLine() ?: break
-                    sb.append(line)
-                }
-            }
-            if (!TextUtils.isEmpty(sb.toString())) {
-                return JSONObject(sb.toString())
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return null
-    }
-
-    private fun getExtLogJson(context: Context): JSONObject? {
-        val path = "yyxx_game/ext_log.json"
-        val sb = StringBuilder()
-        try {
-            val assetManager = context.assets
-            BufferedReader(InputStreamReader(assetManager.open(path))).use {
-                var line = ""
-                while (true) {
-                    line = it.readLine() ?: break
-                    sb.append(line)
-                }
-            }
-            if (!TextUtils.isEmpty(sb.toString())) {
-                return JSONObject(sb.toString())
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return null
-    }
-
-    interface OnAdjustIdRead {
-        fun onRead(id: String)
-    }
-}
+//package cn.yyxx.eyuancomm.core.trace.channel
+//
+//import android.app.Activity
+//import android.app.Application
+//import android.content.Context
+//import android.text.TextUtils
+//import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+//import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
+//import cn.yyxx.eyuancomm.comm.utils.Logger
+//import cn.yyxx.eyuancomm.comm.utils.MMKVManager
+//import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
+//import cn.yyxx.eyuancomm.core.entity.LoginType
+//import cn.yyxx.eyuancomm.core.entity.SdkEvent
+//import cn.yyxx.eyuancomm.core.internal.ITrace
+//import cn.yyxx.support.JsonUtils
+//import cn.yyxx.support.hawkeye.LogUtils
+//import com.adjust.sdk.Adjust
+//import com.adjust.sdk.AdjustConfig
+//import com.adjust.sdk.AdjustEvent
+//import com.adjust.sdk.LogLevel
+//import org.json.JSONObject
+//import java.io.BufferedReader
+//import java.io.InputStreamReader
+//
+///**
+// * @author #Suyghur.
+// * Created on 2021/06/17
+// */
+//class TraceAdjustImpl(val callback: OnAdjustIdRead) : ITrace {
+//
+//    private var isInitSuccess = false
+//    private var sdkConfig: JSONObject? = null
+//    private var extConfig: JSONObject? = null
+//
+//
+//    override fun onInitialize(application: Application) {
+//
+//        this.sdkConfig = getSdkLogJson(application)
+//        this.extConfig = getExtLogJson(application)
+//
+//        if (sdkConfig == null) {
+//            Logger.e("adjust log 初始化失败,读取sdk_log.json异常")
+//            return
+//        }
+//
+//        val appId = ParamsUtils.getAdjustAppId(application)
+//        if (TextUtils.isEmpty(appId)) {
+//            Logger.e("adjust log 初始化失败,app id为空")
+//            isInitSuccess = false
+//            return
+//        }
+//
+//        val environment = if (LogUtils.DEBUG) {
+//            AdjustConfig.ENVIRONMENT_SANDBOX
+//        } else {
+//            AdjustConfig.ENVIRONMENT_PRODUCTION
+//        }
+//
+//        val config = AdjustConfig(application, appId, environment, true)
+//        config.setLogLevel(LogLevel.VERBOSE)
+//        config.setOnAttributionChangedListener {
+//            callback.onRead(it.adid)
+//        }
+//        Adjust.onCreate(config)
+//        if (MMKVManager.instance.eventKV.decodeBool("adjust_activities")) {
+//            isInitSuccess = true
+//            return
+//        }
+//        sdkConfig?.apply {
+//            if (JsonUtils.hasJsonKey(this, "open_app")) {
+//                Adjust.trackEvent(AdjustEvent(this.getString("open_app")))
+//                Logger.d("adjust log open app success")
+//                MMKVManager.instance.eventKV.encode("adjust_activities", true)
+//                isInitSuccess = true
+//            }
+//        }
+//    }
+//
+//    override fun onLogin(context: Context) {
+//        if (!isInitSuccess) {
+//            Logger.e("adjust log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("adjust log failed , user is null")
+//            return
+//        }
+//
+//        sdkConfig?.apply {
+//            when (SdkLoginInfo.instance.loginType) {
+//                LoginType.TYPE_GUEST_LOGIN -> {
+//                    if (JsonUtils.hasJsonKey(this, "login_success_quick")) {
+//                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_quick")))
+//                        Logger.d("adjust log guest login success")
+//                    }
+//                }
+//                LoginType.TYPE_FACEBOOK_LOGIN -> {
+//                    if (JsonUtils.hasJsonKey(this, "login_success_fb")) {
+//                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_fb")))
+//                        Logger.d("adjust log facebook login success")
+//                    }
+//                }
+//                LoginType.TYPE_GOOGLE_LOGIN -> {
+//                    if (JsonUtils.hasJsonKey(this, "login_success_google")) {
+//                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_google")))
+//                        Logger.d("adjust log google login success")
+//                    }
+//                }
+//                LoginType.TYPE_ACCOUNT_LOGIN -> {
+//                    if (JsonUtils.hasJsonKey(this, "login_success_account")) {
+//                        Adjust.trackEvent(AdjustEvent(this.getString("login_success_account")))
+//                        Logger.d("adjust log account login success")
+//                    }
+//                }
+//            }
+//        }
+//    }
+//
+//    override fun onRegister(context: Context) {
+//        if (!isInitSuccess) {
+//            Logger.e("adjust log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("adjust log failed , user is null")
+//            return
+//        }
+//
+//        sdkConfig?.apply {
+//            if (JsonUtils.hasJsonKey(this, "sign_up")) {
+//                Adjust.trackEvent(AdjustEvent(this.getString("sign_up")))
+//                Logger.d("adjust log register success")
+//            }
+//        }
+//    }
+//
+//    override fun onCharge(context: Context, chargeInfo: SdkChargeInfo) {
+//        if (!isInitSuccess) {
+//            Logger.e("adjust log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("adjust log failed , user is null")
+//            return
+//        }
+//
+//        sdkConfig?.apply {
+//            if (!MMKVManager.instance.eventKV.decodeBool("adjust_first_purchase")) {
+//                if (JsonUtils.hasJsonKey(this, "first_purchase")) {
+//                    val event = AdjustEvent(this.getString("first_purchase"))
+//                    event.setRevenue(chargeInfo.amount.toDouble() / 100, "USD")
+//                    event.setOrderId(chargeInfo.orderId)
+//                    Adjust.trackEvent(event)
+//                    Logger.d("adjust log first charge success")
+//                    MMKVManager.instance.eventKV.encode("adjust_first_purchase", true)
+//                }
+//            }
+//
+//            if (JsonUtils.hasJsonKey(this, "ecommerce_purchase")) {
+//                val event = AdjustEvent(this.getString("ecommerce_purchase"))
+//                event.setRevenue(chargeInfo.amount.toDouble() / 100, "USD")
+//                event.setOrderId(chargeInfo.orderId)
+//                Adjust.trackEvent(event)
+//                Logger.d("adjust log charge success")
+//            }
+//        }
+//    }
+//
+//    override fun onCreate(activity: Activity) {
+//    }
+//
+//    override fun onResume(activity: Activity) {
+//        if (!isInitSuccess) {
+//            Logger.e("adjust log failed , component initialize failed")
+//            return
+//        }
+//        Adjust.onResume()
+//    }
+//
+//    override fun onPause(activity: Activity) {
+//        if (!isInitSuccess) {
+//            Logger.e("adjust log failed , component initialize failed")
+//            return
+//        }
+//        Adjust.onPause()
+//    }
+//
+//    override fun onSdkEvent(context: Context, sdkEvent: SdkEvent) {
+//        if (!isInitSuccess) {
+//            Logger.e("adjust log failed , component initialize failed")
+//            return
+//        }
+//
+//        sdkConfig?.apply {
+//            if (JsonUtils.hasJsonKey(this, sdkEvent.eventName)) {
+//                Adjust.trackEvent(AdjustEvent(this.getString(sdkEvent.eventName)))
+//                Logger.d("adjust log sdk event ${sdkEvent.eventName} success")
+//            }
+//        }
+//    }
+//
+//    override fun onExtEvent(context: Context, sdkEvent: SdkEvent) {
+//        if (!isInitSuccess) {
+//            Logger.e("adjust log failed , component initialize failed")
+//            return
+//        }
+//
+//        extConfig?.apply {
+//            if (JsonUtils.hasJsonKey(this, sdkEvent.eventName)) {
+//                Adjust.trackEvent(AdjustEvent(this.getString(sdkEvent.eventName)))
+//                Logger.d("adjust log ext event ${sdkEvent.eventName} success")
+//            }
+//        }
+//    }
+//
+//    private fun getSdkLogJson(context: Context): JSONObject? {
+//        val path = "yyxx_game/sdk_log.json"
+//        val sb = StringBuilder()
+//        try {
+//            val assetManager = context.assets
+//            BufferedReader(InputStreamReader(assetManager.open(path))).use {
+//                var line = ""
+//                while (true) {
+//                    line = it.readLine() ?: break
+//                    sb.append(line)
+//                }
+//            }
+//            if (!TextUtils.isEmpty(sb.toString())) {
+//                return JSONObject(sb.toString())
+//            }
+//        } catch (e: Exception) {
+//            e.printStackTrace()
+//        }
+//        return null
+//    }
+//
+//    private fun getExtLogJson(context: Context): JSONObject? {
+//        val path = "yyxx_game/ext_log.json"
+//        val sb = StringBuilder()
+//        try {
+//            val assetManager = context.assets
+//            BufferedReader(InputStreamReader(assetManager.open(path))).use {
+//                var line = ""
+//                while (true) {
+//                    line = it.readLine() ?: break
+//                    sb.append(line)
+//                }
+//            }
+//            if (!TextUtils.isEmpty(sb.toString())) {
+//                return JSONObject(sb.toString())
+//            }
+//        } catch (e: Exception) {
+//            e.printStackTrace()
+//        }
+//        return null
+//    }
+//
+//    interface OnAdjustIdRead {
+//        fun onRead(id: String)
+//    }
+//}

+ 168 - 168
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/trace/channel/TraceFacebookImpl.kt

@@ -1,168 +1,168 @@
-package cn.yyxx.eyuancomm.core.trace.channel
-
-import android.app.Activity
-import android.app.Application
-import android.content.Context
-import android.os.Bundle
-import android.text.TextUtils
-import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
-import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVManager
-import cn.yyxx.eyuancomm.core.entity.LoginType
-import cn.yyxx.eyuancomm.core.entity.SdkEvent
-import cn.yyxx.eyuancomm.core.internal.ITrace
-import com.facebook.FacebookSdk
-import com.facebook.LoggingBehavior
-import com.facebook.appevents.AppEventsConstants
-import com.facebook.appevents.AppEventsLogger
-import java.math.BigDecimal
-import java.util.*
-
-/**
- * @author #Suyghur.
- * Created on 2021/07/06
- */
-class TraceFacebookImpl : ITrace {
-
-    private lateinit var fbLogger: AppEventsLogger
-    private var isInitSuccess = false
-
-    override fun onInitialize(application: Application) {
-
-        FacebookSdk.setIsDebugEnabled(true)
-        FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
-
-        fbLogger = AppEventsLogger.newLogger(application)
-
-        if (MMKVManager.instance.eventKV.decodeBool("facebook_activities")) {
-            isInitSuccess = true
-            return
-        }
-        //open_app
-        Logger.d("facebook log open app success")
-        fbLogger.logEvent("open_app")
-        MMKVManager.instance.eventKV.encode("facebook_activities", true)
-        isInitSuccess = true
-    }
-
-    override fun onLogin(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("facebook log failed , user is null")
-            return
-        }
-
-        when (SdkLoginInfo.instance.loginType) {
-            LoginType.TYPE_GUEST_LOGIN -> {
-                fbLogger.logEvent("login_success_quick")
-                Logger.d("facebook log guest login success")
-            }
-            LoginType.TYPE_FACEBOOK_LOGIN -> {
-                fbLogger.logEvent("login_success_fb")
-                Logger.d("facebook log facebook login success")
-            }
-            LoginType.TYPE_GOOGLE_LOGIN -> {
-                fbLogger.logEvent("login_success_google")
-                Logger.d("facebook log google login success")
-            }
-            LoginType.TYPE_ACCOUNT_LOGIN -> {
-                fbLogger.logEvent("login_success_account")
-                Logger.d("facebook log account login success")
-            }
-        }
-    }
-
-    override fun onRegister(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("facebook log failed , user is null")
-            return
-        }
-
-        fbLogger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION)
-        Logger.d("facebook log sign up success")
-    }
-
-    override fun onCharge(context: Context, chargeInfo: SdkChargeInfo) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("facebook log failed , user is null")
-            return
-        }
-        val params = Bundle()
-        params.putDouble("price", chargeInfo.amount.toDouble() / 100)
-        params.putString("order", chargeInfo.orderId)
-
-        if (!MMKVManager.instance.eventKV.decodeBool("facebook_first_purchase")) {
-            fbLogger.logEvent("first_purchase", params)
-            Logger.d("facebook log first charge success")
-            MMKVManager.instance.eventKV.encode("facebook_first_purchase", true)
-        }
-
-        fbLogger.logPurchase(BigDecimal.valueOf(chargeInfo.amount.toDouble() / 100), Currency.getInstance("USD"), params)
-        Logger.d("facebook log charge success")
-    }
-
-    override fun onCreate(activity: Activity) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-        AppEventsLogger.activateApp(activity.application)
-    }
-
-    override fun onResume(activity: Activity) {
-    }
-
-    override fun onPause(activity: Activity) {
-    }
-
-    override fun onSdkEvent(context: Context, sdkEvent: SdkEvent) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-        fbLogger.logEvent(sdkEvent.eventName)
-        Logger.d("facebook log sdk event ${sdkEvent.eventName} success")
-    }
-
-    override fun onExtEvent(context: Context, sdkEvent: SdkEvent) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-        if (sdkEvent.standard) {
-            val eventName = when (sdkEvent.fbAliasName) {
-                "fb_mobile_tutorial_completion" -> AppEventsConstants.EVENT_NAME_COMPLETED_TUTORIAL
-                "fb_mobile_level_achieved" -> AppEventsConstants.EVENT_NAME_ACHIEVED_LEVEL
-                "fb_mobile_spent_credits" -> AppEventsConstants.EVENT_NAME_SPENT_CREDITS
-                "fb_mobile_initiated_checkout" -> AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT
-                "fb_mobile_add_to_cart" -> AppEventsConstants.EVENT_NAME_ADDED_TO_CART
-                "fb_mobile_add_to_wishlist" -> AppEventsConstants.EVENT_NAME_ADDED_TO_WISHLIST
-                "fb_mobile_add_payment_info" -> AppEventsConstants.EVENT_NAME_ADDED_PAYMENT_INFO
-                "fb_mobile_achievement_unlocked" -> AppEventsConstants.EVENT_NAME_UNLOCKED_ACHIEVEMENT
-                "fb_mobile_search" -> AppEventsConstants.EVENT_NAME_SEARCHED
-                "fb_mobile_rate" -> AppEventsConstants.EVENT_NAME_RATED
-                else -> ""
-            }
-            fbLogger.logEvent(eventName)
-        } else {
-            fbLogger.logEvent(sdkEvent.eventName)
-        }
-        Logger.d("facebook log ext event ${sdkEvent.eventName} success")
-    }
-}
-
+//package cn.yyxx.eyuancomm.core.trace.channel
+//
+//import android.app.Activity
+//import android.app.Application
+//import android.content.Context
+//import android.os.Bundle
+//import android.text.TextUtils
+//import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+//import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
+//import cn.yyxx.eyuancomm.comm.utils.Logger
+//import cn.yyxx.eyuancomm.comm.utils.MMKVManager
+//import cn.yyxx.eyuancomm.core.entity.LoginType
+//import cn.yyxx.eyuancomm.core.entity.SdkEvent
+//import cn.yyxx.eyuancomm.core.internal.ITrace
+//import com.facebook.FacebookSdk
+//import com.facebook.LoggingBehavior
+//import com.facebook.appevents.AppEventsConstants
+//import com.facebook.appevents.AppEventsLogger
+//import java.math.BigDecimal
+//import java.util.*
+//
+///**
+// * @author #Suyghur.
+// * Created on 2021/07/06
+// */
+//class TraceFacebookImpl : ITrace {
+//
+//    private lateinit var fbLogger: AppEventsLogger
+//    private var isInitSuccess = false
+//
+//    override fun onInitialize(application: Application) {
+//
+//        FacebookSdk.setIsDebugEnabled(true)
+//        FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
+//
+//        fbLogger = AppEventsLogger.newLogger(application)
+//
+//        if (MMKVManager.instance.eventKV.decodeBool("facebook_activities")) {
+//            isInitSuccess = true
+//            return
+//        }
+//        //open_app
+//        Logger.d("facebook log open app success")
+//        fbLogger.logEvent("open_app")
+//        MMKVManager.instance.eventKV.encode("facebook_activities", true)
+//        isInitSuccess = true
+//    }
+//
+//    override fun onLogin(context: Context) {
+//        if (!isInitSuccess) {
+//            Logger.e("facebook log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("facebook log failed , user is null")
+//            return
+//        }
+//
+//        when (SdkLoginInfo.instance.loginType) {
+//            LoginType.TYPE_GUEST_LOGIN -> {
+//                fbLogger.logEvent("login_success_quick")
+//                Logger.d("facebook log guest login success")
+//            }
+//            LoginType.TYPE_FACEBOOK_LOGIN -> {
+//                fbLogger.logEvent("login_success_fb")
+//                Logger.d("facebook log facebook login success")
+//            }
+//            LoginType.TYPE_GOOGLE_LOGIN -> {
+//                fbLogger.logEvent("login_success_google")
+//                Logger.d("facebook log google login success")
+//            }
+//            LoginType.TYPE_ACCOUNT_LOGIN -> {
+//                fbLogger.logEvent("login_success_account")
+//                Logger.d("facebook log account login success")
+//            }
+//        }
+//    }
+//
+//    override fun onRegister(context: Context) {
+//        if (!isInitSuccess) {
+//            Logger.e("facebook log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("facebook log failed , user is null")
+//            return
+//        }
+//
+//        fbLogger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION)
+//        Logger.d("facebook log sign up success")
+//    }
+//
+//    override fun onCharge(context: Context, chargeInfo: SdkChargeInfo) {
+//        if (!isInitSuccess) {
+//            Logger.e("facebook log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("facebook log failed , user is null")
+//            return
+//        }
+//        val params = Bundle()
+//        params.putDouble("price", chargeInfo.amount.toDouble() / 100)
+//        params.putString("order", chargeInfo.orderId)
+//
+//        if (!MMKVManager.instance.eventKV.decodeBool("facebook_first_purchase")) {
+//            fbLogger.logEvent("first_purchase", params)
+//            Logger.d("facebook log first charge success")
+//            MMKVManager.instance.eventKV.encode("facebook_first_purchase", true)
+//        }
+//
+//        fbLogger.logPurchase(BigDecimal.valueOf(chargeInfo.amount.toDouble() / 100), Currency.getInstance("USD"), params)
+//        Logger.d("facebook log charge success")
+//    }
+//
+//    override fun onCreate(activity: Activity) {
+//        if (!isInitSuccess) {
+//            Logger.e("facebook log failed , component initialize failed")
+//            return
+//        }
+//        AppEventsLogger.activateApp(activity.application)
+//    }
+//
+//    override fun onResume(activity: Activity) {
+//    }
+//
+//    override fun onPause(activity: Activity) {
+//    }
+//
+//    override fun onSdkEvent(context: Context, sdkEvent: SdkEvent) {
+//        if (!isInitSuccess) {
+//            Logger.e("facebook log failed , component initialize failed")
+//            return
+//        }
+//        fbLogger.logEvent(sdkEvent.eventName)
+//        Logger.d("facebook log sdk event ${sdkEvent.eventName} success")
+//    }
+//
+//    override fun onExtEvent(context: Context, sdkEvent: SdkEvent) {
+//        if (!isInitSuccess) {
+//            Logger.e("facebook log failed , component initialize failed")
+//            return
+//        }
+//        if (sdkEvent.standard) {
+//            val eventName = when (sdkEvent.fbAliasName) {
+//                "fb_mobile_tutorial_completion" -> AppEventsConstants.EVENT_NAME_COMPLETED_TUTORIAL
+//                "fb_mobile_level_achieved" -> AppEventsConstants.EVENT_NAME_ACHIEVED_LEVEL
+//                "fb_mobile_spent_credits" -> AppEventsConstants.EVENT_NAME_SPENT_CREDITS
+//                "fb_mobile_initiated_checkout" -> AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT
+//                "fb_mobile_add_to_cart" -> AppEventsConstants.EVENT_NAME_ADDED_TO_CART
+//                "fb_mobile_add_to_wishlist" -> AppEventsConstants.EVENT_NAME_ADDED_TO_WISHLIST
+//                "fb_mobile_add_payment_info" -> AppEventsConstants.EVENT_NAME_ADDED_PAYMENT_INFO
+//                "fb_mobile_achievement_unlocked" -> AppEventsConstants.EVENT_NAME_UNLOCKED_ACHIEVEMENT
+//                "fb_mobile_search" -> AppEventsConstants.EVENT_NAME_SEARCHED
+//                "fb_mobile_rate" -> AppEventsConstants.EVENT_NAME_RATED
+//                else -> ""
+//            }
+//            fbLogger.logEvent(eventName)
+//        } else {
+//            fbLogger.logEvent(sdkEvent.eventName)
+//        }
+//        Logger.d("facebook log ext event ${sdkEvent.eventName} success")
+//    }
+//}
+//

+ 140 - 140
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuancomm/core/trace/channel/TraceFirebaseImpl.kt

@@ -1,140 +1,140 @@
-package cn.yyxx.eyuancomm.core.trace.channel
-
-import android.app.Activity
-import android.app.Application
-import android.content.Context
-import android.text.TextUtils
-import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
-import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVManager
-import cn.yyxx.eyuancomm.core.entity.LoginType
-import cn.yyxx.eyuancomm.core.entity.SdkEvent
-import cn.yyxx.eyuancomm.core.internal.ITrace
-import com.google.firebase.analytics.FirebaseAnalytics
-import com.google.firebase.analytics.ktx.analytics
-import com.google.firebase.analytics.ktx.logEvent
-import com.google.firebase.ktx.Firebase
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/17
- */
-class TraceFirebaseImpl : ITrace {
-
-    private var isInitSuccess = false
-
-    override fun onInitialize(application: Application) {
-        if (MMKVManager.instance.eventKV.decodeBool("firebase_activities")) {
-            isInitSuccess = true
-            return
-        }
-        Firebase.analytics.logEvent("open_app", null)
-        Logger.d("firebase log open app success")
-        MMKVManager.instance.eventKV.encode("firebase_activities", true)
-        isInitSuccess = true
-    }
-
-    override fun onLogin(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("firebase log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("firebase log failed , user is null")
-            return
-        }
-
-        when (SdkLoginInfo.instance.loginType) {
-            LoginType.TYPE_GUEST_LOGIN -> {
-                Firebase.analytics.logEvent("login_success_quick", null)
-                Logger.d("firebase log guest login success")
-            }
-            LoginType.TYPE_FACEBOOK_LOGIN -> {
-                Firebase.analytics.logEvent("login_success_fb", null)
-                Logger.d("firebase log facebook login success")
-            }
-            LoginType.TYPE_GOOGLE_LOGIN -> {
-                Firebase.analytics.logEvent("login_success_google", null)
-                Logger.d("firebase log google login success")
-            }
-            LoginType.TYPE_ACCOUNT_LOGIN -> {
-                Firebase.analytics.logEvent("login_success_account", null)
-                Logger.d("firebase log account login success")
-            }
-        }
-    }
-
-    override fun onRegister(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("firebase log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("firebase log failed , user is null")
-            return
-        }
-
-        Firebase.analytics.logEvent("sign_up", null)
-        Logger.d("firebase log sign up success")
-    }
-
-    override fun onCharge(context: Context, chargeInfo: SdkChargeInfo) {
-        if (!isInitSuccess) {
-            Logger.e("firebase log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
-            Logger.e("firebase log failed , user is null")
-            return
-        }
-
-        if (!MMKVManager.instance.eventKV.decodeBool("firebase_first_purchase")) {
-            Firebase.analytics.logEvent("first_purchase") {
-                param(FirebaseAnalytics.Param.PRICE, (chargeInfo.amount.toDouble() / 100).toString())
-                param("order_id", chargeInfo.orderId)
-            }
-            Logger.d("firebase log first charge success")
-            MMKVManager.instance.eventKV.encode("firebase_first_purchase", true)
-        }
-
-        Firebase.analytics.logEvent("ecommerce_purchase") {
-            param(FirebaseAnalytics.Param.PRICE, (chargeInfo.amount.toDouble() / 100).toString())
-            param("order_id", chargeInfo.orderId)
-        }
-        Logger.d("firebase log charge success")
-
-    }
-
-    override fun onCreate(activity: Activity) {
-    }
-
-    override fun onResume(activity: Activity) {
-    }
-
-    override fun onPause(activity: Activity) {
-    }
-
-
-    override fun onSdkEvent(context: Context, sdkEvent: SdkEvent) {
-        if (!isInitSuccess) {
-            Logger.e("firebase log failed , component initialize failed")
-            return
-        }
-        Firebase.analytics.logEvent(sdkEvent.eventName, null)
-        Logger.d("firebase log sdk event ${sdkEvent.eventName} success")
-    }
-
-    override fun onExtEvent(context: Context, sdkEvent: SdkEvent) {
-        if (!isInitSuccess) {
-            Logger.e("firebase log failed , component initialize failed")
-            return
-        }
-        Firebase.analytics.logEvent(sdkEvent.eventName, null)
-        Logger.d("firebase log ext event ${sdkEvent.eventName} success")
-    }
-
-}
+//package cn.yyxx.eyuancomm.core.trace.channel
+//
+//import android.app.Activity
+//import android.app.Application
+//import android.content.Context
+//import android.text.TextUtils
+//import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+//import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
+//import cn.yyxx.eyuancomm.comm.utils.Logger
+//import cn.yyxx.eyuancomm.comm.utils.MMKVManager
+//import cn.yyxx.eyuancomm.core.entity.LoginType
+//import cn.yyxx.eyuancomm.core.entity.SdkEvent
+//import cn.yyxx.eyuancomm.core.internal.ITrace
+//import com.google.firebase.analytics.FirebaseAnalytics
+//import com.google.firebase.analytics.ktx.analytics
+//import com.google.firebase.analytics.ktx.logEvent
+//import com.google.firebase.ktx.Firebase
+//
+///**
+// * @author #Suyghur.
+// * Created on 2021/06/17
+// */
+//class TraceFirebaseImpl : ITrace {
+//
+//    private var isInitSuccess = false
+//
+//    override fun onInitialize(application: Application) {
+//        if (MMKVManager.instance.eventKV.decodeBool("firebase_activities")) {
+//            isInitSuccess = true
+//            return
+//        }
+//        Firebase.analytics.logEvent("open_app", null)
+//        Logger.d("firebase log open app success")
+//        MMKVManager.instance.eventKV.encode("firebase_activities", true)
+//        isInitSuccess = true
+//    }
+//
+//    override fun onLogin(context: Context) {
+//        if (!isInitSuccess) {
+//            Logger.e("firebase log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("firebase log failed , user is null")
+//            return
+//        }
+//
+//        when (SdkLoginInfo.instance.loginType) {
+//            LoginType.TYPE_GUEST_LOGIN -> {
+//                Firebase.analytics.logEvent("login_success_quick", null)
+//                Logger.d("firebase log guest login success")
+//            }
+//            LoginType.TYPE_FACEBOOK_LOGIN -> {
+//                Firebase.analytics.logEvent("login_success_fb", null)
+//                Logger.d("firebase log facebook login success")
+//            }
+//            LoginType.TYPE_GOOGLE_LOGIN -> {
+//                Firebase.analytics.logEvent("login_success_google", null)
+//                Logger.d("firebase log google login success")
+//            }
+//            LoginType.TYPE_ACCOUNT_LOGIN -> {
+//                Firebase.analytics.logEvent("login_success_account", null)
+//                Logger.d("firebase log account login success")
+//            }
+//        }
+//    }
+//
+//    override fun onRegister(context: Context) {
+//        if (!isInitSuccess) {
+//            Logger.e("firebase log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("firebase log failed , user is null")
+//            return
+//        }
+//
+//        Firebase.analytics.logEvent("sign_up", null)
+//        Logger.d("firebase log sign up success")
+//    }
+//
+//    override fun onCharge(context: Context, chargeInfo: SdkChargeInfo) {
+//        if (!isInitSuccess) {
+//            Logger.e("firebase log failed , component initialize failed")
+//            return
+//        }
+//
+//        if (TextUtils.isEmpty(SdkLoginInfo.instance.userId)) {
+//            Logger.e("firebase log failed , user is null")
+//            return
+//        }
+//
+//        if (!MMKVManager.instance.eventKV.decodeBool("firebase_first_purchase")) {
+//            Firebase.analytics.logEvent("first_purchase") {
+//                param(FirebaseAnalytics.Param.PRICE, (chargeInfo.amount.toDouble() / 100).toString())
+//                param("order_id", chargeInfo.orderId)
+//            }
+//            Logger.d("firebase log first charge success")
+//            MMKVManager.instance.eventKV.encode("firebase_first_purchase", true)
+//        }
+//
+//        Firebase.analytics.logEvent("ecommerce_purchase") {
+//            param(FirebaseAnalytics.Param.PRICE, (chargeInfo.amount.toDouble() / 100).toString())
+//            param("order_id", chargeInfo.orderId)
+//        }
+//        Logger.d("firebase log charge success")
+//
+//    }
+//
+//    override fun onCreate(activity: Activity) {
+//    }
+//
+//    override fun onResume(activity: Activity) {
+//    }
+//
+//    override fun onPause(activity: Activity) {
+//    }
+//
+//
+//    override fun onSdkEvent(context: Context, sdkEvent: SdkEvent) {
+//        if (!isInitSuccess) {
+//            Logger.e("firebase log failed , component initialize failed")
+//            return
+//        }
+//        Firebase.analytics.logEvent(sdkEvent.eventName, null)
+//        Logger.d("firebase log sdk event ${sdkEvent.eventName} success")
+//    }
+//
+//    override fun onExtEvent(context: Context, sdkEvent: SdkEvent) {
+//        if (!isInitSuccess) {
+//            Logger.e("firebase log failed , component initialize failed")
+//            return
+//        }
+//        Firebase.analytics.logEvent(sdkEvent.eventName, null)
+//        Logger.d("firebase log ext event ${sdkEvent.eventName} success")
+//    }
+//
+//}

BIN
module_eyuan/library_eyuan/src/main/res/drawable-xhdpi/yyxx_float_logo_img.png


BIN
module_eyuan/library_eyuan/src/main/res/drawable-xhdpi/yyxx_float_logo_left_img.png


BIN
module_eyuan/library_eyuan/src/main/res/drawable-xhdpi/yyxx_float_logo_right_img.png


+ 13 - 13
settings.gradle

@@ -7,25 +7,25 @@ include ':library_impl'
 // 渠道库
 include ':channel_registry:channel_oppo'
 include ':channel_registry:channel_vivo'
-//include ':channel_registry:channel_huawei'
-include ':channel_registry:channel_huawei2'
+include ':channel_registry:channel_huawei'
+//include ':channel_registry:channel_huawei2'
 
 // 组件
-//include ':component:google-auth:play-services-auth'
-//include ':component:google-auth:play-services-auth-api-phone'
-//include ':component:google-auth:play-services-auth-base'
-//include ':component:google-auth:play-services-base'
-//include ':component:google-auth:play-services-basement'
-//include ':component:google-auth:play-services-tasks'
-//
-//include ':component:facebook-auth:facebook-comm'
-//include ':component:facebook-auth:facebook-core'
-//include ':component:facebook-auth:facebook-login'
+include ':component:google-auth:play-services-auth'
+include ':component:google-auth:play-services-auth-api-phone'
+include ':component:google-auth:play-services-auth-base'
+include ':component:google-auth:play-services-base'
+include ':component:google-auth:play-services-basement'
+include ':component:google-auth:play-services-tasks'
+
+include ':component:facebook-auth:facebook-comm'
+include ':component:facebook-auth:facebook-core'
+include ':component:facebook-auth:facebook-login'
 
 
 // 自有sdk
 include ':module_eyuan:library_eyuan'
 include ':module_eyuan:library_hk_language'
-include ':module_eyuan:library_vn_language'
+//include ':module_eyuan:library_vn_language'