update: 优化 Consent 及 ATT 上报逻辑
							parent
							
								
									c50c5d170e
								
							
						
					
					
						commit
						c7e255c95d
					
				|  | @ -137,15 +137,18 @@ namespace Guru | |||
|         private static void CheckAttStatus(bool autoReCall = false) | ||||
|         { | ||||
|             _autoReCallAtt = autoReCall; | ||||
|             ATTManager.CheckStatus(ReportAttStatus); | ||||
|              | ||||
|             // Delay 1s to get the user choice | ||||
|             Delay(1, () => ATTManager.CheckStatus(ReportAttStatus)); | ||||
|         } | ||||
| 
 | ||||
|         private static void ReportAttStatus(string status) | ||||
|         { | ||||
|             LogI($"{Tag} --- Get Att status:{status}  att Type:{_attType}  recall:{_autoReCallAtt}"); | ||||
|             SetUserProperty(Analytics.ParameterATTStatus, status); // 当前的状态 | ||||
|             if (!string.IsNullOrEmpty(_initialAttStatus)  | ||||
|                 && _initialAttStatus != status | ||||
|              | ||||
|             if (!string.IsNullOrEmpty(status)  | ||||
|                 && status != _initialAttStatus  | ||||
|                 && status !=  ATTManager.ATT_STATUS_NOT_DETERMINED) | ||||
|             { | ||||
|                 // 上报点位: | ||||
|  |  | |||
|  | @ -262,6 +262,27 @@ namespace Guru | |||
|         } | ||||
|          | ||||
|          | ||||
|         #endregion | ||||
| 
 | ||||
|         #region SDK 打点 | ||||
|          | ||||
|         /// <summary> | ||||
|         /// Log SDK boost time | ||||
|         /// </summary> | ||||
|         /// <param name="time"></param> | ||||
|         private static void LogSDKInitTime(double time) | ||||
|         { | ||||
|             Analytics.Track("sdk_init_time", new Dictionary<string, dynamic>() | ||||
|             { | ||||
|                 {"time", time.ToString("F6")}, | ||||
|                 {"device_id", DeviceId}, | ||||
|             }, new Analytics.EventSetting() | ||||
|             { | ||||
|                 EnableFirebaseAnalytics = true, | ||||
|             }); | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         #endregion | ||||
|     } | ||||
| } | ||||
|  | @ -37,9 +37,7 @@ namespace Guru | |||
|         internal static GuruSDKInitConfig InitConfig => Instance._initConfig; | ||||
|         internal static GuruSDKModel Model => GuruSDKModel.Instance; | ||||
|         private static GuruServicesConfig _appServicesConfig; | ||||
| 
 | ||||
|         private static GuruSettings _guruSettings; | ||||
| 
 | ||||
|         private static GuruSettings GuruSettings | ||||
|         { | ||||
|             get | ||||
|  | @ -50,6 +48,9 @@ namespace Guru | |||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         private static DateTime _initTime; | ||||
| 
 | ||||
| 
 | ||||
|         private static bool _isDebugEnabled = false; | ||||
|         /// <summary> | ||||
|         /// Debug Mode | ||||
|  | @ -102,6 +103,7 @@ namespace Guru | |||
|          | ||||
|         public static void Init(GuruSDKInitConfig config, Action<bool> onComplete) | ||||
|         { | ||||
|             _initTime = DateTime.Now.ToUniversalTime(); | ||||
|             LogI($"---- Guru SDK init ----\n{config.ToString()}"); | ||||
|             Instance.StartWithConfig(config, onComplete); | ||||
|         } | ||||
|  | @ -154,6 +156,9 @@ namespace Guru | |||
|             // 根据上次的云控配置来初始化参数 | ||||
|             SetupServicesConfig(); | ||||
|              | ||||
|             var sp = DateTime.Now.ToUniversalTime() - _initTime; | ||||
|             LogSDKInitTime(sp.TotalSeconds); | ||||
|              | ||||
|             _onCompleteCallback?.Invoke(true); | ||||
|         } | ||||
|          | ||||
|  | @ -304,7 +309,11 @@ namespace Guru | |||
|             SetUserBPlay(bplay); | ||||
|         } | ||||
| 
 | ||||
|         public static string UID => _model?.UserId ?? ""; | ||||
|         public static string UID => _model?.UserId ?? IPMConfig.IPM_UID; | ||||
| 
 | ||||
|         public static string DeviceId => IPMConfig.IPM_DEVICE_ID ?? "";  // TODO: change it to _model member later. | ||||
| 
 | ||||
|         public static string PushToken => IPMConfig.IPM_PUSH_TOKEN ?? ""; // TODO: change it to _model member later. | ||||
| 
 | ||||
|         public static string SupportEmail => GuruSettings.SupportEmail ?? ""; | ||||
| 
 | ||||
|  | @ -449,9 +458,9 @@ namespace Guru | |||
|         /// </summary> | ||||
|         /// <param name="seconds"></param> | ||||
|         /// <param name="callback"></param> | ||||
|         public static void Delay(float seconds, Action callback) | ||||
|         public static Coroutine Delay(float seconds, Action callback) | ||||
|         { | ||||
|             DoCoroutine(Instance.OnDelayCall(seconds, callback)); | ||||
|             return DoCoroutine(Instance.OnDelayCall(seconds, callback)); | ||||
|         } | ||||
| 
 | ||||
|         private IEnumerator OnDelayCall(float delay, Action callback) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue