Display text in buttons flow instead of toast

This commit is contained in:
ansel 2022-10-21 17:25:41 +03:00
parent 81bdf716ef
commit 15aeb4a137
2 changed files with 8 additions and 12 deletions

View File

@ -276,7 +276,6 @@ namespace osu.Game.Tests.Visual.Online
AddStep("Complete request", () => requestLock.Set());
AddUntilStep("Request sent", () => request != null);
AddAssert("Request is correct", () => request != null && request.CommentID == 2 && request.Comment == report_text && request.Reason == CommentReportReason.Other);
AddUntilStep("Button expired", () => !targetComment.ChildrenOfType<DrawableComment.ReportButton>().Any());
}
private void addTestComments()

View File

@ -24,7 +24,6 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Comments.Buttons;
@ -426,9 +425,8 @@ namespace osu.Game.Overlays.Comments
request.Success += () => Schedule(() =>
{
actionsLoading.Hide();
reportButton?.Expire();
reportButton?.MarkReported();
actionsContainer.Show();
onScreenDisplay?.Display(new ReportToast());
});
request.Failure += _ => Schedule(() =>
{
@ -586,14 +584,6 @@ namespace osu.Game.Overlays.Comments
}
}
private class ReportToast : Toast
{
public ReportToast()
: base(UserInterfaceStrings.GeneralHeader, UsersStrings.ReportThanks, "")
{
}
}
internal class ReportButton : LinkFlowContainer, IHasPopover
{
public ReportButton()
@ -611,6 +601,13 @@ namespace osu.Game.Overlays.Comments
AddLink(UsersStrings.ReportButtonText, this.ShowPopover);
}
public void MarkReported()
{
Clear(true);
AddText(UsersStrings.ReportThanks);
this.Delay(3000).Then().FadeOut(2000);
}
public Popover GetPopover() => new ReportCommentPopover(comment);
}
}