From 22549903c52d74af173f60090267ea7de5375bf7 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 21 Jun 2023 10:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=95=B0=E5=92=8CAF=E6=89=93=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/SDK/BFThirdReportSDKManager.cs | 1 + .../NativeCore/ThirdPlatform/AppsFlyerSdk.cs | 13 +++++++- .../ThirdPlatform/ThinkingAnalytics.cs | 5 +++ ...tiveCore_ThirdPlatform_AppsFlyerSdkWrap.cs | 31 ++++++++++++++++++- ..._ThirdPlatform_ThinkingAnalyticsSdkWrap.cs | 31 ++++++++++++++++++- 5 files changed, 78 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Common/SDK/BFThirdReportSDKManager.cs b/Assets/Scripts/Common/SDK/BFThirdReportSDKManager.cs index 7084b43de..930f7745c 100644 --- a/Assets/Scripts/Common/SDK/BFThirdReportSDKManager.cs +++ b/Assets/Scripts/Common/SDK/BFThirdReportSDKManager.cs @@ -27,6 +27,7 @@ namespace BF public void SetThinkingAnalyticsAccountId(string id) { TASdk.SetAccountId(id); + AFSdk.SetTaAccountId(id); } // 清除账户id diff --git a/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/AppsFlyerSdk.cs b/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/AppsFlyerSdk.cs index 95ac33d65..5e15c8f4f 100644 --- a/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/AppsFlyerSdk.cs +++ b/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/AppsFlyerSdk.cs @@ -9,7 +9,10 @@ namespace BF.NativeCore.ThirdPlatform { public void Init() { - // Debug.Log("AppsFlyerSdk Init version = " + AppsFlyer.getSdkVersion()); + // 打通TA和AF的设置,要在AF初始化之前执行 + var customData = new Dictionary(); + customData.Add("ta_distinct_id", ThinkingAnalyticsAPI.GetDistinctId()); + AppsFlyer.setAdditionalData(customData); AppsFlyer.setCustomerIdAndStartSDK(ThinkingAnalyticsAPI.GetDeviceId()); } @@ -17,5 +20,13 @@ namespace BF.NativeCore.ThirdPlatform { AppsFlyer.sendEvent(eventName, properties); } + + public void SetTaAccountId(string accountId) + { + var customData = new Dictionary(); + customData.Add("ta_distinct_id", ThinkingAnalyticsAPI.GetDistinctId()); + customData.Add("ta_account_id", accountId); + AppsFlyer.setAdditionalData(customData); + } } } diff --git a/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/ThinkingAnalytics.cs b/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/ThinkingAnalytics.cs index 98e0eb91e..ff889191b 100644 --- a/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/ThinkingAnalytics.cs +++ b/Assets/Scripts/Common/SDK/NativeCore/ThirdPlatform/ThinkingAnalytics.cs @@ -40,5 +40,10 @@ namespace BF.NativeCore.ThirdPlatform { ThinkingAnalyticsAPI.Track(eventName, properties, date, appId); } + + public string GetDistinctId() + { + return ThinkingAnalyticsAPI.GetDistinctId(); + } } } diff --git a/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_AppsFlyerSdkWrap.cs b/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_AppsFlyerSdkWrap.cs index 8601bb968..337715ce5 100644 --- a/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_AppsFlyerSdkWrap.cs +++ b/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_AppsFlyerSdkWrap.cs @@ -21,10 +21,11 @@ namespace XLua.CSObjectWrap { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(BF.NativeCore.ThirdPlatform.AppsFlyerSdk); - Utils.BeginObjectRegister(type, L, translator, 0, 2, 0, 0); + Utils.BeginObjectRegister(type, L, translator, 0, 3, 0, 0); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Init", _m_Init); Utils.RegisterFunc(L, Utils.METHOD_IDX, "SendEvent", _m_SendEvent); + Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetTaAccountId", _m_SetTaAccountId); @@ -129,6 +130,34 @@ namespace XLua.CSObjectWrap } + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _m_SetTaAccountId(RealStatePtr L) + { + try { + + ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); + + + BF.NativeCore.ThirdPlatform.AppsFlyerSdk gen_to_be_invoked = (BF.NativeCore.ThirdPlatform.AppsFlyerSdk)translator.FastGetCSObj(L, 1); + + + + { + string _accountId = LuaAPI.lua_tostring(L, 2); + + gen_to_be_invoked.SetTaAccountId( _accountId ); + + + + return 0; + } + + } catch(System.Exception gen_e) { + return LuaAPI.luaL_error(L, "c# exception:" + gen_e); + } + + } + diff --git a/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_ThinkingAnalyticsSdkWrap.cs b/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_ThinkingAnalyticsSdkWrap.cs index ace786566..c51867c1f 100644 --- a/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_ThinkingAnalyticsSdkWrap.cs +++ b/Assets/XLua/Gen/BF_NativeCore_ThirdPlatform_ThinkingAnalyticsSdkWrap.cs @@ -21,12 +21,13 @@ namespace XLua.CSObjectWrap { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(BF.NativeCore.ThirdPlatform.ThinkingAnalyticsSdk); - Utils.BeginObjectRegister(type, L, translator, 0, 4, 0, 0); + Utils.BeginObjectRegister(type, L, translator, 0, 5, 0, 0); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Init", _m_Init); Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetAccountId", _m_SetAccountId); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ClearAccountId", _m_ClearAccountId); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Track", _m_Track); + Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetDistinctId", _m_GetDistinctId); @@ -227,6 +228,34 @@ namespace XLua.CSObjectWrap } + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _m_GetDistinctId(RealStatePtr L) + { + try { + + ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); + + + BF.NativeCore.ThirdPlatform.ThinkingAnalyticsSdk gen_to_be_invoked = (BF.NativeCore.ThirdPlatform.ThinkingAnalyticsSdk)translator.FastGetCSObj(L, 1); + + + + { + + var gen_ret = gen_to_be_invoked.GetDistinctId( ); + LuaAPI.lua_pushstring(L, gen_ret); + + + + return 1; + } + + } catch(System.Exception gen_e) { + return LuaAPI.luaL_error(L, "c# exception:" + gen_e); + } + + } +