commit 8964a5941e2e69707ab9bc22265528270eff2c7d
parent 29915aa8fe9f4d2baeab830317e87581fc079817
Author: William Casarin <jb55@jb55.com>
Date: Sun, 25 Dec 2022 20:28:58 -0800
lightning: long press/right click to copy lnurl
Changelog-Added: Long press lightning tip button to copy lnurl
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git 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