Browse Source

v1.0.0开发:媒体打点开发

#Suyghur 3 years ago
parent
commit
26fd11ed26

+ 7 - 0
library_base/src/main/java/cn/yyxx/eyuangame/base/EYuanGame.kt

@@ -394,7 +394,14 @@ class EYuanGame private constructor() {
     }
 
     fun linkingEvent(activity: Activity, params: JSONObject) {
+        if (checkSdkBridgeNull(Function.GET_CURRENT_USER_ID, null)) {
+            return
+        }
 
+        if (checkSdkNonInit(Function.GET_CURRENT_USER_ID, null)) {
+            return
+        }
+        SdkBridgeManager.call(Function.ON_DESTROY, arrayOf(Activity::class.java), arrayOf(activity))
     }
 
 

+ 3 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkBridgeImpl.kt

@@ -20,6 +20,7 @@ import cn.yyxx.eyuangame.core.impl.iab.ChargeImpl
 import cn.yyxx.eyuangame.core.impl.login.LoginActivity
 import cn.yyxx.eyuangame.core.internal.IImplCallback
 import cn.yyxx.eyuangame.core.internal.IRequestCallback
+import cn.yyxx.eyuangame.core.linking.Linking
 import cn.yyxx.eyuangame.core.network.Host
 import cn.yyxx.eyuangame.core.network.SdkRequest
 import cn.yyxx.eyuangame.core.ui.dialog.ScaleLoadingDialog
@@ -32,7 +33,6 @@ import cn.yyxx.support.device.DeviceInfoUtils
 import cn.yyxx.support.gaid.GAIDUtils
 import cn.yyxx.support.hawkeye.LogUtils
 import cn.yyxx.support.hawkeye.OwnDebugUtils
-import cn.yyxx.support.hawkeye.ToastUtils
 import java.util.concurrent.atomic.AtomicInteger
 
 
@@ -90,6 +90,7 @@ class SdkBridgeImpl(context: Context) {
     fun initApplication(application: Application) {
         Logger.i("EYuanGameSdk initApplication ...")
         MMKVUtils.instance.init(application)
+        Linking.instance.attach(application)
     }
 
     fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback, initCallback: IInitialize) {
@@ -355,6 +356,7 @@ class SdkBridgeImpl(context: Context) {
     fun onDestroy(activity: Activity) {
         Logger.i("EYuanGameSdk onDestroy ...")
         FloatCenterServiceManager.instance.release()
+        Linking.instance.detach()
     }
 
     fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, intent: Intent) {

+ 3 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/internal/IEventObserver.kt

@@ -14,6 +14,8 @@ interface IEventObserver {
 
     fun onRegister(context: Context)
 
-    fun onBillingFinish(context: Context)
+    fun onCharge(context: Context)
+
+    fun onEvent(context: Context)
 
 }

+ 25 - 9
library_core/src/main/java/cn/yyxx/eyuangame/core/linking/Linking.kt

@@ -28,24 +28,40 @@ class Linking private constructor() {
     }
 
 
-    fun login() {
-
+    fun login(context: Context) {
+        for (ob in observers) {
+            ob.onLogin(context)
+        }
     }
 
-    fun register() {
-
+    fun register(context: Context) {
+        for (ob in observers) {
+            ob.onRegister(context)
+        }
     }
 
-    fun charge() {
-
+    fun charge(context: Context) {
+        for (ob in observers) {
+            ob.onCharge(context)
+        }
     }
 
-    fun roleCreate() {
-
+    fun roleCreate(context: Context) {
+        for (ob in observers) {
+            ob.onCharge(context)
+        }
     }
 
-    fun roleLauncher(){
+    fun roleLauncher(context: Context) {
+        for (ob in observers) {
+            ob.onCharge(context)
+        }
+    }
 
+    fun event(context: Context) {
+        for (ob in observers) {
+            ob.onEvent(context)
+        }
     }
 
 

+ 5 - 5
library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingAdjustImpl.kt

@@ -10,18 +10,18 @@ import cn.yyxx.eyuangame.core.internal.IEventObserver
 class LinkingAdjustImpl : IEventObserver {
 
     override fun onInitialize(context: Context) {
-        TODO("Not yet implemented")
     }
 
     override fun onLogin(context: Context) {
-        TODO("Not yet implemented")
     }
 
     override fun onRegister(context: Context) {
-        TODO("Not yet implemented")
     }
 
-    override fun onBillingFinish(context: Context) {
-        TODO("Not yet implemented")
+    override fun onCharge(context: Context) {
+    }
+
+    override fun onEvent(context: Context) {
+
     }
 }

+ 6 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingFacebookImpl.kt

@@ -8,6 +8,7 @@ import cn.yyxx.eyuangame.core.internal.IEventObserver
  * Created on 2021/07/06
  */
 class LinkingFacebookImpl : IEventObserver {
+
     override fun onInitialize(context: Context) {
     }
 
@@ -17,6 +18,10 @@ class LinkingFacebookImpl : IEventObserver {
     override fun onRegister(context: Context) {
     }
 
-    override fun onBillingFinish(context: Context) {
+    override fun onCharge(context: Context) {
+    }
+
+    override fun onEvent(context: Context) {
+
     }
 }

+ 5 - 5
library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingFirebaseImpl.kt

@@ -8,19 +8,19 @@ import cn.yyxx.eyuangame.core.internal.IEventObserver
  * Created on 2021/06/17
  */
 class LinkingFirebaseImpl : IEventObserver {
+
     override fun onInitialize(context: Context) {
-        TODO("Not yet implemented")
     }
 
     override fun onLogin(context: Context) {
-        TODO("Not yet implemented")
     }
 
     override fun onRegister(context: Context) {
-        TODO("Not yet implemented")
     }
 
-    override fun onBillingFinish(context: Context) {
-        TODO("Not yet implemented")
+    override fun onCharge(context: Context) {
+    }
+
+    override fun onEvent(context: Context) {
     }
 }