fix: 修复 Android 支付初始化 Restore 后触发订单上报的 BUG
parent
203263769e
commit
9c3795227c
|
|
@ -31,6 +31,8 @@ namespace Guru
|
|||
protected Dictionary<string, ProductInfo> Products => _products;
|
||||
|
||||
public bool IsInitialized => _storeController != null && _storeExtensionProvider != null;
|
||||
|
||||
private Product _curPurchasingProduct = null;
|
||||
|
||||
/// <summary>
|
||||
/// 是否是首次购买
|
||||
|
|
@ -520,6 +522,8 @@ namespace Guru
|
|||
Analytics.IAPClick(info?.Category??"none", product.definition.id);
|
||||
Analytics.IAPImp(DefaultCategory, product.definition.id);
|
||||
|
||||
_curPurchasingProduct = product;
|
||||
|
||||
OnBuyStart?.Invoke(productName);
|
||||
return (T)this;
|
||||
}
|
||||
|
|
@ -556,8 +560,12 @@ namespace Guru
|
|||
|
||||
PurchaseCount++; // 记录支付次数
|
||||
Debug.Log($"############ ProcessPurchase: PurchaseCount:{PurchaseCount}");
|
||||
ReportPurchaseResult(purchaseEvent); // 支付结果上报
|
||||
|
||||
if (_curPurchasingProduct != null)
|
||||
{
|
||||
_curPurchasingProduct = null; // 只有实际发生购买后才会有订单上报. 启动时的 Restore 操作自动调用支付成功. 这里做一个判定, 过滤掉订单的物品
|
||||
ReportPurchaseResult(purchaseEvent); // 支付结果上报
|
||||
}
|
||||
|
||||
var pp = purchaseEvent.purchasedProduct;
|
||||
if ( pp == null || string.IsNullOrEmpty(pp.receipt))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue