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