nip05: remove clickable option

they're always clickable now
This commit is contained in:
William Casarin
2023-07-17 11:24:33 -07:00
parent 12febf9671
commit 5c87dd5bbb
2 changed files with 12 additions and 21 deletions

View File

@@ -12,16 +12,14 @@ struct NIP05Badge: View {
let pubkey: String let pubkey: String
let contacts: Contacts let contacts: Contacts
let show_domain: Bool let show_domain: Bool
let clickable: Bool
@Environment(\.openURL) var openURL @Environment(\.openURL) var openURL
init(nip05: NIP05, pubkey: String, contacts: Contacts, show_domain: Bool, clickable: Bool) { init(nip05: NIP05, pubkey: String, contacts: Contacts, show_domain: Bool) {
self.nip05 = nip05 self.nip05 = nip05
self.pubkey = pubkey self.pubkey = pubkey
self.contacts = contacts self.contacts = contacts
self.show_domain = show_domain self.show_domain = show_domain
self.clickable = clickable
} }
var nip05_color: Bool { var nip05_color: Bool {
@@ -54,23 +52,16 @@ struct NIP05Badge: View {
var body: some View { var body: some View {
HStack(spacing: 2) { HStack(spacing: 2) {
Seal Seal
if show_domain { if show_domain {
if clickable { Text(nip05_string)
Text(nip05_string) .nip05_colorized(gradient: nip05_color)
.nip05_colorized(gradient: nip05_color) .onTapGesture {
.onTapGesture { if let nip5url = nip05.siteUrl {
if let nip5url = nip05.siteUrl { openURL(nip5url)
openURL(nip5url)
}
} }
} else { }
Text(nip05_string)
.foregroundColor(.gray)
}
} }
} }
@@ -96,13 +87,13 @@ struct NIP05Badge_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
let test_state = test_damus_state() let test_state = test_damus_state()
VStack { VStack {
NIP05Badge(nip05: NIP05(username: "jb55", host: "jb55.com"), pubkey: test_state.pubkey, contacts: test_state.contacts, show_domain: true, clickable: true) NIP05Badge(nip05: NIP05(username: "jb55", host: "jb55.com"), pubkey: test_state.pubkey, contacts: test_state.contacts, show_domain: true)
NIP05Badge(nip05: NIP05(username: "_", host: "jb55.com"), pubkey: test_state.pubkey, contacts: test_state.contacts, show_domain: true, clickable: true) NIP05Badge(nip05: NIP05(username: "_", host: "jb55.com"), pubkey: test_state.pubkey, contacts: test_state.contacts, show_domain: true)
NIP05Badge(nip05: NIP05(username: "jb55", host: "jb55.com"), pubkey: test_state.pubkey, contacts: test_state.contacts, show_domain: true, clickable: false) NIP05Badge(nip05: NIP05(username: "jb55", host: "jb55.com"), pubkey: test_state.pubkey, contacts: test_state.contacts, show_domain: true)
NIP05Badge(nip05: NIP05(username: "jb55", host: "jb55.com"), pubkey: test_state.pubkey, contacts: Contacts(our_pubkey: "sdkfjsdf"), show_domain: true, clickable: false) NIP05Badge(nip05: NIP05(username: "jb55", host: "jb55.com"), pubkey: test_state.pubkey, contacts: Contacts(our_pubkey: "sdkfjsdf"), show_domain: true)
} }
} }
} }

View File

@@ -85,7 +85,7 @@ struct ProfileName: View {
.font(.body) .font(.body)
.fontWeight(prefix == "@" ? .none : .bold) .fontWeight(prefix == "@" ? .none : .bold)
if let nip05 = current_nip05 { if let nip05 = current_nip05 {
NIP05Badge(nip05: nip05, pubkey: pubkey, contacts: damus_state.contacts, show_domain: show_nip5_domain, clickable: true) NIP05Badge(nip05: nip05, pubkey: pubkey, contacts: damus_state.contacts, show_domain: show_nip5_domain)
} }
if let friend = friend_type, current_nip05 == nil { if let friend = friend_type, current_nip05 == nil {
FriendIcon(friend: friend) FriendIcon(friend: friend)