update:更新SDK 修改

This commit is contained in:
2026-05-21 14:45:27 +08:00
parent dc622282f2
commit f06074d9cc
7 changed files with 252 additions and 79 deletions

View File

@@ -322,6 +322,9 @@ namespace tysdk
result.isSuccess = true;
result.userId = _accountInfo.userId;
SetUserInfo();
#if UNITY_ANDROID
UnityBridgeFunc.RefreshBillingService();
#endif
}
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
@@ -414,6 +417,9 @@ namespace tysdk
{
_accountInfo.AddLinkedAccount(accoutType);
_accountInfo.Save();
#if UNITY_ANDROID
UnityBridgeFunc.RefreshBillingService();
#endif
}
return result;
}

View File

@@ -160,10 +160,18 @@ namespace tysdk
var result = new ProductListInfo();
return result;
#elif UNITY_ANDROID || UNITY_IOS
var task = TYSDKCallbackManager.Instance.RegisterCallback<ProductListInfo>();
var task = TYSDKCallbackManager.Instance.RegisterCallback<ProductListInfo>(TimeSpan.FromSeconds(45));
UnityBridgeFunc.GetSKUList();
var result = await task;
return result;
try
{
var result = await task;
return result;
}
catch (TaskCanceledException e)
{
Debug.LogWarning($"[TYSdkFacade] GetSKUList timeout: {e.Message}");
return new ProductListInfo() { code = 1, msg = "sku_callback_timeout" };
}
#endif
}
@@ -176,10 +184,18 @@ namespace tysdk
await Task.Yield();
return new ProductListInfo();
#elif UNITY_ANDROID
var task = TYSDKCallbackManager.Instance.RegisterCallback<ProductListInfo>();
var task = TYSDKCallbackManager.Instance.RegisterCallback<ProductListInfo>(TimeSpan.FromSeconds(45));
UnityBridgeFunc.GetSKUListByIapIds(productIds);
var result = await task;
return result;
try
{
var result = await task;
return result;
}
catch (TaskCanceledException e)
{
Debug.LogWarning($"[TYSdkFacade] GetSKUListByIapIds timeout: {e.Message}");
return new ProductListInfo() { code = 1, msg = "sku_callback_timeout" };
}
#else
return new ProductListInfo() { code = -1, msg = "unsupported platform" };
#endif

View File

@@ -48,6 +48,8 @@ namespace tysdk
public static string GetPendingPurchases() => "[]";
public static void RefreshBillingService() { }
//打点
public static void SetGaUserInfo(string userId){}
public static void SetGaCommonInfo(string SetGaCommonInfo){}
@@ -224,6 +226,15 @@ namespace tysdk
}
}
public static void RefreshBillingService()
{
UnityEngine.Debug.Log("UnityBridgeFunc.RefreshBillingService");
using(var sdkManager = new AndroidJavaClass(SDK_CLASS))
{
sdkManager.CallStatic("RefreshBillingService");
}
}
public static void CancelBillingFlow()
{
UnityEngine.Debug.Log("UnityBridgeFunc.CancelBillingFlow");
@@ -470,6 +481,8 @@ namespace tysdk
public static string GetPendingPurchases() => "[]";
public static void RefreshBillingService() { }
#endif
}
}