Merge branch 'china/dev' of http://60.1.1.230/gaoxin/JL_Client into china/dev

dev_chengFeng
ZhangBiao 2021-08-30 18:45:31 +08:00
commit e68d6a2b23
1 changed files with 48 additions and 43 deletions

View File

@ -33,6 +33,9 @@ using UnityEngine;
using UnityEditor; using UnityEditor;
using UnityEditor.Callbacks; using UnityEditor.Callbacks;
#endif #endif
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
using System.IO; using System.IO;
using ThinkingAnalytics.TaException; using ThinkingAnalytics.TaException;
@ -196,7 +199,7 @@ namespace ThinkingAnalytics
public class ThinkingAnalyticsAPI : MonoBehaviour, TaExceptionHandler public class ThinkingAnalyticsAPI : MonoBehaviour, TaExceptionHandler
{ {
#region settings #region settings
[System.Serializable] [System.Serializable]
public struct Token public struct Token
{ {
@ -275,61 +278,63 @@ namespace ThinkingAnalytics
[HideInInspector] [HideInInspector]
public Token[] tokens = new Token[1]; public Token[] tokens = new Token[1];
#endregion #endregion
public readonly string VERSION = "2.2.1"; public readonly string VERSION = "2.2.1";
private static ThinkingAnalyticsAPI taAPIInstance; private static ThinkingAnalyticsAPI taAPIInstance;
//配置Xcode选项 //配置Xcode选项
#if UNITY_EDITOR #if UNITY_EDITOR
//[PostProcessBuild] //[PostProcessBuild]
[PostProcessBuildAttribute(88)] [PostProcessBuildAttribute(88)]
public static void onPostProcessBuild(BuildTarget target, string targetPath) public static void onPostProcessBuild(BuildTarget target, string targetPath)
{ {
//if (target != BuildTarget.iOS) #if EDITOR_IOS
//{ if (target != BuildTarget.iOS)
// Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); {
// return; Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run");
//} return;
}
//string projPath = Path.GetFullPath(targetPath) + "/Unity-iPhone.xcodeproj/project.pbxproj";
//UnityEditor.iOS.Xcode.PBXProject proj = new UnityEditor.iOS.Xcode.PBXProject(); string projPath = Path.GetFullPath(targetPath) + "/Unity-iPhone.xcodeproj/project.pbxproj";
//proj.ReadFromFile(projPath);
//#if UNITY_2019_3_OR_NEWER
//string targetGuid = proj.GetUnityFrameworkTargetGuid();
//#else
//string targetGuid = proj.TargetGuidByName(PBXProject.GetUnityTargetName());
//#endif
////Build Property UnityEditor.iOS.Xcode.PBXProject proj = new UnityEditor.iOS.Xcode.PBXProject();
//proj.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");//BitCode NO proj.ReadFromFile(projPath);
//proj.SetBuildProperty(targetGuid, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");//Enable Objective-C Exceptions #if UNITY_2019_3_OR_NEWER
string targetGuid = proj.GetUnityFrameworkTargetGuid();
#else
string targetGuid = proj.TargetGuidByName(PBXProject.GetUnityTargetName());
#endif
//string[] headerSearchPathsToAdd = { "$(SRCROOT)/Libraries/Plugins/iOS/ThinkingSDK/Source/main", "$(SRCROOT)/Libraries/Plugins/iOS/ThinkingSDK/Source/common" }; //Build Property
//proj.UpdateBuildProperty(targetGuid, "HEADER_SEARCH_PATHS", headerSearchPathsToAdd, null);// Header Search Paths proj.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");//BitCode NO
proj.SetBuildProperty(targetGuid, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");//Enable Objective-C Exceptions
////Add Frameworks string[] headerSearchPathsToAdd = { "$(SRCROOT)/Libraries/Plugins/iOS/ThinkingSDK/Source/main", "$(SRCROOT)/Libraries/Plugins/iOS/ThinkingSDK/Source/common" };
//proj.AddFrameworkToProject(targetGuid,"WebKit.framework", true); proj.UpdateBuildProperty(targetGuid, "HEADER_SEARCH_PATHS", headerSearchPathsToAdd, null);// Header Search Paths
//proj.AddFrameworkToProject(targetGuid,"CoreTelephony.framework", true);
//proj.AddFrameworkToProject(targetGuid,"SystemConfiguration.framework", true);
//proj.AddFrameworkToProject(targetGuid,"Security.framework", true);
////Add Lib //Add Frameworks
//proj.AddFileToBuild(targetGuid, proj.AddFile("usr/lib/libsqlite3.tbd", "libsqlite3.tbd", PBXSourceTree.Sdk)); proj.AddFrameworkToProject(targetGuid, "WebKit.framework", true);
//proj.AddFileToBuild(targetGuid, proj.AddFile("usr/lib/libz.tbd", "libz.tbd", PBXSourceTree.Sdk)); proj.AddFrameworkToProject(targetGuid, "CoreTelephony.framework", true);
proj.AddFrameworkToProject(targetGuid, "SystemConfiguration.framework", true);
proj.AddFrameworkToProject(targetGuid, "Security.framework", true);
//proj.WriteToFile (projPath); //Add Lib
proj.AddFileToBuild(targetGuid, proj.AddFile("usr/lib/libsqlite3.tbd", "libsqlite3.tbd", PBXSourceTree.Sdk));
proj.AddFileToBuild(targetGuid, proj.AddFile("usr/lib/libz.tbd", "libz.tbd", PBXSourceTree.Sdk));
proj.WriteToFile(projPath);
#endif
} }
#endif #endif
/// <summary> /// <summary>
/// 设置自定义访客 ID用于替换系统生成的访客 ID /// 设置自定义访客 ID用于替换系统生成的访客 ID
/// </summary> /// </summary>
/// <param name="FIRSTId">访客 ID</param> /// <param name="FIRSTId">访客 ID</param>
/// <param name="appId">项目 ID(可选)</param> /// <param name="appId">项目 ID(可选)</param>
public static void Identify(string FIRSTId, string appId = "") public static void Identify(string FIRSTId, string appId = "")
{ {
if (tracking_enabled) if (tracking_enabled)
{ {
@ -877,14 +882,14 @@ namespace ThinkingAnalytics
} }
} }
#region internal #region internal
void Awake() void Awake()
{ {
taAPIInstance = this; taAPIInstance = this;
#if DISABLE_TA #if DISABLE_TA
tracking_enabled = false; tracking_enabled = false;
#endif #endif
TD_Log.EnableLog(enableLog); TD_Log.EnableLog(enableLog);
ThinkingAnalyticsWrapper.SetVersionInfo(VERSION); ThinkingAnalyticsWrapper.SetVersionInfo(VERSION);
if (TA_instance == null) if (TA_instance == null)
@ -959,6 +964,6 @@ namespace ThinkingAnalytics
instance_lock.ExitReadLock(); instance_lock.ExitReadLock();
} }
} }
#endregion #endregion
} }
} }