Fix notification toast tray potentially hiding some notifications

This commit is contained in:
Salman Ahmed 2024-07-10 16:15:02 +03:00
parent 8ca8648a09
commit 846fd73ac9

View File

@ -24,16 +24,16 @@ namespace osu.Game.Overlays
/// </summary>
public partial class NotificationOverlayToastTray : CompositeDrawable
{
public override bool IsPresent => toastContentBackground.Height > 0 || toastFlow.Count > 0;
public override bool IsPresent => toastContentBackground.Height > 0 || Notifications.Any();
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => toastFlow.ReceivePositionalInputAt(screenSpacePos);
/// <summary>
/// All notifications currently being displayed by the toast tray.
/// </summary>
public IEnumerable<Notification> Notifications => toastFlow;
public IEnumerable<Notification> Notifications => toastFlow.Concat(InternalChildren.OfType<Notification>());
public bool IsDisplayingToasts => toastFlow.Count > 0;
public bool IsDisplayingToasts => Notifications.Any();
private FillFlowContainer<Notification> toastFlow = null!;
private BufferedContainer toastContentBackground = null!;
@ -43,12 +43,7 @@ namespace osu.Game.Overlays
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
public int UnreadCount => allDisplayedNotifications.Count(n => !n.WasClosed && !n.Read);
/// <summary>
/// Notifications contained in the toast flow, or in a detached state while they animate during forwarding to the main overlay.
/// </summary>
private IEnumerable<Notification> allDisplayedNotifications => toastFlow.Concat(InternalChildren.OfType<Notification>());
public int UnreadCount => Notifications.Count(n => !n.WasClosed && !n.Read);
private int runningDepth;
@ -91,11 +86,7 @@ namespace osu.Game.Overlays
};
}
public void MarkAllRead()
{
toastFlow.Children.ForEach(n => n.Read = true);
InternalChildren.OfType<Notification>().ForEach(n => n.Read = true);
}
public void MarkAllRead() => Notifications.ForEach(n => n.Read = true);
public void FlushAllToasts()
{