diff --git a/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs b/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs
index 87c023f..1d53465 100644
--- a/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs
+++ b/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs
@@ -57,7 +57,7 @@ namespace Guru
///
/// 恢复购买回调
///
- public event Action OnRestored;
+ public event Action OnRestored;
public event Action OnBuyStart;
public event Action OnBuyEnd;
@@ -130,9 +130,6 @@ namespace Guru
Initialize(showLog);
}
-
-
-
///
/// 初始化支付插件
///
@@ -425,10 +422,28 @@ namespace Guru
/// 恢复购买
///
///
- protected virtual void OnRestoreHandle(bool success)
+ ///
+ protected virtual void OnRestoreHandle(bool success, string msg)
{
- LogI($"--- Restore complete: {success}" );
- OnRestored?.Invoke(success);
+ LogI($"--- Restore complete: {success}: msg:{msg}" );
+
+
+ if (success)
+ {
+ bool isIAPUser = false;
+ // 扫描所有商品, 追加用户属性
+ for (int i = 0; i < _storeController.products.all.Length; i++)
+ {
+ var product = _storeController.products.all[i];
+ if (product.hasReceipt)
+ {
+ isIAPUser = true;
+ }
+ }
+ SetIsIAPUser(isIAPUser);
+ }
+
+ OnRestored?.Invoke(success, msg);
}
///
@@ -444,6 +459,7 @@ namespace Guru
_googlePlayStoreExtensions.RestoreTransactions(OnRestoreHandle);
#endif
}
+
#endregion
@@ -513,6 +529,8 @@ namespace Guru
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); // 设置用户属性标记
}
PurchaseCount++; // 记录支付次数
@@ -749,6 +767,19 @@ namespace Guru
#endregion
+ #region 用户标志位设置
+
+ ///
+ /// 标记是否为付费用户
+ ///
+ ///
+ public static void SetIsIAPUser(bool value = true)
+ {
+ Analytics.SetUserProperty(Analytics.PropertyIsIAPUser, value ? "true" : "false");
+ }
+
+
+ #endregion
}
}
\ No newline at end of file