Fix beatmap restore/undelete flows

This commit is contained in:
Dean Herbert
2022-01-11 23:04:36 +09:00
parent 46206f70d6
commit 72656ae01e
2 changed files with 21 additions and 23 deletions

View File

@ -1,7 +1,6 @@
// 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 System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Allocation;
@ -106,10 +105,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
dialogOverlay?.Push(new MassDeleteConfirmationDialog(() =>
{
deleteSkinsButton.Enabled.Value = false;
Task.Run(() =>
{
skins.Delete();
}).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
Task.Run(() => skins.Delete()).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true));
}));
}
});
@ -147,11 +143,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Action = () =>
{
restoreButton.Enabled.Value = false;
Task.Run(() =>
{
foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden).ToList())
beatmaps.Restore(b);
}).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
Task.Run(beatmaps.RestoreAll).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
}
},
undeleteButton = new SettingsButton
@ -160,8 +152,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Action = () =>
{
undeleteButton.Enabled.Value = false;
// TODO: reimplement similar to SkinManager?
// Task.Run(() => beatmaps.Undelete(beatmaps.QueryBeatmapSets(b => b.DeletePending).ToList())).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
Task.Run(beatmaps.UndeleteAll).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
}
},
});