Fix: 修复恢复购买后, 由于调用了ProcessPurchase 回调而上报了预期外的 iap_ret_true 和 first_iap 等事件
parent
6169adbcdb
commit
3ef3807253
|
|
@ -547,22 +547,20 @@ namespace Guru
|
|||
string productId = purchaseEvent.purchasedProduct.definition.id;
|
||||
ProductInfo info = GetInfoById(productId);
|
||||
bool success = false;
|
||||
|
||||
string productName = "";
|
||||
if (null != info)
|
||||
{
|
||||
if (IsFirstIAP) Analytics.FirstIAP(info.Id, info.Price, info.CurrencyCode); // 上报首次支付打点
|
||||
Analytics.ProductIAP(info.Id,info.Id, info.Price, info.CurrencyCode);
|
||||
Analytics.IAPRetTrue(info.Category, info.Id, info.Price, info.CurrencyCode, info.Type, info.IsFree);
|
||||
success = true;
|
||||
|
||||
SetIsIAPUser(success); // 设置用户属性标记
|
||||
}
|
||||
|
||||
productName = info.Name;
|
||||
PurchaseCount++; // 记录支付次数
|
||||
Debug.Log($"############ ProcessPurchase: PurchaseCount:{PurchaseCount}");
|
||||
if (_curPurchasingProduct != null)
|
||||
{
|
||||
_curPurchasingProduct = null; // 只有实际发生购买后才会有订单上报. 启动时的 Restore 操作自动调用支付成功. 这里做一个判定, 过滤掉订单的物品
|
||||
|
||||
if (IsFirstIAP) Analytics.FirstIAP(info.Id, info.Price, info.CurrencyCode); // 上报首次支付打点
|
||||
Analytics.ProductIAP(info.Id,info.Id, info.Price, info.CurrencyCode);
|
||||
Analytics.IAPRetTrue(info.Category, info.Id, info.Price, info.CurrencyCode, info.Type, info.IsFree);
|
||||
ReportPurchaseResult(purchaseEvent); // 支付结果上报
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +576,9 @@ namespace Guru
|
|||
OnGetProductReceipt?.Invoke(pp.definition.id, pp.receipt, pp.appleProductIsRestored);
|
||||
}
|
||||
|
||||
string productName = info?.Name ?? "NULL";
|
||||
SetIsIAPUser(success); // 设置用户属性标记
|
||||
}
|
||||
|
||||
LogI($"{Tag} --- OnPurchaseSuccess :: purchase count: {PurchaseCount} productName: {productName}");
|
||||
|
||||
OnPurchaseOver(success, productName); // 支付成功处理逻辑
|
||||
|
|
|
|||
Loading…
Reference in New Issue