From 5c1f73fc1822ee07d4e8a5d0f73edf12c87ffa64 Mon Sep 17 00:00:00 2001 From: huyufei Date: Wed, 17 Jul 2024 09:57:44 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=AE=8C=E5=96=84=20AdjustId=20?= =?UTF-8?q?=E7=9A=84=E7=BC=93=E5=AD=98=E6=9C=BA=E5=88=B6=E5=92=8C=E4=BA=8C?= =?UTF-8?q?=E6=AC=A1=E4=B8=8A=E6=8A=A5=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyufei --- Runtime/GuruAdjust/AdjustService.cs | 2 +- .../GuruCore/Runtime/Firebase/FirebaseUtil.cs | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Runtime/GuruAdjust/AdjustService.cs b/Runtime/GuruAdjust/AdjustService.cs index 9470da5..73965fe 100644 --- a/Runtime/GuruAdjust/AdjustService.cs +++ b/Runtime/GuruAdjust/AdjustService.cs @@ -280,7 +280,7 @@ namespace Guru private static void OnSessionSuccessCallback(AdjustSessionSuccess sessionSuccessData) { - LogI(LOG_TAG,"Session tracked successfully!"); + LogI(LOG_TAG,$"{LOG_TAG} --- Session tracked successfully!"); var adid = sessionSuccessData.Adid; _onSessionSuccessCallback?.Invoke(adid); diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs index 55a993e..d5d4c47 100644 --- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs +++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs @@ -117,21 +117,37 @@ namespace Guru // 启动 AdjustService string appToken = GuruSettings.Instance.AdjustSetting?.GetAppToken() ?? ""; string fbAppId = GuruSettings.Instance.IPMSetting.FacebookAppId; - AdjustService.StartService(appToken, fbAppId, adid => + + if (!string.IsNullOrEmpty(IPMConfig.ADJUST_ID)) + { + ReportAdjustId(IPMConfig.ADJUST_ID); // 二次启动后,若有值则立即上报属性 + } + + AdjustService.StartService(appToken, fbAppId, adjustId => { // 获取 ADID - if (string.IsNullOrEmpty(adid)) + if (string.IsNullOrEmpty(adjustId)) { - adid = "not_set"; + adjustId = "not_set"; } - FirebaseAnalytics.SetUserProperty("adjust_id", adid); // 仅上报 Firebase 用户属性 - Debug.Log($"[SDK] --- Firebase + Adjust ID: {adid}"); + else + { + IPMConfig.ADJUST_ID = adjustId; + } + ReportAdjustId(adjustId); }); }); } + private static void ReportAdjustId(string adjustId) + { + FirebaseAnalytics.SetUserProperty("adjust_id", adjustId); // 仅上报 Firebase 用户属性 + Debug.Log($"[SDK] --- Firebase + Adjust ID: {adjustId}"); + } + + #endregion