extract HomeModel from ContentView

huge refactor

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-24 12:57:40 -07:00
parent b230d430ee
commit 097cc54bba
27 changed files with 1221 additions and 371 deletions

View File

@@ -18,6 +18,13 @@ class ProfileModel: ObservableObject {
var seen_event: Set<String> = Set()
var sub_id = UUID().description
func get_follow_target() -> FollowTarget {
if let contacts = contacts {
return .contact(contacts)
}
return .pubkey(pubkey)
}
init(pubkey: String, damus: DamusState) {
self.pubkey = pubkey
self.damus = damus
@@ -39,7 +46,7 @@ class ProfileModel: ObservableObject {
var filter = NostrFilter.filter_authors([pubkey])
filter.kinds = kinds
filter.limit = 500
filter.limit = 1000
print("subscribing to profile \(pubkey) with sub_id \(sub_id)")
damus.pool.subscribe(sub_id: sub_id, filters: [filter], handler: handle_event)