From c3b77622d91baf8a82549a649aa57c982aa78d28 Mon Sep 17 00:00:00 2001 From: huyufei Date: Fri, 12 Jul 2024 10:29:39 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=20Adjust=20?= =?UTF-8?q?=E7=9A=84=20DeepLink=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1020917 --user=yufei.hu 【中台】【SDK】新增 Adjust Deeplink 接口 https://www.tapd.cn/33527076/s/1156644 Signed-off-by: huyufei --- Runtime/GuruCore/Runtime/Adjust/AdjustService.cs | 10 ++++++++-- Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs | 9 ++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs index fac0fe2..5cd7c36 100644 --- a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs +++ b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs @@ -1,9 +1,11 @@ + + namespace Guru { using UnityEngine; using com.adjust.sdk; - using System.Collections; + using System; public static class AdjustService { @@ -45,7 +47,8 @@ namespace Guru /// /// /// MIR 追踪 AppID - public static void StartService(string appToken, string fbAppId = "") + /// + public static void StartService(string appToken, string fbAppId = "", Action onDeeplinkCallback = null) { if (string.IsNullOrEmpty(appToken)) { @@ -59,6 +62,9 @@ namespace Guru AdjustConfig config = new AdjustConfig(appToken, environment); config.setLogLevel(GetAdjustLogLevel()); config.setDelayStart(DelayTime); + + if(onDeeplinkCallback != null) + config.setDeferredDeeplinkDelegate(onDeeplinkCallback); #if UNITY_ANDROID if (!string.IsNullOrEmpty(fbAppId)) config.setFbAppId(fbAppId); // 注入 MIR ID diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs index 9ce380d..123747b 100644 --- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs +++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.cs @@ -9,7 +9,6 @@ namespace Guru public static partial class FirebaseUtil { private static readonly string LOG_TAG = "Firebase"; - private static bool _isDebug = false; private static bool _isReady = false; public static bool IsReady => _isReady; @@ -19,13 +18,12 @@ namespace Guru public static Action OnFirebaseAuthResult; public static Action OnUserAuthResult; + public static Action OnAdjustDeeplinkCallback = null; - - public static void InitFirebase(Action callback, bool isDebug = false) + public static void InitFirebase(Action callback) { _isReady = false; - _isDebug = isDebug; Analytics.InitAnalytics(); // 打点提前初始化 // Loom.StartUp(); // 确保主线程开启 @@ -103,6 +101,7 @@ namespace Guru FirebaseAnalytics.GetAnalyticsInstanceIdAsync() .ContinueWithOnMainThread(task => { + if (task.IsCompleted && !string.IsNullOrEmpty(task.Result)) { // 保存本地ID备份 @@ -117,7 +116,7 @@ namespace Guru // 启动 AdjustService string appToken = GuruSettings.Instance.AdjustSetting?.GetAppToken() ?? ""; string fbAppId = GuruSettings.Instance.IPMSetting.FacebookAppId; - AdjustService.StartService(appToken, fbAppId); + AdjustService.StartService(appToken, fbAppId, OnAdjustDeeplinkCallback); // 初始化 Adjust 服务 });