Merge tag '1.0.13' into dev
Signed-off-by: huyufei <yufei.hu@castbox.fm> # Conflicts: # Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.csmain
						commit
						9024b8171c
					
				
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -1,5 +1,5 @@ | ||||||
| fileFormatVersion: 2 | fileFormatVersion: 2 | ||||||
| guid: 07cf2335bd298401b8015718fca55265 | guid: 32eda01e213614348899eefe856392d3 | ||||||
| PluginImporter: | PluginImporter: | ||||||
|   externalObjects: {} |   externalObjects: {} | ||||||
|   serializedVersion: 2 |   serializedVersion: 2 | ||||||
										
											Binary file not shown.
										
									
								
							|  | @ -1,3 +0,0 @@ | ||||||
| fileFormatVersion: 2 |  | ||||||
| guid: caf6ff09835a4a75bff1b4b068f664ef |  | ||||||
| timeCreated: 1717117895 |  | ||||||
										
											Binary file not shown.
										
									
								
							|  | @ -0,0 +1,32 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 66c5f430ab9654ef4a2376e71aa04bca | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Android: Android | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -7,15 +7,29 @@ GuruAnalyticsLib 的 Unity 插件库 | ||||||
|   - 插件库内的 .aar 通过 [guru_analytics](https://github.com/castbox/guru_analytics) 项目直接构建 ( 命令 `gradle publishToMavenLocal` ) |   - 插件库内的 .aar 通过 [guru_analytics](https://github.com/castbox/guru_analytics) 项目直接构建 ( 命令 `gradle publishToMavenLocal` ) | ||||||
|   - 构建后请改名为 `guru-analytics-{version}.aar` |   - 构建后请改名为 `guru-analytics-{version}.aar` | ||||||
|   - 请将 .aar 文件放置于 `./Runtime/GuruAnalytics/Plugins/Android` 目录下  |   - 请将 .aar 文件放置于 `./Runtime/GuruAnalytics/Plugins/Android` 目录下  | ||||||
| - **iOS** |   - **iOS** | ||||||
|   - 插件库内的文件 通过 [GuruAnalytics_iOS](https://github.com/castbox/GuruAnalytics_iOS) 项目 |     - 插件库内的文件 通过 [GuruAnalytics_iOS](https://github.com/castbox/GuruAnalytics_iOS) 项目 | ||||||
|   - (1) 请将 repo 内的两个文件夹 `Assets` 和 `Classses` 拷贝至 `./Runtime/GuruAnalytics/Plugins/iOS/GuruAnalytics` 目录下: |     - (1) 请将 repo 内的两个文件夹 `Assets` 和 `Classses` 拷贝至 `./Runtime/GuruAnalytics/Plugins/iOS/GuruAnalytics` 目录下: | ||||||
|   - (2) 请将部署到 Unity 内所有的 `.swift` 文件的 meta 属性内, 取消 iOS 文件属性. (因为打包时会按照 POD 导入) |     - (2) 请将部署到 Unity 内所有的 `.swift` 文件的 meta 属性内, 取消 iOS 文件属性. (因为打包时会按照 POD 导入) | ||||||
|   - 注意及时更新 `GuruAnalyticsLib.podspec`文件内的更新内容 |     - 注意及时更新 `GuruAnalyticsLib.podspec`文件内的更新内容 | ||||||
|  |         ```ruby | ||||||
|  |         # 将 source 内的 git 属性删除, 只保留 tag 属性 | ||||||
|  |         # s.source    = { :git => 'git@github.com:castbox/GuruAnalytics_iOS.git', :tag => s.version.to_s } | ||||||
|  |         s.source    = { :tag => s.version.to_s } | ||||||
|  |         ``` | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
| ## Change Logs | ## Change Logs | ||||||
| 
 | 
 | ||||||
|  | ### 1.12.0 | ||||||
|  | - Android 端对齐 `1.1.1` | ||||||
|  |   > Hash: bdb41ae118dcf438e8efe4f27d0ec856bc3147b0 | ||||||
|  | - iOS 端对齐 `0.3.6` | ||||||
|  |   > Hash: 0cd5ce7aa64e12caa7413c938a3164687b973843 | ||||||
|  | - Pod 库改为 本地文件引用 (配合外部发行项目) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ### 1.11.0 | ### 1.11.0 | ||||||
| - Android 端对齐 `1.0.3` | - Android 端对齐 `1.0.3` | ||||||
|   > Hash: 1978686dbcba38b7b0421d8b6b2bef111356366b |   > Hash: 1978686dbcba38b7b0421d8b6b2bef111356366b | ||||||
|  |  | ||||||
|  | @ -14,10 +14,11 @@ namespace Guru | ||||||
|     public class GuruAnalytics |     public class GuruAnalytics | ||||||
|     { |     { | ||||||
|         // Plugin Version |         // Plugin Version | ||||||
|         public const string Version = "1.11.0"; |         public const string Version = "1.10.5"; | ||||||
|          |          | ||||||
|         public static readonly string Tag = "[ANU]"; |         public static readonly string Tag = "[ANU]"; | ||||||
|         private static readonly string ActionName = "logger_error"; |         private static readonly string ActionName = "logger_error"; | ||||||
|  |         internal const int EventPriorityDefault = 10; | ||||||
|          |          | ||||||
|         private static IAnalyticsAgent _agent; |         private static IAnalyticsAgent _agent; | ||||||
|          |          | ||||||
|  | @ -200,7 +201,8 @@ namespace Guru | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         /// <param name="eventName">事件名称</param> |         /// <param name="eventName">事件名称</param> | ||||||
|         /// <param name="data">INT类型的值</param> |         /// <param name="data">INT类型的值</param> | ||||||
|         public static void LogEvent(string eventName, Dictionary<string, dynamic> data = null) |         /// <param name="priority"></param> | ||||||
|  |         public static void LogEvent(string eventName, Dictionary<string, dynamic> data = null, int priority = -1) | ||||||
|         { |         { | ||||||
|             if(_autoSyncProperties) |             if(_autoSyncProperties) | ||||||
|                 UpdateAllUserProperties(); // 每次打点更新用户属性 |                 UpdateAllUserProperties(); // 每次打点更新用户属性 | ||||||
|  | @ -210,8 +212,9 @@ namespace Guru | ||||||
|             { |             { | ||||||
|                 raw = BuildParamsJson(data); |                 raw = BuildParamsJson(data); | ||||||
|             } |             } | ||||||
|             Debug.Log($"{Tag} event:{eventName} | raw: {raw}"); |             if (priority < 0) priority = EventPriorityDefault; | ||||||
|             Agent?.LogEvent(eventName, raw); |             Debug.Log($"{Tag} event:{eventName} | raw: {raw} | priority: {priority}"); | ||||||
|  |             Agent?.LogEvent(eventName, raw, priority); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private static string BuildParamsString(Dictionary<string, dynamic> data) |         private static string BuildParamsString(Dictionary<string, dynamic> data) | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ namespace Guru | ||||||
|         void SetUid(string uid); |         void SetUid(string uid); | ||||||
|         bool IsDebug { get; } |         bool IsDebug { get; } | ||||||
|         bool EnableErrorLog { get; set; } |         bool EnableErrorLog { get; set; } | ||||||
|         void LogEvent(string eventName, string parameters); |         void LogEvent(string eventName, string parameters, int priority = -1); | ||||||
|         void ReportEventSuccessRate(); // 上报任务成功率 |         void ReportEventSuccessRate(); // 上报任务成功率 | ||||||
|         void SetTch02Value(double value); // 设置太极02数值 |         void SetTch02Value(double value); // 设置太极02数值 | ||||||
|         void InitCallback(string objName, string method); // 设置回调对象参数 |         void InitCallback(string objName, string method); // 设置回调对象参数 | ||||||
|  |  | ||||||
|  | @ -124,7 +124,10 @@ namespace Guru | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public bool IsDebug => CallStatic<bool>("isDebug"); |         public bool IsDebug => CallStatic<bool>("isDebug"); | ||||||
|         public void LogEvent(string eventName, string parameters) => CallStatic("logEvent", eventName, parameters); |         public void LogEvent(string eventName, string parameters, int priority = -1) | ||||||
|  |         {  | ||||||
|  |             CallStatic("logEvent", eventName, parameters, priority); | ||||||
|  |         } | ||||||
|         public void ReportEventSuccessRate() => CallStatic("reportEventRate"); |         public void ReportEventSuccessRate() => CallStatic("reportEventRate"); | ||||||
|         public void SetTch02Value(double value) => CallStatic("setTch02Value", value); |         public void SetTch02Value(double value) => CallStatic("setTch02Value", value); | ||||||
|         public void InitCallback(string objName, string method) => CallStatic("initCallback", objName, method); |         public void InitCallback(string objName, string method) => CallStatic("initCallback", objName, method); | ||||||
|  |  | ||||||
|  | @ -122,7 +122,7 @@ namespace Guru | ||||||
| 
 | 
 | ||||||
|         public bool IsDebug => _isDebug; |         public bool IsDebug => _isDebug; | ||||||
| 
 | 
 | ||||||
|         public void LogEvent(string eventName, string data) |         public void LogEvent(string eventName, string data, int priority = -1) | ||||||
|         { |         { | ||||||
| #if UNITY_IOS | #if UNITY_IOS | ||||||
|             unityLogEvent(eventName, data); |             unityLogEvent(eventName, data); | ||||||
|  |  | ||||||
|  | @ -87,7 +87,7 @@ namespace Guru | ||||||
|         public bool IsDebug => _isDebug; |         public bool IsDebug => _isDebug; | ||||||
|          |          | ||||||
| 
 | 
 | ||||||
|         public void LogEvent(string eventName, string parameters) |         public void LogEvent(string eventName, string parameters, int priority = -1) | ||||||
|         { |         { | ||||||
|             if (_isShowLog) |             if (_isShowLog) | ||||||
|             { |             { | ||||||
|  | @ -127,7 +127,7 @@ namespace Guru | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                      |                      | ||||||
|                     Debug.Log($"{TAG} LogEvent: event:<color=orange>{eventName}</color>  Properties:\n{sb.ToString()}"); |                     Debug.Log($"{TAG} LogEvent: event:<color=orange>{eventName} ({priority})</color>  Properties:\n{sb.ToString()}"); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ namespace Guru | ||||||
| 			{ | 			{ | ||||||
| 				return null; | 				return null; | ||||||
| 			} | 			} | ||||||
| 		 | 			UnityEngine.Debug.Log($"{TAG} --- Send Adjust Event: {eventName}({tokenID})"); | ||||||
| 			return new AdjustEvent(tokenID); | 			return new AdjustEvent(tokenID); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ namespace Guru | ||||||
| 		// 美元符号 | 		// 美元符号 | ||||||
| 		public static readonly string USD = "USD";  | 		public static readonly string USD = "USD";  | ||||||
| 		// 广告平台 | 		// 广告平台 | ||||||
| 		public static readonly string AdMAX = "MAX";  | 		public static readonly string AdMAX = "MAX"; | ||||||
| 		 | 		 | ||||||
| 		//IAP打点事件 | 		//IAP打点事件 | ||||||
| 		public static readonly string EventIAPFirst = "first_iap"; | 		public static readonly string EventIAPFirst = "first_iap"; | ||||||
|  |  | ||||||
|  | @ -309,12 +309,12 @@ namespace Guru | ||||||
| 	    /// </summary> | 	    /// </summary> | ||||||
| 	    /// <param name="key"></param> | 	    /// <param name="key"></param> | ||||||
| 	    /// <param name="data"></param> | 	    /// <param name="data"></param> | ||||||
| 	    private static void CustomLogEvent(string key, Dictionary<string, dynamic> data = null) | 	    private static void CustomLogEvent(string key, Dictionary<string, dynamic> data = null, int priority = -1) | ||||||
| 	    { | 	    { | ||||||
| 		    try | 		    try | ||||||
| 		    { | 		    { | ||||||
| 			    if (data == null) data = new Dictionary<string, dynamic>(); | 			    if (data == null) data = new Dictionary<string, dynamic>(); | ||||||
| 			    GuruAnalytics.LogEvent(key, data); | 			    GuruAnalytics.LogEvent(key, data, priority); | ||||||
| 			    UpdateAllValues(); // 同步所有的ID | 			    UpdateAllValues(); // 同步所有的ID | ||||||
| 		    } | 		    } | ||||||
| 		    catch (Exception e) | 		    catch (Exception e) | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| 
 | 
 | ||||||
| 
 | using UnityEngine; | ||||||
| using System.Collections; |  | ||||||
| 
 | 
 | ||||||
| namespace Guru | namespace Guru | ||||||
| { | { | ||||||
| 	using System; | 	using System; | ||||||
|  | 	using System.Collections; | ||||||
| 	using System.Collections.Generic; | 	using System.Collections.Generic; | ||||||
| 	using com.adjust.sdk; | 	using com.adjust.sdk; | ||||||
| 	using Facebook.Unity; | 	using Facebook.Unity; | ||||||
|  | @ -148,10 +148,10 @@ namespace Guru | ||||||
| 		/// </summary> | 		/// </summary> | ||||||
| 		/// <param name="eventName"></param> | 		/// <param name="eventName"></param> | ||||||
| 		/// <param name="eventSetting"></param> | 		/// <param name="eventSetting"></param> | ||||||
| 		internal static void LogEvent(string eventName, EventSetting eventSetting = null) | 		internal static void LogEvent(string eventName, EventSetting eventSetting = null, int priority = -1) | ||||||
| 		{ | 		{ | ||||||
| 			Log.I(TAG, $"eventName:{eventName}"); | 			Log.I(TAG, $"eventName:{eventName}"); | ||||||
| 			CustomLogEvent(eventName); // 自定义打点上报 | 			CustomLogEvent(eventName, null, priority); // 自定义打点上报 | ||||||
| 			CheckLogCache(eventName, null, eventSetting); // log缓存和消费 | 			CheckLogCache(eventName, null, eventSetting); // log缓存和消费 | ||||||
| 			 | 			 | ||||||
| 			if (!IsEnable) return; | 			if (!IsEnable) return; | ||||||
|  | @ -180,18 +180,17 @@ namespace Guru | ||||||
| 		/// <param name="eventName"></param> | 		/// <param name="eventName"></param> | ||||||
| 		/// <param name="extras"></param> | 		/// <param name="extras"></param> | ||||||
| 		/// <param name="eventSetting"></param> | 		/// <param name="eventSetting"></param> | ||||||
| 		internal static void LogEvent(string eventName, Dictionary<string, dynamic> extras, EventSetting eventSetting = null)  | 		internal static void LogEvent(string eventName, Dictionary<string, dynamic> extras, EventSetting eventSetting = null, int priority = -1)  | ||||||
| 		{ | 		{ | ||||||
| 			Log.I(TAG, $"eventName:{eventName}, params:{string.Join(",", extras)}"); | 			Log.I(TAG, $"eventName:{eventName}, params:{string.Join(",", extras)}"); | ||||||
| 			CustomLogEvent(eventName, extras); // 自定义打点上报 | 			CustomLogEvent(eventName, extras, priority); // 自定义打点上报 | ||||||
| 
 |  | ||||||
| 			CheckLogCache(eventName, extras, eventSetting); // log缓存和消费 | 			CheckLogCache(eventName, extras, eventSetting); // log缓存和消费 | ||||||
| 			 | 			 | ||||||
| 			if (!IsEnable) return; | 			if (!IsEnable) return; | ||||||
| 
 | 
 | ||||||
| 			if (extras == null) | 			if (extras == null) | ||||||
| 			{ | 			{ | ||||||
| 				LogEvent(eventName, eventSetting); // 防空判定 | 				LogEvent(eventName, eventSetting, priority); // 防空判定 | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
|  | @ -258,15 +257,16 @@ namespace Guru | ||||||
| 		/// <param name="key"></param> | 		/// <param name="key"></param> | ||||||
| 		/// <param name="data"></param> | 		/// <param name="data"></param> | ||||||
| 		/// <param name="setting"></param> | 		/// <param name="setting"></param> | ||||||
| 		public static void Track(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null) | 		/// <param name="priority"></param> | ||||||
|  | 		public static void Track(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null, int priority = -1) | ||||||
| 		{ | 		{ | ||||||
| 			if (null != data) | 			if (null != data) | ||||||
| 			{ | 			{ | ||||||
| 				LogEvent(key, data, setting); | 				LogEvent(key, data, setting, priority); | ||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| 				LogEvent(key, setting); | 				LogEvent(key, setting, priority); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -312,7 +312,7 @@ namespace Guru | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 		private static void CheckLogCache(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null) | 		private static void CheckLogCache(string key, Dictionary<string, dynamic> data = null, EventSetting setting = null, int priority = -1) | ||||||
| 		{ | 		{ | ||||||
| 			try | 			try | ||||||
| 			{ | 			{ | ||||||
|  | @ -320,7 +320,7 @@ namespace Guru | ||||||
| 				{ | 				{ | ||||||
| 					if (data == null) data = new Dictionary<string, dynamic>(); | 					if (data == null) data = new Dictionary<string, dynamic>(); | ||||||
| 					data["log_stamp"] = TimeUtil.GetCurrentTimeStamp().ToString(); | 					data["log_stamp"] = TimeUtil.GetCurrentTimeStamp().ToString(); | ||||||
| 					SavedLogs.Enqueue(new SavedLog(key, data, setting)); | 					SavedLogs.Enqueue(new SavedLog(key, data, setting, priority)); | ||||||
| 				} | 				} | ||||||
| 				else | 				else | ||||||
| 				{ | 				{ | ||||||
|  | @ -330,7 +330,7 @@ namespace Guru | ||||||
| 						while (SavedLogs.Count > 0) | 						while (SavedLogs.Count > 0) | ||||||
| 						{ | 						{ | ||||||
| 							var log = SavedLogs.Dequeue(); | 							var log = SavedLogs.Dequeue(); | ||||||
| 							LogEvent(log.key, log.data, log.setting); | 							LogEvent(log.key, log.data, log.setting, log.priority); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  | @ -349,18 +349,27 @@ namespace Guru | ||||||
| 	internal class SavedLog | 	internal class SavedLog | ||||||
| 	{ | 	{ | ||||||
| 		public string key; | 		public string key; | ||||||
|  | 		public int priority; | ||||||
| 		public Dictionary<string, dynamic> data; | 		public Dictionary<string, dynamic> data; | ||||||
| 		public Analytics.EventSetting setting; | 		public Analytics.EventSetting setting; | ||||||
| 
 | 
 | ||||||
| 		public SavedLog() | 		public SavedLog() | ||||||
| 		{ | 		{ | ||||||
| 		} | 		} | ||||||
| 
 | 		 | ||||||
| 		public SavedLog(string _key, Dictionary<string, dynamic> _data = null, Analytics.EventSetting _setting = null) | 		/// <summary> | ||||||
|  | 		/// 保存打点信息 | ||||||
|  | 		/// </summary> | ||||||
|  | 		/// <param name="_key"></param> | ||||||
|  | 		/// <param name="_data"></param> | ||||||
|  | 		/// <param name="_setting"></param> | ||||||
|  | 		/// <param name="_priority"></param> | ||||||
|  | 		public SavedLog(string _key, Dictionary<string, dynamic> _data = null, Analytics.EventSetting _setting = null, int _priority = -1) | ||||||
| 		{ | 		{ | ||||||
| 			key = _key; | 			key = _key; | ||||||
| 			data = _data; | 			data = _data; | ||||||
| 			setting = _setting; | 			setting = _setting; | ||||||
|  | 			priority = _priority; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue