1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Fix unread count potentially missing notifications in a transforming state

This commit is contained in:
Dean Herbert 2022-08-31 12:46:43 +09:00
parent 0558dae917
commit 7c72c6b43f
2 changed files with 10 additions and 9 deletions

View File

@ -222,16 +222,16 @@ namespace osu.Game.Overlays
}
}
private void updateCounts()
{
unreadCount.Value = sections.Select(c => c.UnreadCount).Sum() + toastTray.UnreadCount;
}
private void markAllRead()
{
sections.Children.ForEach(s => s.MarkAllRead());
toastTray.MarkAllRead();
updateCounts();
}
private void updateCounts()
{
unreadCount.Value = sections.Select(c => c.UnreadCount).Sum() + toastTray.UnreadCount;
}
}
}

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
@ -32,7 +33,8 @@ namespace osu.Game.Overlays
public Action<Notification>? ForwardNotificationToPermanentStore { get; set; }
public int UnreadCount => toastFlow.Count(n => !n.WasClosed && !n.Read);
public int UnreadCount => toastFlow.Count(n => !n.WasClosed && !n.Read)
+ InternalChildren.OfType<Notification>().Count(n => !n.WasClosed && !n.Read);
private int runningDepth;
@ -64,7 +66,7 @@ namespace osu.Game.Overlays
postEffectDrawable.AutoSizeAxes = Axes.None;
postEffectDrawable.RelativeSizeAxes = Axes.X;
})),
toastFlow = new FillFlowContainer<Notification>
toastFlow = new AlwaysUpdateFillFlowContainer<Notification>
{
LayoutDuration = 150,
LayoutEasing = Easing.OutQuart,
@ -84,9 +86,7 @@ namespace osu.Game.Overlays
public void FlushAllToasts()
{
foreach (var notification in toastFlow.ToArray())
{
forwardNotification(notification);
}
}
public void Post(Notification notification)
@ -125,6 +125,7 @@ namespace osu.Game.Overlays
{
Debug.Assert(notification.Parent == toastFlow);
// Temporarily remove from flow so we can animate the position off to the right.
toastFlow.Remove(notification);
AddInternal(notification);