From 8964a5941e2e69707ab9bc22265528270eff2c7d Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sun, 25 Dec 2022 20:28:58 -0800 Subject: [PATCH] lightning: long press/right click to copy lnurl Changelog-Added: Long press lightning tip button to copy lnurl --- damus/Views/ProfileView.swift | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift index 4b0ccf82..c5be608e 100644 --- a/damus/Views/ProfileView.swift +++ b/damus/Views/ProfileView.swift @@ -124,7 +124,7 @@ struct ProfileView: View { //@EnvironmentObject var profile: ProfileModel - func LNButton(_ url: URL) -> some View { + func LNButton(_ url: URL, profile: Profile) -> some View { Button(action: { UIApplication.shared.open(url) }) { @@ -132,6 +132,13 @@ struct ProfileView: View { .symbolRenderingMode(.palette) .font(.system(size: 34).weight(.thin)) .foregroundStyle(colorScheme == .light ? .black : .white, colorScheme == .light ? .black.opacity(0.1) : .white.opacity(0.2)) + .contextMenu { + Button { + UIPasteboard.general.string = profile.lnurl ?? "" + } label: { + Label("Copy LNUrl", systemImage: "doc.on.doc") + } + } } } @@ -156,8 +163,10 @@ struct ProfileView: View { Spacer() - if let lnuri = data?.lightning_uri { - LNButton(lnuri) + if let profile = data { + if let lnuri = profile.lightning_uri { + LNButton(lnuri, profile: profile) + } } DMButton