1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-03 02:31:25 +08:00

Replace local osd and clipboard method with existing game method

This commit is contained in:
Joseph Madamba
2025-11-22 17:06:04 -08:00
Unverified
parent d0e09e5b5c
commit b6ccc8cae4
+2 -13
View File
@@ -20,13 +20,11 @@ using System.Collections.Specialized;
using System.Diagnostics;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Comments.Buttons;
using osu.Game.Overlays.Dialog;
using osu.Game.Overlays.OSD;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
@@ -83,10 +81,7 @@ namespace osu.Game.Overlays.Comments
private IAPIProvider api { get; set; } = null!;
[Resolved]
private Clipboard clipboard { get; set; } = null!;
[Resolved]
private OnScreenDisplay? onScreenDisplay { get; set; }
private OsuGame? game { get; set; }
public DrawableComment(Comment comment, IReadOnlyList<CommentableMeta> meta)
{
@@ -329,7 +324,7 @@ namespace osu.Game.Overlays.Comments
if (WasDeleted)
makeDeleted();
actionsContainer.AddLink(CommonStrings.ButtonsPermalink, copyUrl);
actionsContainer.AddLink(CommonStrings.ButtonsPermalink, () => game?.CopyToClipboard($@"{api.Endpoints.APIUrl}/comments/{Comment.Id}"));
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
actionsContainer.AddLink(CommonStrings.ButtonsReply.ToLower(), toggleReply);
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
@@ -417,12 +412,6 @@ namespace osu.Game.Overlays.Comments
api.Queue(request);
}
private void copyUrl()
{
clipboard.SetText($@"{api.Endpoints.APIUrl}/comments/{Comment.Id}");
onScreenDisplay?.Display(new CopiedToClipboardToast());
}
private void toggleReply()
{
if (replyEditorContainer.Count == 0)