From 714d1edf68dd4d83e94b13b3518c3fcfb4e9e678 Mon Sep 17 00:00:00 2001 From: huyufei Date: Fri, 10 May 2024 13:02:32 +0800 Subject: [PATCH] F: update AdjustServices. remove deps and add print Adjust Version. --- .../GuruCore/Runtime/Adjust/AdjustService.cs | 95 ++++++++++--------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs index 1b32823..fac0fe2 100644 --- a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs +++ b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs @@ -1,16 +1,14 @@ -using System.Collections; -using System.Threading; namespace Guru { using UnityEngine; using com.adjust.sdk; - using System.Threading.Tasks; - + using System.Collections; public static class AdjustService { public const string Version = "1.6.1"; + public const string AdjustVersion = "4.38.0"; // Adjust SDK Version public static readonly string LOG_TAG = "Adjust"; public static readonly float DelayTime = 1f; // 延迟启动时间 @@ -51,7 +49,7 @@ namespace Guru { if (string.IsNullOrEmpty(appToken)) { - Log.E(LOG_TAG, "Adjust没有设置token,无法进行初始化"); + LogE(LOG_TAG, "Adjust没有设置token,无法进行初始化"); return; } @@ -68,7 +66,7 @@ namespace Guru #if UNITY_EDITOR || DEBUG - config.setLogDelegate(log => Log.I(LOG_TAG, log)); + config.setLogDelegate(log => LogI(LOG_TAG, log)); config.setEventSuccessDelegate(OnEventSuccessCallback); config.setEventFailureDelegate(OnEventFailureCallback); config.setSessionSuccessDelegate(OnSessionSuccessCallback); @@ -83,7 +81,9 @@ namespace Guru _adjustId = Adjust.getAdid(); // 获取AdjustID // 异步加载AdId - FetchGoogleAdId(); + FetchGoogleAdId(); + + LogI(LOG_TAG, $"----- Start AdjustService[{Version}] AdjustVer:{AdjustVersion} -----"); } public static void FetchGoogleAdId() @@ -153,171 +153,171 @@ namespace Guru private static void OnAttributionChangedCallback(AdjustAttribution attributionData) { - Log.I(LOG_TAG, "Attribution changed!"); + LogI(LOG_TAG, "Attribution changed!"); if (attributionData.trackerName != null) { - Log.I(LOG_TAG, "Tracker name: " + attributionData.trackerName); + LogI(LOG_TAG, "Tracker name: " + attributionData.trackerName); } if (attributionData.trackerToken != null) { - Log.I(LOG_TAG, "Tracker token: " + attributionData.trackerToken); + LogI(LOG_TAG, "Tracker token: " + attributionData.trackerToken); } if (attributionData.network != null) { - Log.I(LOG_TAG, "Network: " + attributionData.network); + LogI(LOG_TAG, "Network: " + attributionData.network); } if (attributionData.campaign != null) { - Log.I(LOG_TAG, "Campaign: " + attributionData.campaign); + LogI(LOG_TAG, "Campaign: " + attributionData.campaign); } if (attributionData.adgroup != null) { - Log.I(LOG_TAG, "Adgroup: " + attributionData.adgroup); + LogI(LOG_TAG, "Adgroup: " + attributionData.adgroup); } if (attributionData.creative != null) { - Log.I(LOG_TAG, "Creative: " + attributionData.creative); + LogI(LOG_TAG, "Creative: " + attributionData.creative); } if (attributionData.clickLabel != null) { - Log.I(LOG_TAG , "Click label: " + attributionData.clickLabel); + LogI(LOG_TAG , "Click label: " + attributionData.clickLabel); } if (attributionData.adid != null) { - Log.I(LOG_TAG, "ADID: " + attributionData.adid); + LogI(LOG_TAG, "ADID: " + attributionData.adid); } } private static void OnEventSuccessCallback(AdjustEventSuccess eventSuccessData) { - Log.I(LOG_TAG, "Event tracked successfully!"); + LogI(LOG_TAG, "Event tracked successfully!"); if (eventSuccessData.Message != null) { - Log.I(LOG_TAG, "Message: " + eventSuccessData.Message); + LogI(LOG_TAG, "Message: " + eventSuccessData.Message); } if (eventSuccessData.Timestamp != null) { - Log.I(LOG_TAG, "Timestamp: " + eventSuccessData.Timestamp); + LogI(LOG_TAG, "Timestamp: " + eventSuccessData.Timestamp); } if (eventSuccessData.Adid != null) { - Log.I(LOG_TAG, "Adid: " + eventSuccessData.Adid); + LogI(LOG_TAG, "Adid: " + eventSuccessData.Adid); } if (eventSuccessData.EventToken != null) { - Log.I(LOG_TAG, "EventToken: " + eventSuccessData.EventToken); + LogI(LOG_TAG, "EventToken: " + eventSuccessData.EventToken); } if (eventSuccessData.CallbackId != null) { - Log.I(LOG_TAG, "CallbackId: " + eventSuccessData.CallbackId); + LogI(LOG_TAG, "CallbackId: " + eventSuccessData.CallbackId); } if (eventSuccessData.JsonResponse != null) { - Log.I(LOG_TAG, "JsonResponse: " + eventSuccessData.GetJsonResponse()); + LogI(LOG_TAG, "JsonResponse: " + eventSuccessData.GetJsonResponse()); } } private static void OnEventFailureCallback(AdjustEventFailure eventFailureData) { - Log.I(LOG_TAG, "Event tracking failed!"); + LogI(LOG_TAG, "Event tracking failed!"); if (eventFailureData.Message != null) { - Log.I(LOG_TAG, "Message: " + eventFailureData.Message); + LogI(LOG_TAG, "Message: " + eventFailureData.Message); } if (eventFailureData.Timestamp != null) { - Log.I(LOG_TAG, "Timestamp: " + eventFailureData.Timestamp); + LogI(LOG_TAG, "Timestamp: " + eventFailureData.Timestamp); } if (eventFailureData.Adid != null) { - Log.I(LOG_TAG, "Adid: " + eventFailureData.Adid); + LogI(LOG_TAG, "Adid: " + eventFailureData.Adid); } if (eventFailureData.EventToken != null) { - Log.I(LOG_TAG, "EventToken: " + eventFailureData.EventToken); + LogI(LOG_TAG, "EventToken: " + eventFailureData.EventToken); } if (eventFailureData.CallbackId != null) { - Log.I(LOG_TAG, "CallbackId: " + eventFailureData.CallbackId); + LogI(LOG_TAG, "CallbackId: " + eventFailureData.CallbackId); } if (eventFailureData.JsonResponse != null) { - Log.I(LOG_TAG, "JsonResponse: " + eventFailureData.GetJsonResponse()); + LogI(LOG_TAG, "JsonResponse: " + eventFailureData.GetJsonResponse()); } - Log.I(LOG_TAG, "WillRetry: " + eventFailureData.WillRetry.ToString()); + LogI(LOG_TAG, "WillRetry: " + eventFailureData.WillRetry.ToString()); } private static void OnSessionSuccessCallback(AdjustSessionSuccess sessionSuccessData) { - Log.I(LOG_TAG,"Session tracked successfully!"); + LogI(LOG_TAG,"Session tracked successfully!"); if (sessionSuccessData.Message != null) { - Log.I(LOG_TAG,"Message: " + sessionSuccessData.Message); + LogI(LOG_TAG,"Message: " + sessionSuccessData.Message); } if (sessionSuccessData.Timestamp != null) { - Log.I(LOG_TAG,"Timestamp: " + sessionSuccessData.Timestamp); + LogI(LOG_TAG,"Timestamp: " + sessionSuccessData.Timestamp); } if (sessionSuccessData.Adid != null) { - Log.I(LOG_TAG, "Adid: " + sessionSuccessData.Adid); + LogI(LOG_TAG, "Adid: " + sessionSuccessData.Adid); } if (sessionSuccessData.JsonResponse != null) { - Log.I(LOG_TAG, "JsonResponse: " + sessionSuccessData.GetJsonResponse()); + LogI(LOG_TAG, "JsonResponse: " + sessionSuccessData.GetJsonResponse()); } } private static void OnSessionFailureCallback(AdjustSessionFailure sessionFailureData) { - Log.I(LOG_TAG,"Session tracking failed!"); + LogI(LOG_TAG,"Session tracking failed!"); if (sessionFailureData.Message != null) { - Log.I(LOG_TAG,"Message: " + sessionFailureData.Message); + LogI(LOG_TAG,"Message: " + sessionFailureData.Message); } if (sessionFailureData.Timestamp != null) { - Log.I(LOG_TAG,"Timestamp: " + sessionFailureData.Timestamp); + LogI(LOG_TAG,"Timestamp: " + sessionFailureData.Timestamp); } if (sessionFailureData.Adid != null) { - Log.I(LOG_TAG,"Adid: " + sessionFailureData.Adid); + LogI(LOG_TAG,"Adid: " + sessionFailureData.Adid); } if (sessionFailureData.JsonResponse != null) { - Log.I(LOG_TAG,"JsonResponse: " + sessionFailureData.GetJsonResponse()); + LogI(LOG_TAG,"JsonResponse: " + sessionFailureData.GetJsonResponse()); } - Log.I(LOG_TAG,"WillRetry: " + sessionFailureData.WillRetry.ToString()); + LogI(LOG_TAG,"WillRetry: " + sessionFailureData.WillRetry.ToString()); } #endregion @@ -432,8 +432,17 @@ namespace Guru return AdjustLogLevel.Suppress; #endif } + + public static void LogI(string tag, object conent) + { + Debug.Log($"{tag} {conent}"); + } + + public static void LogE(string tag, object conent) + { + Debug.LogError($"{tag} {conent}"); + } #endregion - } } \ No newline at end of file