1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 10:47:45 +08:00

43 lines
1.4 KiB
C#
Raw Normal View History

2022-06-22 13:02:33 +09:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Game.Collections;
using osu.Game.Database;
using osu.Game.Localisation;
2022-07-27 15:59:36 +09:00
using osu.Game.Overlays.Notifications;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
2022-11-24 14:32:20 +09:00
public partial class CollectionsSettings : SettingsSubsection
{
2022-09-16 21:08:25 +09:00
protected override LocalisableString Header => CommonStrings.Collections;
2022-07-27 15:59:36 +09:00
[Resolved]
private RealmAccess realm { get; set; } = null!;
[Resolved]
private INotificationOverlay? notificationOverlay { get; set; }
2022-07-27 15:59:36 +09:00
2022-06-22 13:07:44 +09:00
[BackgroundDependencyLoader]
private void load(IDialogOverlay? dialogOverlay)
{
2022-06-21 23:41:25 +01:00
Add(new DangerousSettingsButton
{
Text = MaintenanceSettingsStrings.DeleteAllCollections,
Action = () =>
{
2022-07-27 15:59:36 +09:00
dialogOverlay?.Push(new MassDeleteConfirmationDialog(deleteAllCollections));
2022-06-21 23:41:25 +01:00
}
});
}
2022-07-27 15:59:36 +09:00
private void deleteAllCollections()
{
realm.Write(r => r.RemoveAll<BeatmapCollection>());
2022-09-16 18:31:02 +09:00
notificationOverlay?.Post(new ProgressCompletionNotification { Text = MaintenanceSettingsStrings.DeletedAllCollections });
2022-07-27 15:59:36 +09:00
}
}
}