update: 添加Restore 回调
parent
09cf293d2e
commit
0bcda4f915
|
|
@ -114,13 +114,6 @@ namespace Guru
|
|||
/// </summary>
|
||||
public static class Remote
|
||||
{
|
||||
internal static Action _onRemoteInitComplete;
|
||||
public static event Action OnRemoteInitComplete
|
||||
{
|
||||
add => _onRemoteInitComplete += value;
|
||||
remove => _onRemoteInitComplete -= value;
|
||||
}
|
||||
|
||||
internal static Action<bool> _onRemoteFetchComplete;
|
||||
public static event Action<bool> OnRemoteFetchComplete
|
||||
{
|
||||
|
|
@ -155,6 +148,14 @@ namespace Guru
|
|||
remove => _onPurchaseFailed -= value;
|
||||
}
|
||||
|
||||
internal static Action<bool, string> _onIAPRestored;
|
||||
public static event Action<bool, string> OnIAPRestored
|
||||
{
|
||||
add => _onIAPRestored += value;
|
||||
remove => _onIAPRestored -= value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,22 +162,21 @@ namespace Guru
|
|||
|
||||
#region Restore Purchase
|
||||
|
||||
private static Action<bool> _onRestored;
|
||||
/// <summary>
|
||||
/// 恢复购买
|
||||
/// </summary>
|
||||
/// <param name="restoreCallback"></param>
|
||||
public static void Restore(Action<bool> restoreCallback)
|
||||
public static void Restore(Action<bool, string> restoreCallback = null)
|
||||
{
|
||||
if( restoreCallback != null) Callbacks.IAP.OnIAPRestored += restoreCallback;
|
||||
if (CheckIAPReady())
|
||||
{
|
||||
_onRestored = restoreCallback;
|
||||
GuruIAP.Instance.Restore();
|
||||
}
|
||||
}
|
||||
private static void OnRestored(bool success)
|
||||
private static void OnRestored(bool success, string msg)
|
||||
{
|
||||
_onRestored?.Invoke(success);
|
||||
Callbacks.IAP._onIAPRestored?.Invoke(success, msg); // 更新回复购买回调
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Reference in New Issue