Merge pull request #28122 from Ekischleki/Make-deletion-confirmation-less-confusing

Make deletion confirmation less confusing
This commit is contained in:
Dean Herbert 2024-05-09 14:40:30 +08:00 committed by GitHub
commit 7dc238d32c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 58 additions and 29 deletions

View File

@ -0,0 +1,44 @@
// 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.Localisation;
namespace osu.Game.Localisation
{
public static class DeleteConfirmationContentStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.DeleteConfirmationContent";
/// <summary>
/// "Are you sure you want to delete all beatmaps?"
/// </summary>
public static LocalisableString Beatmaps => new TranslatableString(getKey(@"beatmaps"), @"Are you sure you want to delete all beatmaps?");
/// <summary>
/// "Are you sure you want to delete all beatmaps videos? This cannot be undone!"
/// </summary>
public static LocalisableString BeatmapVideos => new TranslatableString(getKey(@"beatmap_videos"), @"Are you sure you want to delete all beatmaps videos? This cannot be undone!");
/// <summary>
/// "Are you sure you want to delete all skins? This cannot be undone!"
/// </summary>
public static LocalisableString Skins => new TranslatableString(getKey(@"skins"), @"Are you sure you want to delete all skins? This cannot be undone!");
/// <summary>
/// "Are you sure you want to delete all collections? This cannot be undone!"
/// </summary>
public static LocalisableString Collections => new TranslatableString(getKey(@"collections"), @"Are you sure you want to delete all collections? This cannot be undone!");
/// <summary>
/// "Are you sure you want to delete all scores? This cannot be undone!"
/// </summary>
public static LocalisableString Scores => new TranslatableString(getKey(@"collections"), @"Are you sure you want to delete all scores? This cannot be undone!");
/// <summary>
/// "Are you sure you want to delete all mod presets?"
/// </summary>
public static LocalisableString ModPresets => new TranslatableString(getKey(@"mod_presets"), @"Are you sure you want to delete all mod presets?");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -10,9 +10,9 @@ namespace osu.Game.Localisation
private const string prefix = @"osu.Game.Resources.Localisation.DeleteConfirmationDialog";
/// <summary>
/// "Confirm deletion of"
/// "Caution"
/// </summary>
public static LocalisableString HeaderText => new TranslatableString(getKey(@"header_text"), @"Confirm deletion of");
public static LocalisableString HeaderText => new TranslatableString(getKey(@"header_text"), @"Caution");
/// <summary>
/// "Yes. Go for it."

View File

@ -210,7 +210,7 @@ namespace osu.Game.Overlays.Dialog
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
TextAnchor = Anchor.TopCentre,
Padding = new MarginPadding { Horizontal = 5 },
Padding = new MarginPadding { Horizontal = 15 },
},
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
{
@ -219,7 +219,7 @@ namespace osu.Game.Overlays.Dialog
TextAnchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = 5 },
Padding = new MarginPadding { Horizontal = 15 },
},
buttonsContainer = new FillFlowContainer<PopupDialogButton>
{

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
deleteBeatmapsButton.Enabled.Value = false;
Task.Run(() => beatmaps.Delete()).ContinueWith(_ => Schedule(() => deleteBeatmapsButton.Enabled.Value = true));
}));
}, DeleteConfirmationContentStrings.Beatmaps));
}
});
@ -40,11 +40,11 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Text = MaintenanceSettingsStrings.DeleteAllBeatmapVideos,
Action = () =>
{
dialogOverlay?.Push(new MassVideoDeleteConfirmationDialog(() =>
dialogOverlay?.Push(new MassDeleteConfirmationDialog(() =>
{
deleteBeatmapVideosButton.Enabled.Value = false;
Task.Run(beatmaps.DeleteAllVideos).ContinueWith(_ => Schedule(() => deleteBeatmapVideosButton.Enabled.Value = true));
}));
}, DeleteConfirmationContentStrings.BeatmapVideos));
}
});
AddRange(new Drawable[]

View File

@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Text = MaintenanceSettingsStrings.DeleteAllCollections,
Action = () =>
{
dialogOverlay?.Push(new MassDeleteConfirmationDialog(deleteAllCollections));
dialogOverlay?.Push(new MassDeleteConfirmationDialog(deleteAllCollections, DeleteConfirmationContentStrings.Collections));
}
});
}

View File

@ -2,15 +2,16 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public partial class MassDeleteConfirmationDialog : DangerousActionDialog
{
public MassDeleteConfirmationDialog(Action deleteAction)
public MassDeleteConfirmationDialog(Action deleteAction, LocalisableString deleteContent)
{
BodyText = "Everything?";
BodyText = deleteContent;
DangerousAction = deleteAction;
}
}

View File

@ -1,16 +0,0 @@
// 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;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public partial class MassVideoDeleteConfirmationDialog : MassDeleteConfirmationDialog
{
public MassVideoDeleteConfirmationDialog(Action deleteAction)
: base(deleteAction)
{
BodyText = "All beatmap videos? This cannot be undone!";
}
}
}

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
deleteAllButton.Enabled.Value = false;
Task.Run(deleteAllModPresets).ContinueWith(t => Schedule(onAllModPresetsDeleted, t));
}));
}, DeleteConfirmationContentStrings.ModPresets));
}
},
undeleteButton = new SettingsButton

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
deleteScoresButton.Enabled.Value = false;
Task.Run(() => scores.Delete()).ContinueWith(_ => Schedule(() => deleteScoresButton.Enabled.Value = true));
}));
}, DeleteConfirmationContentStrings.Scores));
}
});
}

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
deleteSkinsButton.Enabled.Value = false;
Task.Run(() => skins.Delete()).ContinueWith(_ => Schedule(() => deleteSkinsButton.Enabled.Value = true));
}));
}, DeleteConfirmationContentStrings.Skins));
}
});
}