mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Remove CollectionManager
This commit is contained in:
@ -3,9 +3,10 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
{
|
||||
@ -15,11 +16,15 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
|
||||
private SettingsButton importCollectionsButton = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(CollectionManager? collectionManager, LegacyImportManager? legacyImportManager, IDialogOverlay? dialogOverlay)
|
||||
{
|
||||
if (collectionManager == null) return;
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private INotificationOverlay notificationOverlay { get; set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LegacyImportManager? legacyImportManager, IDialogOverlay? dialogOverlay)
|
||||
{
|
||||
if (legacyImportManager?.SupportsImportFromStable == true)
|
||||
{
|
||||
Add(importCollectionsButton = new SettingsButton
|
||||
@ -38,9 +43,15 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
Text = MaintenanceSettingsStrings.DeleteAllCollections,
|
||||
Action = () =>
|
||||
{
|
||||
dialogOverlay?.Push(new MassDeleteConfirmationDialog(collectionManager.DeleteAll));
|
||||
dialogOverlay?.Push(new MassDeleteConfirmationDialog(deleteAllCollections));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void deleteAllCollections()
|
||||
{
|
||||
realm.Write(r => r.RemoveAll<RealmBeatmapCollection>());
|
||||
notificationOverlay.Post(new ProgressCompletionNotification { Text = "Deleted all collections!" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user