// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Overlays.Notifications; namespace osu.Game.Overlays { /// /// An overlay which is capable of showing notifications to the user. /// [Cached] public interface INotificationOverlay { /// /// Post a new notification for display. /// /// The notification to display. void Post(Notification notification); /// /// Hide the overlay, if it is currently visible. /// void Hide(); /// /// Current number of unread notifications. /// IBindable UnreadCount { get; } /// /// Whether there are any ongoing operations, such as imports or downloads. /// public bool HasOngoingOperations => OngoingOperations.Any(); /// /// All current displayed notifications, whether in the toast tray or a section. /// IEnumerable AllNotifications { get; } /// /// All ongoing operations (ie. any not in a completed or cancelled state). /// public IEnumerable OngoingOperations => AllNotifications.OfType().Where(p => p.Ongoing); } }