Allow bundled downloader to not post notifications

This commit is contained in:
Dean Herbert 2022-04-28 18:57:41 +09:00
parent 88bfd5dece
commit 804848c9fb
1 changed files with 11 additions and 2 deletions

View File

@ -19,6 +19,8 @@ namespace osu.Game.Beatmaps.Drawables
{
public class BundledBeatmapDownloader : CompositeDrawable
{
private readonly bool shouldPostNotifications;
public IEnumerable<BeatmapDownloadTracker> DownloadTrackers => downloadTrackers;
private readonly List<BeatmapDownloadTracker> downloadTrackers = new List<BeatmapDownloadTracker>();
@ -27,8 +29,15 @@ public class BundledBeatmapDownloader : CompositeDrawable
private BundledBeatmapModelDownloader beatmapDownloader;
public BundledBeatmapDownloader(bool onlyTutorial)
/// <summary>
/// Construct a new beatmap downloader.
/// </summary>
/// <param name="onlyTutorial">Whether only the tutorial should be downloaded, instead of bundled beatmaps.</param>
/// <param name="shouldPostNotifications">Whether downloads should create tracking notifications.</param>
public BundledBeatmapDownloader(bool onlyTutorial, bool shouldPostNotifications = false)
{
this.shouldPostNotifications = shouldPostNotifications;
if (onlyTutorial)
{
queueDownloads(new[] { tutorial_filename });
@ -48,7 +57,7 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
localDependencies.CacheAs<BeatmapModelDownloader>(beatmapDownloader = new BundledBeatmapModelDownloader(parent.Get<BeatmapManager>(), parent.Get<IAPIProvider>()));
if (parent.Get<INotificationOverlay>() is INotificationOverlay notifications)
if (shouldPostNotifications && parent.Get<INotificationOverlay>() is INotificationOverlay notifications)
beatmapDownloader.PostNotification = notifications.Post;
return localDependencies;