Merge branch 'feature/analytics_190' into 1.0.10
# Conflicts: # Editor/GuruBuildSuit/IOS_POST_AD/IOSPostBuild_SKAdNetwork.cs # Editor/GuruBuildSuit/IOS_POST_AD/SKADNetwork.plist # Runtime/GuruConsent/Runtime/Script/Consent/GuruConsent.cs # Runtime/GuruCore/Runtime/Ads/ADServiceBase.cs # Runtime/GuruCore/Runtime/Reporter/CrashlyticsAgent.cs # Runtime/GuruIAP/Runtime/Code/IAPServiceBase.csdeeplink
						commit
						13154f30db
					
				| 
						 | 
					@ -25,7 +25,7 @@ Sample Dependencies.xml:
 | 
				
			||||||
<!--        <androidPackage spec="com.squareup.retrofit2:retrofit:2.7.1" />-->
 | 
					<!--        <androidPackage spec="com.squareup.retrofit2:retrofit:2.7.1" />-->
 | 
				
			||||||
    </androidPackages>
 | 
					    </androidPackages>
 | 
				
			||||||
    <iosPods>
 | 
					    <iosPods>
 | 
				
			||||||
        <iosPod name="GuruAnalyticsLib" version="0.3.2" bitcodeEnabled="false">
 | 
					        <iosPod name="GuruAnalyticsLib" version="0.3.3" bitcodeEnabled="false">
 | 
				
			||||||
            <sources>
 | 
					            <sources>
 | 
				
			||||||
                <source>git@github.com:castbox/GuruSpecs.git</source>
 | 
					                <source>git@github.com:castbox/GuruSpecs.git</source>
 | 
				
			||||||
            </sources>
 | 
					            </sources>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -1,32 +0,0 @@
 | 
				
			||||||
fileFormatVersion: 2
 | 
					 | 
				
			||||||
guid: a336b814594434b4092d38e5ce76577a
 | 
					 | 
				
			||||||
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: 
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					fileFormatVersion: 2
 | 
				
			||||||
 | 
					guid: 979b8da6b92542e990e6038f43f1835d
 | 
				
			||||||
 | 
					timeCreated: 1710317078
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -1,32 +0,0 @@
 | 
				
			||||||
fileFormatVersion: 2
 | 
					 | 
				
			||||||
guid: c5a9f9e11213b4bb78856debe4c967ca
 | 
					 | 
				
			||||||
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: 
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					fileFormatVersion: 2
 | 
				
			||||||
 | 
					guid: 7d0a7721c57840829fad465c4c33e846
 | 
				
			||||||
 | 
					timeCreated: 1710317052
 | 
				
			||||||
| 
						 | 
					@ -1,14 +0,0 @@
 | 
				
			||||||
source 'https://github.com/CocoaPods/Specs.git'
 | 
					 | 
				
			||||||
source 'git@github.com:castbox/GuruSpecs.git'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
platform :ios, '11.0'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
target 'UnityFramework' do
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  pod 'GuruAnalyticsLib', '~>0.2.2'
 | 
					 | 
				
			||||||
#  pod 'GuruAnalyticsLib', :git => 'git@github.com:castbox/GuruAnalytics_iOS.git', :branch => 'dev'
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
target 'Unity-iPhone' do
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
use_frameworks!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,7 +0,0 @@
 | 
				
			||||||
fileFormatVersion: 2
 | 
					 | 
				
			||||||
guid: 10035163694574b63b74cd99c7ee5c68
 | 
					 | 
				
			||||||
DefaultImporter:
 | 
					 | 
				
			||||||
  externalObjects: {}
 | 
					 | 
				
			||||||
  userData: 
 | 
					 | 
				
			||||||
  assetBundleName: 
 | 
					 | 
				
			||||||
  assetBundleVariant: 
 | 
					 | 
				
			||||||
| 
						 | 
					@ -17,8 +17,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static NSString *gameobjectName;
 | 
					static NSString *gameobjectName = @"GuruCallback";
 | 
				
			||||||
static NSString *callbackName;
 | 
					static NSString *callbackName =@"OnCallback";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static GuruAnalytics *_analytics;
 | 
					static GuruAnalytics *_analytics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ static GuruAnalytics *_analytics;
 | 
				
			||||||
@implementation U3DAnalytics
 | 
					@implementation U3DAnalytics
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Const value define
 | 
					// Const value define
 | 
				
			||||||
NSString * const Version = @"1.8.1";
 | 
					NSString * const Version = @"1.9.0";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const double kUploadPeriodInSecond = 60.0;
 | 
					static const double kUploadPeriodInSecond = 60.0;
 | 
				
			||||||
static const int kBatchLimit = 15;
 | 
					static const int kBatchLimit = 15;
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,8 @@ static const double kInitializeTimeout = 5.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static double tch001MaxValue = 0.01;
 | 
					static double tch001MaxValue = 0.01;
 | 
				
			||||||
static double tch02MaxValue = 0.2;
 | 
					static double tch02MaxValue = 0.2;
 | 
				
			||||||
 | 
					static bool enableErrorLog = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NSString * const TchAdRevRoas001 = @"tch_ad_rev_roas_001";
 | 
					NSString * const TchAdRevRoas001 = @"tch_ad_rev_roas_001";
 | 
				
			||||||
NSString * const TchAdRevRoas02 = @"tch_ad_rev_roas_02";
 | 
					NSString * const TchAdRevRoas02 = @"tch_ad_rev_roas_02";
 | 
				
			||||||
NSString * const TchError = @"tch_error";
 | 
					NSString * const TchError = @"tch_error";
 | 
				
			||||||
| 
						 | 
					@ -78,12 +80,29 @@ NSString * const TchError = @"tch_error";
 | 
				
			||||||
    tch02MaxValue = value;
 | 
					    tch02MaxValue = value;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 设置是否启用日志错误上报
 | 
				
			||||||
 | 
					+(void) setEnableErrorLog: (bool) value{
 | 
				
			||||||
 | 
					    if(enableErrorLog == false && value){
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        enableErrorLog = value;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        [GuruAnalytics registerInternalEventObserverWithReportCallback:^(NSInteger code, NSString * info){
 | 
				
			||||||
 | 
					            [U3DAnalytics onEventCallback:code andInfo:info];
 | 
				
			||||||
 | 
					        }];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 事件上报回调
 | 
				
			||||||
 | 
					+(void) onEventCallback: (NSInteger)code  andInfo:(NSString *) info{
 | 
				
			||||||
 | 
					    [U3DAnalytics sendMessage:  [U3DAnalytics buildLogEventString: code  andMessage:info]];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 构建数据
 | 
					// 构建数据
 | 
				
			||||||
//+(NSString *) buildDataString: (int)status andMessage: (NSString *)msg{
 | 
					+(NSString *) buildLogEventString: (NSInteger)status andMessage: (NSString *)msg{
 | 
				
			||||||
//
 | 
					    NSString *jsonString = [NSString stringWithFormat: @"{\"action\":\"logger_error\",\"data\":{\"code\":%d,\"msg\":\"%@\"}}", (int)status, msg];
 | 
				
			||||||
//    NSString *jsonString = [NSString stringWithFormat: @"{\"action\":\"gdpr\",\"data\":{\"status\":%d,\"msg\":\"%@\"}}", status, msg];
 | 
					    return jsonString;
 | 
				
			||||||
//    return jsonString;
 | 
					}
 | 
				
			||||||
//}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 构建数据字典
 | 
					// 构建数据字典
 | 
				
			||||||
+(NSDictionary<NSString*, id> *) buildDataDict: (NSString *) str{
 | 
					+(NSDictionary<NSString*, id> *) buildDataDict: (NSString *) str{
 | 
				
			||||||
| 
						 | 
					@ -179,6 +198,19 @@ NSString * const TchError = @"tch_error";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 向Unity发送数据
 | 
				
			||||||
 | 
					+(void) sendMessage: (NSString *)msg
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    // NSLog(@"--- unityInitSDK222: %@:%@", gameobjectName, callbackName);
 | 
				
			||||||
 | 
					    if(gameobjectName != nil && callbackName != nil){
 | 
				
			||||||
 | 
					        char *t1 = [U3DAnalytics finalChar: gameobjectName];
 | 
				
			||||||
 | 
					        char *t2 = [U3DAnalytics finalChar: callbackName];
 | 
				
			||||||
 | 
					        char *t3 = [U3DAnalytics finalChar: msg];
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        UnitySendMessage(t1, t2, t3);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 上报 tch_error 事件
 | 
					// 上报 tch_error 事件
 | 
				
			||||||
| 
						 | 
					@ -206,6 +238,10 @@ NSString * const TchError = @"tch_error";
 | 
				
			||||||
    return NO;
 | 
					    return NO;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//---------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================ UNITY PUBLIC API ============================
 | 
					//============================ UNITY PUBLIC API ============================
 | 
				
			||||||
| 
						 | 
					@ -225,6 +261,12 @@ extern "C" {
 | 
				
			||||||
                                                 loggerDebug:isDebug];
 | 
					                                                 loggerDebug:isDebug];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void unityInitCallback(const char *gameobject, const char *method){
 | 
				
			||||||
 | 
					        // NSLog(@"--- unityInitSDK111: %s:%s", gameobject, method);
 | 
				
			||||||
 | 
					        gameobjectName = [NSString stringWithUTF8String:gameobject];
 | 
				
			||||||
 | 
					        callbackName = [NSString stringWithUTF8String:method];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 设置用户ID
 | 
					    // 设置用户ID
 | 
				
			||||||
    void unitySetUserID(const char *uid){
 | 
					    void unitySetUserID(const char *uid){
 | 
				
			||||||
        [GuruAnalytics setUserID:[U3DAnalytics charToString:uid]];
 | 
					        [GuruAnalytics setUserID:[U3DAnalytics charToString:uid]];
 | 
				
			||||||
| 
						 | 
					@ -288,6 +330,11 @@ extern "C" {
 | 
				
			||||||
        }];
 | 
					        }];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 注册内部日志 Error 监听
 | 
				
			||||||
 | 
					    void unitySetEnableErrorLog(bool value){
 | 
				
			||||||
 | 
					        [U3DAnalytics setEnableErrorLog:value];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,15 @@ GuruAnalyticsLib 的 Unity 插件库
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Change Logs
 | 
					## Change Logs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 1.9.0
 | 
				
			||||||
 | 
					- Android 端对齐 0.3.1+. 
 | 
				
			||||||
 | 
					  > Hash: 0457eba963a9049fb6a16708b921573ef36c99b1
 | 
				
			||||||
 | 
					- iOS 端对齐 0.3.3
 | 
				
			||||||
 | 
					  > Hash: c86d19fb38c8260f468e38d756aca84e89d58c8b
 | 
				
			||||||
 | 
					- 新增自打点的错误上报功能, 但需要项目内接入 GuruSDKCallbacks 对象才能完成日志回发的功能
 | 
				
			||||||
 | 
					- 错误上报开在 Plugin 外部应关依赖云控开启, 默认关闭. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 1.8.4
 | 
					### 1.8.4
 | 
				
			||||||
- 优化Android 端 Worker 调用逻辑, 重启 Worker 有助于让打点数据更准确
 | 
					- 优化Android 端 Worker 调用逻辑, 重启 Worker 有助于让打点数据更准确
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@ using System.Globalization;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Text;
 | 
					using System.Text;
 | 
				
			||||||
using Newtonsoft.Json;
 | 
					using Newtonsoft.Json;
 | 
				
			||||||
 | 
					using Newtonsoft.Json.Linq;
 | 
				
			||||||
using UnityEngine;
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,9 +15,11 @@ namespace Guru
 | 
				
			||||||
    public class GuruAnalytics
 | 
					    public class GuruAnalytics
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Plugin Version
 | 
					        // Plugin Version
 | 
				
			||||||
        public const string Version = "1.8.4";
 | 
					        public const string Version = "1.9.0";
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        public static readonly string Tag = "[ANA]";
 | 
					        public static readonly string Tag = "[ANA]";
 | 
				
			||||||
 | 
					        private static readonly string ActionName = "logger_error";
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        private static IAnalyticsAgent _agent;
 | 
					        private static IAnalyticsAgent _agent;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        public static IAnalyticsAgent Agent
 | 
					        public static IAnalyticsAgent Agent
 | 
				
			||||||
| 
						 | 
					@ -54,16 +57,34 @@ namespace Guru
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static bool _autoSyncProperties = false;
 | 
					        private static bool _autoSyncProperties = false;
 | 
				
			||||||
 | 
					        private static bool _enableErrorLog = false;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 启动日志错误上报
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public static bool EnableErrorLog
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _enableErrorLog;
 | 
				
			||||||
 | 
					            set
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                _enableErrorLog = value;
 | 
				
			||||||
 | 
					                if (_enableErrorLog) InitCallbacks(); // 激活错误日志回调
 | 
				
			||||||
 | 
					                if (Agent != null) Agent.EnableErrorLog = _enableErrorLog;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #region 公用接口
 | 
					        #region 公用接口
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 初始化接口
 | 
					        /// 初始化接口
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public static void Init(string appId, string deviceInfo, bool isDebug = false, bool syncProperties = false)
 | 
					        public static void Init(string appId, string deviceInfo, bool isDebug = false, 
 | 
				
			||||||
 | 
					            bool enableErrorLog = false, bool syncProperties = false)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            _autoSyncProperties = syncProperties;
 | 
					            _autoSyncProperties = syncProperties;
 | 
				
			||||||
 | 
					            _enableErrorLog = enableErrorLog;
 | 
				
			||||||
            Agent?.Init(appId, deviceInfo, isDebug);
 | 
					            Agent?.Init(appId, deviceInfo, isDebug);
 | 
				
			||||||
 | 
					            if(_enableErrorLog) InitCallbacks(); // 激活错误日志回调
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
| 
						 | 
					@ -260,7 +281,6 @@ namespace Guru
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool needUpdate = !UserProperties.ContainsKey(key) || UserProperties[key] != value;
 | 
					            bool needUpdate = !UserProperties.ContainsKey(key) || UserProperties[key] != value;
 | 
				
			||||||
            UserProperties[key] = value;
 | 
					            UserProperties[key] = value;
 | 
				
			||||||
 | 
					 | 
				
			||||||
            // if (needUpdate) UpdateAllUserProperties();
 | 
					            // if (needUpdate) UpdateAllUserProperties();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -284,6 +304,126 @@ namespace Guru
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #endregion
 | 
					        #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #region 日志回调
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private static void InitCallbacks()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                GuruSDKCallback.RemoveCallback(OnSDKCallback);
 | 
				
			||||||
 | 
					                GuruSDKCallback.AddCallback(OnSDKCallback);
 | 
				
			||||||
 | 
					                if (Agent != null)
 | 
				
			||||||
 | 
					                    Agent.InitCallback(GuruSDKCallback.ObjectName, GuruSDKCallback.MethodName);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Analytics.LogCrashlytics(ex);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 获取SDK回调
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="msg"></param>
 | 
				
			||||||
 | 
					        private static void OnSDKCallback(string msg)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //------- message send to unity ----------
 | 
				
			||||||
 | 
					            Debug.Log($"{Tag} get callback errorInfo:\n{msg}");
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var response = JsonConvert.DeserializeObject<JObject>(msg);
 | 
				
			||||||
 | 
					                if (response.TryGetValue("action", out var jAct))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (jAct.ToString() == ActionName 
 | 
				
			||||||
 | 
					                        && response.TryGetValue("data", out var jData) && jData is JObject data)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        int code = -1;
 | 
				
			||||||
 | 
					                        string message = msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        if (data.TryGetValue("code", out var jCode))
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            int.TryParse(jCode.ToString(), out code);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        if (data.TryGetValue("msg", out var jMsg))
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            message = jMsg.ToString();
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        
 | 
				
			||||||
 | 
					                        var errorCode = (AnalyticsCode)code;
 | 
				
			||||||
 | 
					                        switch (errorCode)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            case AnalyticsCode.Network_Lost:
 | 
				
			||||||
 | 
					                            case AnalyticsCode.ERROR_API:
 | 
				
			||||||
 | 
					                            case AnalyticsCode.ERROR_DNS:
 | 
				
			||||||
 | 
					                            case AnalyticsCode.ERROR_ZIP:
 | 
				
			||||||
 | 
					                            case AnalyticsCode.ERROR_LOAD_MARK:
 | 
				
			||||||
 | 
					                            case AnalyticsCode.ERROR_RESPONSE:
 | 
				
			||||||
 | 
					                            case AnalyticsCode.ERROR_CACHE_CONTROL:
 | 
				
			||||||
 | 
					                            case AnalyticsCode.ERROR_DELETE_EXPIRED:
 | 
				
			||||||
 | 
					                                OnLoggerErrorEvent(code, message);
 | 
				
			||||||
 | 
					                                break;  
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                Debug.LogError($"{Tag} Parse callback Error");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Analytics.LogCrashlytics(ex);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 上报错误信息
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="code"></param>
 | 
				
			||||||
 | 
					        /// <param name="errorInfo"></param>
 | 
				
			||||||
 | 
					        private static void OnLoggerErrorEvent(int code, string errorInfo = "")
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Dictionary<string, dynamic> parameters = new Dictionary<string, dynamic>()
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                {"item_category", "error_event"},
 | 
				
			||||||
 | 
					                {"item_name", ((AnalyticsCode)code).ToString()},
 | 
				
			||||||
 | 
					                {"country", IPMConfig.IPM_COUNTRY_CODE},
 | 
				
			||||||
 | 
					                {"network", Application.internetReachability.ToString()},
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					            if (!string.IsNullOrEmpty(errorInfo))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                int len = 32;
 | 
				
			||||||
 | 
					                if (errorInfo.Length > len) errorInfo = errorInfo.TrimStart().Substring(0, len);
 | 
				
			||||||
 | 
					                parameters["err"] = errorInfo;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Debug.Log($"{Tag} --- ErrorLogInfo:: code:{code}\tinfo:{errorInfo}");
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            // Only for firebase GA
 | 
				
			||||||
 | 
					            Analytics.LogEvent("dev_audit", parameters,
 | 
				
			||||||
 | 
					                new Analytics.EventSetting() { EnableFirebaseAnalytics = true });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        #endregion
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// 网络状态枚举
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public enum AnalyticsCode
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Unknown = -1,
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        Network_Lost = 22,
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        ERROR_API = 101,
 | 
				
			||||||
 | 
					        ERROR_RESPONSE = 102,
 | 
				
			||||||
 | 
					        ERROR_CACHE_CONTROL = 103,
 | 
				
			||||||
 | 
					        ERROR_DELETE_EXPIRED = 104,
 | 
				
			||||||
 | 
					        ERROR_LOAD_MARK = 105,
 | 
				
			||||||
 | 
					        ERROR_DNS = 106,
 | 
				
			||||||
 | 
					        ERROR_ZIP = 107,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,8 +14,10 @@ namespace Guru
 | 
				
			||||||
        void SetDeviceId(string deviceId);
 | 
					        void SetDeviceId(string deviceId);
 | 
				
			||||||
        void SetUid(string uid);
 | 
					        void SetUid(string uid);
 | 
				
			||||||
        bool IsDebug { get; }
 | 
					        bool IsDebug { get; }
 | 
				
			||||||
 | 
					        bool EnableErrorLog { get; set; }
 | 
				
			||||||
        void LogEvent(string eventName, string parameters);
 | 
					        void LogEvent(string eventName, string parameters);
 | 
				
			||||||
        void ReportEventSuccessRate(); // 上报任务成功率
 | 
					        void ReportEventSuccessRate(); // 上报任务成功率
 | 
				
			||||||
        void SetTch02Value(double value); // 设置太极02数值
 | 
					        void SetTch02Value(double value); // 设置太极02数值
 | 
				
			||||||
 | 
					        void InitCallback(string objName, string method); // 设置回调对象参数
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -123,6 +123,18 @@ namespace Guru
 | 
				
			||||||
        public void LogEvent(string eventName, string parameters) => CallStatic("logEvent", eventName, parameters);
 | 
					        public void LogEvent(string eventName, string parameters) => CallStatic("logEvent", eventName, parameters);
 | 
				
			||||||
        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);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        private bool _enableErrorLog;
 | 
				
			||||||
 | 
					        public bool EnableErrorLog
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _enableErrorLog;
 | 
				
			||||||
 | 
					            set
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                _enableErrorLog = value;
 | 
				
			||||||
 | 
					                CallStatic("setEnableErrorLog", _enableErrorLog);  
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        #endregion
 | 
					        #endregion
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,8 @@ namespace Guru
 | 
				
			||||||
        [DllImport(K_INTERNAL)] private static extern void unityInitException();
 | 
					        [DllImport(K_INTERNAL)] private static extern void unityInitException();
 | 
				
			||||||
        [DllImport(K_INTERNAL)] private static extern void unityTestUnrecognizedSelectorCrash();
 | 
					        [DllImport(K_INTERNAL)] private static extern void unityTestUnrecognizedSelectorCrash();
 | 
				
			||||||
        [DllImport(K_INTERNAL)] private static extern void unitySetTch02Value(double value);
 | 
					        [DllImport(K_INTERNAL)] private static extern void unitySetTch02Value(double value);
 | 
				
			||||||
 | 
					        [DllImport(K_INTERNAL)] private static extern void unitySetEnableErrorLog(bool value);
 | 
				
			||||||
 | 
					        [DllImport(K_INTERNAL)] private static extern void unityInitCallback(string objName, string method);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        private static bool _isDebug = false;    
 | 
					        private static bool _isDebug = false;    
 | 
				
			||||||
| 
						 | 
					@ -32,6 +34,27 @@ namespace Guru
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #region 接口实现
 | 
					        #region 接口实现
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private bool _enableErrorLog;
 | 
				
			||||||
 | 
					        public bool EnableErrorLog
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _enableErrorLog;
 | 
				
			||||||
 | 
					            set
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                _enableErrorLog = value;
 | 
				
			||||||
 | 
					#if UNITY_IOS
 | 
				
			||||||
 | 
					                unitySetEnableErrorLog(_enableErrorLog);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        public void InitCallback(string objName, string method)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					#if UNITY_IOS
 | 
				
			||||||
 | 
					            unityInitCallback(objName, method);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void Init(string appId, string deviceInfo, bool isDebug = false)
 | 
					        public void Init(string appId, string deviceInfo, bool isDebug = false)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            _isDebug = isDebug;
 | 
					            _isDebug = isDebug;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,18 @@ namespace Guru
 | 
				
			||||||
        private bool _isShowLog = false;
 | 
					        private bool _isShowLog = false;
 | 
				
			||||||
        private bool _isDebug = false;
 | 
					        private bool _isDebug = false;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        private bool _enableErrorLog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public bool EnableErrorLog
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _enableErrorLog;
 | 
				
			||||||
 | 
					            set
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Debug.Log($"{TAG} EnableErrorLog:<color=orange>{value}</color>");
 | 
				
			||||||
 | 
					                _enableErrorLog = value;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        public void Init(string appId, string deviceInfo, bool isDebug = false)
 | 
					        public void Init(string appId, string deviceInfo, bool isDebug = false)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -22,6 +34,14 @@ namespace Guru
 | 
				
			||||||
                Debug.Log($"{TAG} init with Debug: <color=orange>{isDebug}</color>  appId:{appId}    deviceInfo:{deviceInfo}");
 | 
					                Debug.Log($"{TAG} init with Debug: <color=orange>{isDebug}</color>  appId:{appId}    deviceInfo:{deviceInfo}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        public void InitCallback(string objName, string method)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if(_isShowLog) 
 | 
				
			||||||
 | 
					                Debug.Log($"{TAG} InitCallback: <color=orange>object:{objName}  method:{method}</color>");   
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        public void SetScreen(string screenName)
 | 
					        public void SetScreen(string screenName)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if(_isShowLog) 
 | 
					            if(_isShowLog) 
 | 
				
			||||||
| 
						 | 
					@ -118,5 +138,14 @@ namespace Guru
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Debug.Log($"{TAG} Tch02MaxValue: {value}");
 | 
					            Debug.Log($"{TAG} Tch02MaxValue: {value}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #region Editor Test API
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					         
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #endregion
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Guru
 | 
					namespace Guru
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    using System;
 | 
					    using System;
 | 
				
			||||||
| 
						 | 
					@ -13,7 +14,7 @@ namespace Guru
 | 
				
			||||||
    public class GuruConsent
 | 
					    public class GuruConsent
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Guru Consent Version
 | 
					        // Guru Consent Version
 | 
				
			||||||
        public static string Version = "1.0.7";
 | 
					        public static string Version = "1.0.8";
 | 
				
			||||||
        public static string Tag = "[GuruConsent]";
 | 
					        public static string Tag = "[GuruConsent]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #region 公用接口
 | 
					        #region 公用接口
 | 
				
			||||||
| 
						 | 
					@ -135,26 +136,6 @@ namespace Guru
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        #region 常量定义
 | 
					        #region 常量定义
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /// <summary>
 | 
					 | 
				
			||||||
        /// GDPR 状态对象
 | 
					 | 
				
			||||||
        /// </summary>
 | 
					 | 
				
			||||||
        [Serializable]
 | 
					 | 
				
			||||||
        internal class ConsentResult
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            public string action = "";
 | 
					 | 
				
			||||||
            public ConsentStatus data = null;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					 | 
				
			||||||
        /// GDPR 状态对象
 | 
					 | 
				
			||||||
        /// </summary>
 | 
					 | 
				
			||||||
        [Serializable]
 | 
					 | 
				
			||||||
        internal class ConsentStatus
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            public int status;
 | 
					 | 
				
			||||||
            public string msg;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Consent 状态
 | 
					        /// Consent 状态
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,6 +109,8 @@ namespace Guru
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected virtual void OnMaxSdkReady()
 | 
					        protected virtual void OnMaxSdkReady()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            Debug.Log($"[ADService] --- Start Max with spec: bads:{_initSpec.loadBanner}  iads:{_initSpec.loadInterstitial}  rads:{_initSpec.loadRewarded}");
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            //应用启动策略
 | 
					            //应用启动策略
 | 
				
			||||||
            if(_initSpec.loadBanner) RequestBannerAD();
 | 
					            if(_initSpec.loadBanner) RequestBannerAD();
 | 
				
			||||||
            if(_initSpec.loadInterstitial) RequestInterstitialAD();
 | 
					            if(_initSpec.loadInterstitial) RequestInterstitialAD();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -116,5 +116,8 @@ namespace Guru
 | 
				
			||||||
		public static readonly string ParameterBalance = "balance"; // 用于余额
 | 
							public static readonly string ParameterBalance = "balance"; // 用于余额
 | 
				
			||||||
		public static readonly string ParameterSku = "sku"; // sku
 | 
							public static readonly string ParameterSku = "sku"; // sku
 | 
				
			||||||
		public static readonly string ParameterVirtualCurrencyName = "virtual_currency_name"; // 虚拟货币名称
 | 
							public static readonly string ParameterVirtualCurrencyName = "virtual_currency_name"; // 虚拟货币名称
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// 中台
 | 
				
			||||||
 | 
							public static readonly string EventDevAudit = "dev_audit"; // 中台事件异常
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -33,8 +33,9 @@ namespace Guru
 | 
				
			||||||
	    /// <summary>
 | 
						    /// <summary>
 | 
				
			||||||
	    /// 初始化Guru自打点系统 (请优先于 Firebase 初始化调用)
 | 
						    /// 初始化Guru自打点系统 (请优先于 Firebase 初始化调用)
 | 
				
			||||||
	    /// </summary>
 | 
						    /// </summary>
 | 
				
			||||||
	    public static void InstallGuruAnalytics(bool isDebug = false)
 | 
						    public static void InstallGuruAnalytics(bool isDebug = false, bool enableErrorLog = false)
 | 
				
			||||||
	    {
 | 
						    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		    if (_hasInited) return;
 | 
							    if (_hasInited) return;
 | 
				
			||||||
		    
 | 
							    
 | 
				
			||||||
	        try
 | 
						        try
 | 
				
			||||||
| 
						 | 
					@ -46,7 +47,7 @@ namespace Guru
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		        string appId = IPMConfig.IPM_X_APP_ID;
 | 
							        string appId = IPMConfig.IPM_X_APP_ID;
 | 
				
			||||||
		        string deviceInfo = new DeviceInfoData().ToString();
 | 
							        string deviceInfo = new DeviceInfoData().ToString();
 | 
				
			||||||
		        GuruAnalytics.Init(appId, deviceInfo, IsDebug); // 初始化(带Header) 
 | 
							        GuruAnalytics.Init(appId, deviceInfo, IsDebug, enableErrorLog); // 初始化(带Header) 
 | 
				
			||||||
		        
 | 
							        
 | 
				
			||||||
		        _hasGotFirebaseId = false;
 | 
							        _hasGotFirebaseId = false;
 | 
				
			||||||
		        _hasGotAdId = false;
 | 
							        _hasGotAdId = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -596,6 +596,21 @@ namespace Guru
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		#endregion
 | 
							#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#region 中台异常打点
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/// <summary>
 | 
				
			||||||
 | 
							/// 中台异常打点
 | 
				
			||||||
 | 
							/// </summary>
 | 
				
			||||||
 | 
							/// <param name="data"></param>
 | 
				
			||||||
 | 
							public static void LogDevAudit(Dictionary<string, dynamic> data)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (data == null) return;
 | 
				
			||||||
 | 
								data["country"] = IPMConfig.IPM_COUNTRY_CODE;
 | 
				
			||||||
 | 
								data["network"] = Application.internetReachability.ToString();
 | 
				
			||||||
 | 
								LogEvent(EventDevAudit, data, new EventSetting() { EnableFirebaseAnalytics = true });
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							#endregion
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,9 +40,9 @@ namespace Guru
 | 
				
			||||||
            return ins;
 | 
					            return ins;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        private void SetCallback(Action<string> callback)
 | 
					        private void SubCallback(Action<string> callback)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            msgCallback += callback;
 | 
					            msgCallback -= callback;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        private void SubCallback(Action<string> callback)
 | 
					        private void SubCallback(Action<string> callback)
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,16 @@ namespace Guru
 | 
				
			||||||
        /// <param name="callback"></param>
 | 
					        /// <param name="callback"></param>
 | 
				
			||||||
        public static void AddCallback(Action<string> callback)
 | 
					        public static void AddCallback(Action<string> callback)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Instance.SetCallback(callback);
 | 
					            Instance.msgCallback += callback;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 添加回调
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="callback"></param>
 | 
				
			||||||
 | 
					        public static void RemoveCallback(Action<string> callback)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Instance.msgCallback -= callback;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,6 @@ namespace Guru
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static void OnReceivedMessage(string condition, string stackTrace, LogType type)
 | 
					        private static void OnReceivedMessage(string condition, string stackTrace, LogType type)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            string msg = $"{DateTime.Now:yy-MM-dd HH:mm:ss} [{ToLogTypeString(type)}] {condition}\n{stackTrace}";
 | 
					            string msg = $"{DateTime.Now:yy-MM-dd HH:mm:ss} [{ToLogTypeString(type)}] {condition}\n{stackTrace}";
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if (_catchFilter.Contains(type))
 | 
					            if (_catchFilter.Contains(type))
 | 
				
			||||||
| 
						 | 
					@ -114,7 +113,7 @@ namespace Guru
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void LogException(string msg)
 | 
					        public static void LogException(string msg)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Crashlytics.LogException(new Exception(msg));
 | 
					            LogException(new Exception(msg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void Log(string msg)
 | 
					        public static void Log(string msg)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue