update: 添加Restore 回调
parent
09cf293d2e
commit
0bcda4f915
|
|
@ -114,13 +114,6 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Remote
|
public static class Remote
|
||||||
{
|
{
|
||||||
internal static Action _onRemoteInitComplete;
|
|
||||||
public static event Action OnRemoteInitComplete
|
|
||||||
{
|
|
||||||
add => _onRemoteInitComplete += value;
|
|
||||||
remove => _onRemoteInitComplete -= value;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Action<bool> _onRemoteFetchComplete;
|
internal static Action<bool> _onRemoteFetchComplete;
|
||||||
public static event Action<bool> OnRemoteFetchComplete
|
public static event Action<bool> OnRemoteFetchComplete
|
||||||
{
|
{
|
||||||
|
|
@ -154,6 +147,14 @@ namespace Guru
|
||||||
add => _onPurchaseFailed += value;
|
add => _onPurchaseFailed += value;
|
||||||
remove => _onPurchaseFailed -= value;
|
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
|
#region Restore Purchase
|
||||||
|
|
||||||
private static Action<bool> _onRestored;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 恢复购买
|
/// 恢复购买
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="restoreCallback"></param>
|
/// <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())
|
if (CheckIAPReady())
|
||||||
{
|
{
|
||||||
_onRestored = restoreCallback;
|
|
||||||
GuruIAP.Instance.Restore();
|
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
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue