damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 43cc3b6b6bb9ac5eb13359af1a5532cef86ef862
parent b367382aae192adc6625261e80b77a559dba8d23
Author: Joel Klabo <joelklabo@gmail.com>
Date:   Fri,  6 Jan 2023 16:08:25 -0800

Make NIP-05 Domain Tappable

Closes: #275
Changelog-Added: Make purple badges on profile page tappable

Diffstat:
Mdamus/Util/NIP05.swift | 4++++
Mdamus/Views/ProfileName.swift | 7+++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/damus/Util/NIP05.swift b/damus/Util/NIP05.swift @@ -15,6 +15,10 @@ struct NIP05 { URL(string: "https://\(host)/.well-known/nostr.json?name=\(username)") } + var siteUrl: URL? { + URL(string: "https://\(host)") + } + static func parse(_ nip05: String) -> NIP05? { let parts = nip05.split(separator: "@") guard parts.count == 2 else { diff --git a/damus/Views/ProfileName.swift b/damus/Views/ProfileName.swift @@ -34,6 +34,8 @@ struct ProfileName: View { @State var display_name: String? @State var nip05: NIP05? + @Environment(\.openURL) var openURL + init(pubkey: String, profile: Profile?, damus: DamusState, show_friend_confirmed: Bool) { self.pubkey = pubkey self.profile = profile @@ -72,6 +74,11 @@ struct ProfileName: View { .foregroundColor(nip05_color) Text(nip05.host) .foregroundColor(nip05_color) + .onTapGesture { + if let nip5url = nip05.siteUrl { + openURL(nip5url) + } + } } if let friend = friend_icon, current_nip05 == nil { Image(systemName: friend)