Hide the NIP-05 Domain in Follow List

Changelog-Chaged: Hide the NIP-05 Domain in Follow List
Closes: #267
This commit is contained in:
Joel Klabo
2023-01-05 19:23:07 -08:00
committed by William Casarin
parent 6bcea13d5a
commit 9e5209b48d
2 changed files with 16 additions and 10 deletions

View File

@@ -24,7 +24,7 @@ struct FollowUserView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
let profile = damus_state.profiles.lookup(id: target.pubkey) let profile = damus_state.profiles.lookup(id: target.pubkey)
ProfileName(pubkey: target.pubkey, profile: profile, damus: damus_state, show_friend_confirmed: false) ProfileName(pubkey: target.pubkey, profile: profile, damus: damus_state, show_friend_confirmed: false, show_nip5_domain: false)
if let about = profile?.about { if let about = profile?.about {
Text(FollowUserView.markdown.process(about)) Text(FollowUserView.markdown.process(about))
.lineLimit(3) .lineLimit(3)

View File

@@ -30,26 +30,29 @@ struct ProfileName: View {
let prefix: String let prefix: String
let show_friend_confirmed: Bool let show_friend_confirmed: Bool
let show_nip5_domain: Bool
@State var display_name: String? @State var display_name: String?
@State var nip05: NIP05? @State var nip05: NIP05?
@Environment(\.openURL) var openURL @Environment(\.openURL) var openURL
init(pubkey: String, profile: Profile?, damus: DamusState, show_friend_confirmed: Bool) { init(pubkey: String, profile: Profile?, damus: DamusState, show_friend_confirmed: Bool, show_nip5_domain: Bool = true) {
self.pubkey = pubkey self.pubkey = pubkey
self.profile = profile self.profile = profile
self.prefix = "" self.prefix = ""
self.show_friend_confirmed = show_friend_confirmed self.show_friend_confirmed = show_friend_confirmed
self.show_nip5_domain = show_nip5_domain
self.damus_state = damus self.damus_state = damus
} }
init(pubkey: String, profile: Profile?, prefix: String, damus: DamusState, show_friend_confirmed: Bool) { init(pubkey: String, profile: Profile?, prefix: String, damus: DamusState, show_friend_confirmed: Bool, show_nip5_domain: Bool = true) {
self.pubkey = pubkey self.pubkey = pubkey
self.profile = profile self.profile = profile
self.prefix = prefix self.prefix = prefix
self.damus_state = damus self.damus_state = damus
self.show_friend_confirmed = show_friend_confirmed self.show_friend_confirmed = show_friend_confirmed
self.show_nip5_domain = show_nip5_domain
} }
var friend_icon: String? { var friend_icon: String? {
@@ -72,13 +75,16 @@ struct ProfileName: View {
if let nip05 = current_nip05 { if let nip05 = current_nip05 {
Image(systemName: "checkmark.seal.fill") Image(systemName: "checkmark.seal.fill")
.foregroundColor(nip05_color) .foregroundColor(nip05_color)
Text(nip05.host)
.foregroundColor(nip05_color) if show_nip5_domain {
.onTapGesture { Text(nip05.host)
if let nip5url = nip05.siteUrl { .foregroundColor(nip05_color)
openURL(nip5url) .onTapGesture {
if let nip5url = nip05.siteUrl {
openURL(nip5url)
}
} }
} }
} }
if let friend = friend_icon, current_nip05 == nil { if let friend = friend_icon, current_nip05 == nil {
Image(systemName: friend) Image(systemName: friend)