update: 删除部分注释, 优化代码

deeplink
胡宇飞 2024-03-15 11:41:49 +08:00
parent f9acc5785b
commit a7d3a5147a
1 changed files with 5 additions and 7 deletions

View File

@ -7,7 +7,6 @@ namespace Guru
using UnityEngine.Purchasing.Security;
using System.Collections.Generic;
using Firebase.Crashlytics;
using Guru.LitJson;
public abstract class IAPServiceBase<T>: IStoreListener where T: IAPServiceBase<T> , new()
{
@ -505,7 +504,6 @@ namespace Guru
OnBuyEnd?.Invoke(productName, false);
return (T)this;
}
ProductInfo info = GetInfo(productName);
if (info == null)
{
@ -696,11 +694,11 @@ namespace Guru
int orderType = args.purchasedProduct.definition.type == ProductType.Subscription ? 1 : 0;
Debug.Log($"############ ReportPurchaseResult: _validator:{_validator }");
// Debug.Log($"############ ReportPurchaseResult: _validator:{_validator }");
if (_validator == null)
{
Debug.Log($"############ --- Validator is null");
// Debug.Log($"############ --- Validator is null");
LogE($"{Tag} --- Validator is null. Report Order failed.");
Crashlytics.LogException(new Exception($"IAPService can not report order because Validator is null!"));
return;
@ -714,7 +712,7 @@ namespace Guru
#if UNITY_EDITOR
// Editor 不做上报逻辑
// #elif UNITY_ANDROID
#elif UNITY_ANDROID
// Android 订单验证, 上报打点信息
var result = _validator.Validate(args.purchasedProduct.receipt);
string productID = orderType == 0 ? args.purchasedProduct.definition.id : "";
@ -730,7 +728,7 @@ namespace Guru
ReportGoogleOrder(orderType, productID, subscriptionID, google.purchaseToken, blevel);
}
}
// #elif UNITY_IOS
#elif UNITY_IOS
// iOS 订单验证, 上报打点信息
var jsonData = JsonMapper.ToObject(args.purchasedProduct.receipt);
string receipt = jsonData["Payload"].ToString();