Add popupdialog button to copy url

This commit is contained in:
Andrew Hong 2022-08-24 02:54:24 -04:00
parent 51e607e834
commit b24513038c
2 changed files with 7 additions and 2 deletions

View File

@ -32,7 +32,7 @@ namespace osu.Game.Online.Chat
public void OpenUrlExternally(string url, bool bypassWarning = false)
{
if (!bypassWarning && externalLinkWarning.Value)
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url)));
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => host.GetClipboard().SetText(url)));
else
host.OpenUrlExternally(url);
}

View File

@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Chat
{
public class ExternalLinkDialog : PopupDialog
{
public ExternalLinkDialog(string url, Action openExternalLinkAction)
public ExternalLinkDialog(string url, Action openExternalLinkAction, Action copyExternalLinkAction)
{
HeaderText = "Just checking...";
BodyText = $"You are about to leave osu! and open the following link in a web browser:\n\n{url}";
@ -25,6 +25,11 @@ namespace osu.Game.Overlays.Chat
Text = @"Yes. Go for it.",
Action = openExternalLinkAction
},
new PopupDialogOkButton
{
Text = @"No! Copy the URL instead!",
Action = copyExternalLinkAction
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!"