Merge pull request #24588 from ItsShamed/ux/notifications/flash-on-message

Flash taskbar when receiving notifications while the game is not focused
This commit is contained in:
Dean Herbert 2023-08-22 16:44:16 +09:00 committed by GitHub
commit 36ebdd8d30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -182,8 +182,6 @@ protected HighlightMessageNotification(Message message, Channel channel)
private readonly Message message;
private readonly Channel channel;
public override bool IsImportant => false;
[BackgroundDependencyLoader]
private void load(OsuColour colours, ChatOverlay chatOverlay, INotificationOverlay notificationOverlay)
{

View File

@ -43,6 +43,9 @@ public partial class NotificationOverlay : OsuFocusedOverlayContainer, INamedOve
[Resolved]
private AudioManager audio { get; set; } = null!;
[Resolved]
private OsuGame? game { get; set; }
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
@ -176,6 +179,12 @@ public void Post(Notification notification) => postScheduler.Add(() =>
playDebouncedSample(notification.PopInSampleName);
if (notification.IsImportant)
{
game?.Window?.Flash();
notification.Closed += () => game?.Window?.CancelFlash();
}
if (State.Value == Visibility.Hidden)
{
notification.IsInToastTray = true;