F: update AdjustServices. remove deps and add print Adjust Version.

deeplink
胡宇飞 2024-05-10 13:02:32 +08:00
parent 913dcf7495
commit 714d1edf68
1 changed files with 52 additions and 43 deletions

View File

@ -1,16 +1,14 @@
using System.Collections;
using System.Threading;
namespace Guru namespace Guru
{ {
using UnityEngine; using UnityEngine;
using com.adjust.sdk; using com.adjust.sdk;
using System.Threading.Tasks; using System.Collections;
public static class AdjustService public static class AdjustService
{ {
public const string Version = "1.6.1"; 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 string LOG_TAG = "Adjust";
public static readonly float DelayTime = 1f; // 延迟启动时间 public static readonly float DelayTime = 1f; // 延迟启动时间
@ -51,7 +49,7 @@ namespace Guru
{ {
if (string.IsNullOrEmpty(appToken)) if (string.IsNullOrEmpty(appToken))
{ {
Log.E(LOG_TAG, "Adjust没有设置token无法进行初始化"); LogE(LOG_TAG, "Adjust没有设置token无法进行初始化");
return; return;
} }
@ -68,7 +66,7 @@ namespace Guru
#if UNITY_EDITOR || DEBUG #if UNITY_EDITOR || DEBUG
config.setLogDelegate(log => Log.I(LOG_TAG, log)); config.setLogDelegate(log => LogI(LOG_TAG, log));
config.setEventSuccessDelegate(OnEventSuccessCallback); config.setEventSuccessDelegate(OnEventSuccessCallback);
config.setEventFailureDelegate(OnEventFailureCallback); config.setEventFailureDelegate(OnEventFailureCallback);
config.setSessionSuccessDelegate(OnSessionSuccessCallback); config.setSessionSuccessDelegate(OnSessionSuccessCallback);
@ -83,7 +81,9 @@ namespace Guru
_adjustId = Adjust.getAdid(); // 获取AdjustID _adjustId = Adjust.getAdid(); // 获取AdjustID
// 异步加载AdId // 异步加载AdId
FetchGoogleAdId(); FetchGoogleAdId();
LogI(LOG_TAG, $"----- Start AdjustService[{Version}] AdjustVer:{AdjustVersion} -----");
} }
public static void FetchGoogleAdId() public static void FetchGoogleAdId()
@ -153,171 +153,171 @@ namespace Guru
private static void OnAttributionChangedCallback(AdjustAttribution attributionData) private static void OnAttributionChangedCallback(AdjustAttribution attributionData)
{ {
Log.I(LOG_TAG, "Attribution changed!"); LogI(LOG_TAG, "Attribution changed!");
if (attributionData.trackerName != null) if (attributionData.trackerName != null)
{ {
Log.I(LOG_TAG, "Tracker name: " + attributionData.trackerName); LogI(LOG_TAG, "Tracker name: " + attributionData.trackerName);
} }
if (attributionData.trackerToken != null) if (attributionData.trackerToken != null)
{ {
Log.I(LOG_TAG, "Tracker token: " + attributionData.trackerToken); LogI(LOG_TAG, "Tracker token: " + attributionData.trackerToken);
} }
if (attributionData.network != null) if (attributionData.network != null)
{ {
Log.I(LOG_TAG, "Network: " + attributionData.network); LogI(LOG_TAG, "Network: " + attributionData.network);
} }
if (attributionData.campaign != null) if (attributionData.campaign != null)
{ {
Log.I(LOG_TAG, "Campaign: " + attributionData.campaign); LogI(LOG_TAG, "Campaign: " + attributionData.campaign);
} }
if (attributionData.adgroup != null) if (attributionData.adgroup != null)
{ {
Log.I(LOG_TAG, "Adgroup: " + attributionData.adgroup); LogI(LOG_TAG, "Adgroup: " + attributionData.adgroup);
} }
if (attributionData.creative != null) if (attributionData.creative != null)
{ {
Log.I(LOG_TAG, "Creative: " + attributionData.creative); LogI(LOG_TAG, "Creative: " + attributionData.creative);
} }
if (attributionData.clickLabel != null) if (attributionData.clickLabel != null)
{ {
Log.I(LOG_TAG , "Click label: " + attributionData.clickLabel); LogI(LOG_TAG , "Click label: " + attributionData.clickLabel);
} }
if (attributionData.adid != null) if (attributionData.adid != null)
{ {
Log.I(LOG_TAG, "ADID: " + attributionData.adid); LogI(LOG_TAG, "ADID: " + attributionData.adid);
} }
} }
private static void OnEventSuccessCallback(AdjustEventSuccess eventSuccessData) private static void OnEventSuccessCallback(AdjustEventSuccess eventSuccessData)
{ {
Log.I(LOG_TAG, "Event tracked successfully!"); LogI(LOG_TAG, "Event tracked successfully!");
if (eventSuccessData.Message != null) if (eventSuccessData.Message != null)
{ {
Log.I(LOG_TAG, "Message: " + eventSuccessData.Message); LogI(LOG_TAG, "Message: " + eventSuccessData.Message);
} }
if (eventSuccessData.Timestamp != null) if (eventSuccessData.Timestamp != null)
{ {
Log.I(LOG_TAG, "Timestamp: " + eventSuccessData.Timestamp); LogI(LOG_TAG, "Timestamp: " + eventSuccessData.Timestamp);
} }
if (eventSuccessData.Adid != null) if (eventSuccessData.Adid != null)
{ {
Log.I(LOG_TAG, "Adid: " + eventSuccessData.Adid); LogI(LOG_TAG, "Adid: " + eventSuccessData.Adid);
} }
if (eventSuccessData.EventToken != null) if (eventSuccessData.EventToken != null)
{ {
Log.I(LOG_TAG, "EventToken: " + eventSuccessData.EventToken); LogI(LOG_TAG, "EventToken: " + eventSuccessData.EventToken);
} }
if (eventSuccessData.CallbackId != null) if (eventSuccessData.CallbackId != null)
{ {
Log.I(LOG_TAG, "CallbackId: " + eventSuccessData.CallbackId); LogI(LOG_TAG, "CallbackId: " + eventSuccessData.CallbackId);
} }
if (eventSuccessData.JsonResponse != null) if (eventSuccessData.JsonResponse != null)
{ {
Log.I(LOG_TAG, "JsonResponse: " + eventSuccessData.GetJsonResponse()); LogI(LOG_TAG, "JsonResponse: " + eventSuccessData.GetJsonResponse());
} }
} }
private static void OnEventFailureCallback(AdjustEventFailure eventFailureData) private static void OnEventFailureCallback(AdjustEventFailure eventFailureData)
{ {
Log.I(LOG_TAG, "Event tracking failed!"); LogI(LOG_TAG, "Event tracking failed!");
if (eventFailureData.Message != null) if (eventFailureData.Message != null)
{ {
Log.I(LOG_TAG, "Message: " + eventFailureData.Message); LogI(LOG_TAG, "Message: " + eventFailureData.Message);
} }
if (eventFailureData.Timestamp != null) if (eventFailureData.Timestamp != null)
{ {
Log.I(LOG_TAG, "Timestamp: " + eventFailureData.Timestamp); LogI(LOG_TAG, "Timestamp: " + eventFailureData.Timestamp);
} }
if (eventFailureData.Adid != null) if (eventFailureData.Adid != null)
{ {
Log.I(LOG_TAG, "Adid: " + eventFailureData.Adid); LogI(LOG_TAG, "Adid: " + eventFailureData.Adid);
} }
if (eventFailureData.EventToken != null) if (eventFailureData.EventToken != null)
{ {
Log.I(LOG_TAG, "EventToken: " + eventFailureData.EventToken); LogI(LOG_TAG, "EventToken: " + eventFailureData.EventToken);
} }
if (eventFailureData.CallbackId != null) if (eventFailureData.CallbackId != null)
{ {
Log.I(LOG_TAG, "CallbackId: " + eventFailureData.CallbackId); LogI(LOG_TAG, "CallbackId: " + eventFailureData.CallbackId);
} }
if (eventFailureData.JsonResponse != null) 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) private static void OnSessionSuccessCallback(AdjustSessionSuccess sessionSuccessData)
{ {
Log.I(LOG_TAG,"Session tracked successfully!"); LogI(LOG_TAG,"Session tracked successfully!");
if (sessionSuccessData.Message != null) if (sessionSuccessData.Message != null)
{ {
Log.I(LOG_TAG,"Message: " + sessionSuccessData.Message); LogI(LOG_TAG,"Message: " + sessionSuccessData.Message);
} }
if (sessionSuccessData.Timestamp != null) if (sessionSuccessData.Timestamp != null)
{ {
Log.I(LOG_TAG,"Timestamp: " + sessionSuccessData.Timestamp); LogI(LOG_TAG,"Timestamp: " + sessionSuccessData.Timestamp);
} }
if (sessionSuccessData.Adid != null) if (sessionSuccessData.Adid != null)
{ {
Log.I(LOG_TAG, "Adid: " + sessionSuccessData.Adid); LogI(LOG_TAG, "Adid: " + sessionSuccessData.Adid);
} }
if (sessionSuccessData.JsonResponse != null) if (sessionSuccessData.JsonResponse != null)
{ {
Log.I(LOG_TAG, "JsonResponse: " + sessionSuccessData.GetJsonResponse()); LogI(LOG_TAG, "JsonResponse: " + sessionSuccessData.GetJsonResponse());
} }
} }
private static void OnSessionFailureCallback(AdjustSessionFailure sessionFailureData) private static void OnSessionFailureCallback(AdjustSessionFailure sessionFailureData)
{ {
Log.I(LOG_TAG,"Session tracking failed!"); LogI(LOG_TAG,"Session tracking failed!");
if (sessionFailureData.Message != null) if (sessionFailureData.Message != null)
{ {
Log.I(LOG_TAG,"Message: " + sessionFailureData.Message); LogI(LOG_TAG,"Message: " + sessionFailureData.Message);
} }
if (sessionFailureData.Timestamp != null) if (sessionFailureData.Timestamp != null)
{ {
Log.I(LOG_TAG,"Timestamp: " + sessionFailureData.Timestamp); LogI(LOG_TAG,"Timestamp: " + sessionFailureData.Timestamp);
} }
if (sessionFailureData.Adid != null) if (sessionFailureData.Adid != null)
{ {
Log.I(LOG_TAG,"Adid: " + sessionFailureData.Adid); LogI(LOG_TAG,"Adid: " + sessionFailureData.Adid);
} }
if (sessionFailureData.JsonResponse != null) 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 #endregion
@ -432,8 +432,17 @@ namespace Guru
return AdjustLogLevel.Suppress; return AdjustLogLevel.Suppress;
#endif #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 #endregion
} }
} }