contacts: get followed hashtags function

todo: cache these
This commit is contained in:
William Casarin
2023-07-13 11:02:13 -07:00
parent 17df2972d9
commit 9a714943fd

View File

@@ -70,6 +70,15 @@ class Contacts {
return Array(friends) return Array(friends)
} }
func get_followed_hashtags() -> Set<String> {
guard let ev = self.event else { return Set() }
return ev.tags.reduce(into: Set<String>(), { htags, tag in
if tag.count >= 2 && tag[0] == "t" && tag[1] != "" {
htags.insert(tag[1])
}
})
}
func add_friend_pubkey(_ pubkey: String) { func add_friend_pubkey(_ pubkey: String) {
friends.insert(pubkey) friends.insert(pubkey)
} }