ui: add followed hashtags to FollowingView
When users view who a certain person follows, now they will see an extra tab to see the hashtags that they follow. This new tab contains a list of followed hashtags, each of which includes an option to follow/unfollow the hashtag, as well as the ability to visit the hashtag timeline Testing **iOS:** 17.0 (iPhone 14 Pro Simulator) **Damus:** (This commit) **Test steps:** 1. Go to search view, search for a couple of hashtags: #apple, #orange, #kiwi 2. Go to the test accounts own profile via the drawer menu 3. Click on "Following". Make sure there are two tabs now. 4. Scroll down, switch tabs between "People" and "Hashtags". Make sure that scrolling and switching tabs work 5. Unfollow and follow a user. Make sure that this still works 6. Make sure that #apple, #orange, #kiwi hashtags are visible under the "Hashtags" tab 7. Unfollow "#kiwi". Check that the button label now switches from "Unfollow" to "Follow" 8. Click on "#kiwi". Make sure that it takes you to the page where posts with that hashtag appears 9. Go to @jb55's profile 10. Click on "Following" 11. Ensure that there is a "Hashtags" tab 12. Check that @jb55's followed hashtags are shown (not your own) 13. Follow one of the same hashtags as @jb55's 14. Go back to your own profile and go to your own following view again. 15. Make sure that this newly added tag is present on the list, and that #kiwi is not. Closes: https://github.com/damus-io/damus/issues/606 Changelog-Added: Add followed hashtags to your following list Signed-off-by: Daniel D’Aquino <daniel@daquino.me> Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
440e37c1d3
commit
8586eed635
@@ -74,6 +74,11 @@ class Contacts {
|
||||
guard let ev = self.event else { return Set() }
|
||||
return Set(ev.referenced_hashtags.map({ $0.hashtag }))
|
||||
}
|
||||
|
||||
func follows(hashtag: Hashtag) -> Bool {
|
||||
guard let ev = self.event else { return false }
|
||||
return ev.referenced_hashtags.first(where: { $0 == hashtag }) != nil
|
||||
}
|
||||
|
||||
func add_friend_pubkey(_ pubkey: Pubkey) {
|
||||
friends.insert(pubkey)
|
||||
|
||||
@@ -12,12 +12,14 @@ class FollowingModel {
|
||||
var needs_sub: Bool = true
|
||||
|
||||
let contacts: [Pubkey]
|
||||
let hashtags: [Hashtag]
|
||||
|
||||
let sub_id: String = UUID().description
|
||||
|
||||
init(damus_state: DamusState, contacts: [Pubkey]) {
|
||||
init(damus_state: DamusState, contacts: [Pubkey], hashtags: [Hashtag]) {
|
||||
self.damus_state = damus_state
|
||||
self.contacts = contacts
|
||||
self.hashtags = hashtags
|
||||
}
|
||||
|
||||
func get_filter() -> NostrFilter {
|
||||
|
||||
Reference in New Issue
Block a user