update:更新SDK 修改
This commit is contained in:
@@ -61,6 +61,8 @@ public class ChannelBuildTool
|
||||
File.Delete(oldJava);
|
||||
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "*SDKService.java"))
|
||||
File.Delete(oldJava);
|
||||
foreach (var oldJava in Directory.GetFiles(TysdkPlugins, "*SDKAdapter.java"))
|
||||
File.Delete(oldJava);
|
||||
var oldConfig = Path.Combine(TysdkPlugins, "ConfigManager.java");
|
||||
if (File.Exists(oldConfig)) File.Delete(oldConfig);
|
||||
|
||||
|
||||
@@ -76,6 +76,10 @@ public class SDKManager {
|
||||
String getPendingPurchases();
|
||||
}
|
||||
|
||||
public interface IBillingLifecycleAdapter {
|
||||
void refreshBilling();
|
||||
}
|
||||
|
||||
private static IChannelSDKAdapter sdkAdapter;
|
||||
|
||||
public static void queryProductsByIDs(String productIds) {
|
||||
@@ -100,9 +104,16 @@ public class SDKManager {
|
||||
return "[]";
|
||||
}
|
||||
|
||||
public static void RefreshBillingService() {
|
||||
Log.i(TAG, "RefreshBillingService");
|
||||
if (sdkAdapter instanceof IBillingLifecycleAdapter) {
|
||||
((IBillingLifecycleAdapter) sdkAdapter).refreshBilling();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CancelBillingFlow() {
|
||||
Log.w(TAG, "CancelBillingFlow");
|
||||
// FlexionSDKService.cancelPurchase();
|
||||
// FlexionSDKAdapter.cancelPurchase();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user