Browse Source

Hide the NIP-05 Domain in Follow List

Changelog-Chaged: Hide the NIP-05 Domain in Follow List
Closes: #267
translations_damus-localizations-en-us-xcloc-localized-contents-en-us-xliff--master_es_419
Joel Klabo 2 years ago
committed by William Casarin
parent
commit
9e5209b48d
  1. 2
      damus/Views/FollowingView.swift
  2. 24
      damus/Views/ProfileName.swift

2
damus/Views/FollowingView.swift

@ -24,7 +24,7 @@ struct FollowUserView: View {
VStack(alignment: .leading) {
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 {
Text(FollowUserView.markdown.process(about))
.lineLimit(3)

24
damus/Views/ProfileName.swift

@ -30,26 +30,29 @@ struct ProfileName: View {
let prefix: String
let show_friend_confirmed: Bool
let show_nip5_domain: Bool
@State var display_name: String?
@State var nip05: NIP05?
@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.profile = profile
self.prefix = ""
self.show_friend_confirmed = show_friend_confirmed
self.show_nip5_domain = show_nip5_domain
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.profile = profile
self.prefix = prefix
self.damus_state = damus
self.show_friend_confirmed = show_friend_confirmed
self.show_nip5_domain = show_nip5_domain
}
var friend_icon: String? {
@ -72,13 +75,16 @@ struct ProfileName: View {
if let nip05 = current_nip05 {
Image(systemName: "checkmark.seal.fill")
.foregroundColor(nip05_color)
Text(nip05.host)
.foregroundColor(nip05_color)
.onTapGesture {
if let nip5url = nip05.siteUrl {
openURL(nip5url)
if show_nip5_domain {
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)

Loading…
Cancel
Save