update: 新增打点和 Firebase 回调逻辑
							parent
							
								
									19be8b5d48
								
							
						
					
					
						commit
						1f71522fa6
					
				|  | @ -265,6 +265,9 @@ namespace Guru | |||
|         #endregion | ||||
| 
 | ||||
|         #region SDK 打点 | ||||
| 
 | ||||
|         public const string EventUnitySDK = "guru_unity_sdk"; | ||||
|          | ||||
|          | ||||
|         /// <summary> | ||||
|         /// Log SDK boost time | ||||
|  | @ -272,16 +275,26 @@ namespace Guru | |||
|         /// <param name="time"></param> | ||||
|         private static void LogSDKInitTime(double time) | ||||
|         { | ||||
|             Analytics.Track("sdk_init_time", new Dictionary<string, dynamic>() | ||||
|             Analytics.Track(EventUnitySDK, new Dictionary<string, dynamic>() | ||||
|             { | ||||
|                 {"time", time.ToString("F6")}, | ||||
|                 {"device_id", DeviceId}, | ||||
|                 { "init_time", time.ToString("F6") }, | ||||
|                 { Consts.PropertyDeviceID, DeviceId }, | ||||
|             }, new Analytics.EventSetting() | ||||
|             { | ||||
|                 EnableFirebaseAnalytics = true, | ||||
|             }); | ||||
|         } | ||||
| 
 | ||||
|         private static void LogFirebaseDeps(bool success) | ||||
|         { | ||||
|             Analytics.Track(EventUnitySDK, new Dictionary<string, dynamic>() | ||||
|             { | ||||
|                 {"firebase_deps", success? "true" : "false"}, | ||||
|             }, new Analytics.EventSetting() | ||||
|             { | ||||
|                 EnableFirebaseAnalytics = true, | ||||
|             }); | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         #endregion | ||||
|     } | ||||
|  |  | |||
|  | @ -158,6 +158,17 @@ namespace Guru | |||
| 
 | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|             public static class SDK | ||||
|             { | ||||
|                 internal static Action<bool> _onFirebaseReady; | ||||
|                 public static event Action<bool> OnFirebaseReady | ||||
|                 { | ||||
|                     add => _onFirebaseReady += value; | ||||
|                     remove => _onFirebaseReady -= value; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -127,13 +127,15 @@ namespace Guru | |||
|             //---- Init All tools ---- | ||||
|             LogI($"#2 --- InitFirebase ---"); | ||||
|             //---------- Start Firebase ------------ | ||||
|             FirebaseUtil.InitFirebase(OnFirebaseReady); // 确保所有的逻辑提前被调用到 | ||||
|             FirebaseUtil.onInitComplete += OnFirebaseReady; | ||||
|             FirebaseUtil.InitFirebase(null); // 确保所有的逻辑提前被调用到 | ||||
|              | ||||
|             LogI($"#2.1 --- InitFacebook ---"); | ||||
|             //---------- Start Facebook ------------ | ||||
|             FBService.Instance.StartService(); | ||||
|              | ||||
|             LogI($"#2.2 --- Call SDK init complete  ->  callback: { (_onCompleteCallback == null ? "Null" : _onCompleteCallback.ToString()) } ---"); | ||||
|             IsInitialSuccess = true; | ||||
|             _onCompleteCallback?.Invoke(true); | ||||
|         } | ||||
|          | ||||
|  | @ -141,13 +143,13 @@ namespace Guru | |||
|         /// <summary> | ||||
|         /// 开始各种组件初始化 | ||||
|         /// </summary> | ||||
|         private void OnFirebaseReady() | ||||
|         private void OnFirebaseReady(bool success) | ||||
|         { | ||||
|             LogI($"#3 --- On FirebaseReady ---"); | ||||
|             IsInitialSuccess = true; | ||||
|              | ||||
|             if(!string.IsNullOrEmpty(IPMConfig.IPM_UID)) SetUID(IPMConfig.IPM_UID); ; | ||||
|              | ||||
|             FirebaseUtil.onInitComplete -= OnFirebaseReady; | ||||
|             LogI($"#3 --- On FirebaseDeps:{success} ---"); | ||||
|             Callbacks.SDK._onFirebaseReady?.Invoke(success); | ||||
|             LogFirebaseDeps(success); | ||||
| 
 | ||||
|             LogI($"#3.5 --- Call InitRemoteConfig ---"); | ||||
|             // 开始Remote Manager初始化  | ||||
|             RemoteConfigManager.Init(BuildDefaultRemoteData(_initConfig.DefaultRemoteData)); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue