update: 调整初始化标志位的顺序, 修复Driver 开始上报是尚未初始化的 BUG
Signed-off-by: huyufei <yufei.hu@castbox.fm>
							parent
							
								
									94def4fc3b
								
							
						
					
					
						commit
						2760cb5fb2
					
				| 
						 | 
					@ -140,11 +140,12 @@ namespace Guru
 | 
				
			||||||
            _experimentGroupId = groupId;
 | 
					            _experimentGroupId = groupId;
 | 
				
			||||||
            EnableErrorLog = enabelErrorLog;
 | 
					            EnableErrorLog = enabelErrorLog;
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 | 
					            _lastReportTime = new DateTime(1970, 1, 1); // 初始化上报时间
 | 
				
			||||||
 | 
					            _isReady = true; // 初始化成功标志位
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            // 初始化参数
 | 
					            // 初始化参数
 | 
				
			||||||
            Agent.Init(appId, deviceInfo, baseUrl, uploadIpAddress, onInitComplete, isDebug);
 | 
					            Agent.Init(appId, deviceInfo, baseUrl, uploadIpAddress, onInitComplete, isDebug);
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            _lastReportTime = new DateTime(1970, 1, 1);
 | 
					 | 
				
			||||||
            _isReady = true;
 | 
					 | 
				
			||||||
            Debug.Log($"{Tag} --- Guru Analytics [{Version}] initialized.");
 | 
					            Debug.Log($"{Tag} --- Guru Analytics [{Version}] initialized.");
 | 
				
			||||||
            Debug.Log($"{Tag} --- GroupId: {groupId}");
 | 
					            Debug.Log($"{Tag} --- GroupId: {groupId}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -182,13 +183,13 @@ namespace Guru
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (!_isReady)
 | 
					            if (!_isReady)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Debug.LogWarning($"{Tag} --- is Not Ready SetUserProperty: [{key}, {value}] failed");
 | 
					                Debug.LogWarning($"{Tag}[GA] --- is Not Ready SetUserProperty: [{key}, {value}] failed");
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)) return;
 | 
					            if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)) return;
 | 
				
			||||||
            // CacheUserProperty(key, value); // 添加用户属性
 | 
					            // CacheUserProperty(key, value); // 添加用户属性
 | 
				
			||||||
            // ReSharper disable once Unity.PerformanceCriticalCodeInvocation
 | 
					            // ReSharper disable once Unity.PerformanceCriticalCodeInvocation
 | 
				
			||||||
            Debug.Log($"{Tag} --- SetUserProperty: [{key}, {value}]");
 | 
					            Debug.Log($"{Tag}[GA]  --- SetUserProperty: [{key}, {value}]");
 | 
				
			||||||
            Agent.SetUserProperty(key, value);
 | 
					            Agent.SetUserProperty(key, value);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -133,6 +133,7 @@ namespace Guru
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (!string.IsNullOrEmpty(IPMConfig.IPM_UID) && !_guruEventDriver.IsReady)
 | 
								if (!string.IsNullOrEmpty(IPMConfig.IPM_UID) && !_guruEventDriver.IsReady)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									Debug.Log($"[ANU][GA] --- ShouldFlushGuruEvents -> _guruEventDriver.TriggerFlush");
 | 
				
			||||||
				_guruEventDriver.TriggerFlush();
 | 
									_guruEventDriver.TriggerFlush();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,13 +115,13 @@ namespace Guru
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            while(_eventBuffer.Pop(out var trackingEvent))
 | 
					            while(_eventBuffer.Pop(out var trackingEvent))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Debug.Log($"[ANU] --- GuruAnalytics: FlushAll Events: {trackingEvent.eventName}");
 | 
					                Debug.Log($"[ANU][GA] --- FlushAll Events: {trackingEvent.eventName}");
 | 
				
			||||||
                FlushTrackingEvent(trackingEvent);
 | 
					                FlushTrackingEvent(trackingEvent);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            foreach (var key in _userPropertyMap.Keys)
 | 
					            foreach (var key in _userPropertyMap.Keys)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Debug.Log($"[ANU] --- GuruAnalytics: FlushAll Properties: {key}:{ _userPropertyMap[key]}");
 | 
					                Debug.Log($"[ANU][GA] --- FlushAll Properties: {key}:{ _userPropertyMap[key]}");
 | 
				
			||||||
                SetUserProperty(key, _userPropertyMap[key]);    
 | 
					                SetUserProperty(key, _userPropertyMap[key]);    
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            _userPropertyMap.Clear();
 | 
					            _userPropertyMap.Clear();
 | 
				
			||||||
| 
						 | 
					@ -129,7 +129,7 @@ namespace Guru
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            foreach (var propertyAction in _predefinedPropertyDelayedActions)
 | 
					            foreach (var propertyAction in _predefinedPropertyDelayedActions)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Debug.Log($"[ANU] --- GuruAnalytics: FlushAll predefined Properties: {propertyAction.key}:{ propertyAction}");
 | 
					                Debug.Log($"[ANU][GA] --- FlushAll predefined Properties: {propertyAction.key}:{ propertyAction}");
 | 
				
			||||||
                propertyAction.Execute();    
 | 
					                propertyAction.Execute();    
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            _predefinedPropertyDelayedActions.Clear();
 | 
					            _predefinedPropertyDelayedActions.Clear();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue