fetch following contacts if we are missing any

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-24 15:29:28 -07:00
parent 8aac880bb5
commit dbf8c932ae
7 changed files with 136 additions and 29 deletions

View File

@@ -36,17 +36,25 @@ struct FollowUserView: View {
}
struct FollowingView: View {
let contact: NostrEvent
let damus_state: DamusState
@StateObject var following: FollowingModel
var body: some View {
ScrollView {
LazyVStack(alignment: .leading) {
ForEach(contact.referenced_pubkeys) { pk in
FollowUserView(target: .pubkey(pk.ref_id), damus_state: damus_state)
ForEach(following.contacts, id: \.self) { pk in
FollowUserView(target: .pubkey(pk), damus_state: damus_state)
}
}
}
.onAppear {
following.subscribe()
}
.onDisappear {
following.unsubscribe()
}
}
}