update: 更新 IAP 插件接口, 返回商品本地化价格字段
parent
6292994bbd
commit
c1f4903a0e
|
|
@ -61,6 +61,28 @@ namespace Guru
|
|||
|
||||
#region Data
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品信息
|
||||
/// </summary>
|
||||
/// <param name="productName"></param>
|
||||
/// <returns></returns>
|
||||
public static ProductInfo GetProductInfo(string productName)
|
||||
{
|
||||
return GuruIAP.Instance?.GetInfo(productName) ?? null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品信息 (提供 ProductId)
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <returns></returns>
|
||||
public static ProductInfo GetProductInfoById(string productId)
|
||||
{
|
||||
return GuruIAP.Instance?.GetInfoById(productId) ?? null;
|
||||
}
|
||||
|
||||
|
||||
[Obsolete("Will be discarded in next version. Using GetProductInfoById(string productId) instead.")]
|
||||
public static ProductSetting GetProductSettingById(string productId)
|
||||
{
|
||||
var products = GuruSettings.Instance.Products;
|
||||
|
|
@ -71,6 +93,7 @@ namespace Guru
|
|||
return null;
|
||||
}
|
||||
|
||||
[Obsolete("Will be discarded in next version. Using GetProductInfo(string productName) instead.")]
|
||||
public static ProductSetting GetProductSetting(string productName)
|
||||
{
|
||||
var products = GuruSettings.Instance.Products;
|
||||
|
|
@ -91,6 +114,13 @@ namespace Guru
|
|||
return GuruIAP.Instance.IsProductHasReceipt(productName);
|
||||
}
|
||||
|
||||
|
||||
public static string GetProductLocalizedPriceString(string productName)
|
||||
{
|
||||
return GuruIAP.Instance.GetLocalizedPriceString(productName);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Purchase
|
||||
|
|
@ -118,7 +148,7 @@ namespace Guru
|
|||
/// <param name="purchaseCallback"></param>
|
||||
public static bool PurchaseById(string productId, Action<string, bool> purchaseCallback = null)
|
||||
{
|
||||
var productName = GetProductSettingById(productId)?.ProductName ?? "";
|
||||
var productName = GetProductInfoById(productId)?.Name ?? "";
|
||||
|
||||
if (CheckIAPReady() && !string.IsNullOrEmpty(productName))
|
||||
{
|
||||
|
|
@ -183,10 +213,16 @@ namespace Guru
|
|||
|
||||
#region Receipt
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取订单收据
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="receipt"></param>
|
||||
/// <param name="appleProductIsRestored"></param>
|
||||
private static void OnGetReceipt(string productId, string receipt, bool appleProductIsRestored = false)
|
||||
{
|
||||
var productName = GetProductSettingById(productId).ProductName;
|
||||
var productName = GetProductInfoById(productId)?.Name ?? "";
|
||||
if(!string.IsNullOrEmpty(productName))
|
||||
Model.AddReceipt(receipt, productName, productId, appleProductIsRestored);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue