Skip to content

Commit

Permalink
add modalId overload
Browse files Browse the repository at this point in the history
  • Loading branch information
adarapata committed Apr 15, 2024
1 parent 4d2ffac commit a387db3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Assets/ScreenSystem/Runtime/Modal/ModalManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ private async UniTaskVoid PushAndForgetInternal(IModalBuilder builder)
}

public async UniTask Pop(bool playAnimation, CancellationToken cancellationToken)
{
await PopInternal(playAnimation, cancellationToken);
}

public async UniTask Pop(IModal modal, bool playAnimation, CancellationToken cancellationToken)
{
await PopInternal(playAnimation, cancellationToken, modal.ModalId);
}

private async UniTask PopInternal(bool playAnimation, CancellationToken cancellationToken, string modalId = null)
{
if (ModalTransitionScope.IsModalTransition)
{
Expand All @@ -99,7 +109,7 @@ public async UniTask Pop(bool playAnimation, CancellationToken cancellationToken
using var scope = ModalTransitionScope.Transition();
if (_modalContainer.Modals.Any())
{
var handle = _modalContainer.Pop(playAnimation);
var handle = string.IsNullOrEmpty(modalId) ? _modalContainer.Pop(playAnimation) : _modalContainer.Pop(playAnimation, modalId);
await handle.WithCancellation(cancellationToken);
}
}
Expand Down

0 comments on commit a387db3

Please sign in to comment.