Load profiles everywhere
Fixes: #11 Changelog-Fixed: Missing profiles are now loaded everywhere Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import Foundation
|
||||
enum NostrResponse: Decodable {
|
||||
case event(String, NostrEvent)
|
||||
case notice(String)
|
||||
case eose
|
||||
case eose(String)
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
var container = try decoder.unkeyedContainer()
|
||||
@@ -34,7 +34,8 @@ enum NostrResponse: Decodable {
|
||||
self = .notice(msg)
|
||||
return
|
||||
} else if typ == "EOSE" {
|
||||
self = .eose
|
||||
let sub_id = try container.decode(String.self)
|
||||
self = .eose(sub_id)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class RelayPool {
|
||||
}
|
||||
}
|
||||
|
||||
func unsubscribe(sub_id: String) {
|
||||
func unsubscribe(sub_id: String, to: [String]? = nil) {
|
||||
self.remove_handler(sub_id: sub_id)
|
||||
self.send(.unsubscribe(sub_id))
|
||||
}
|
||||
@@ -117,6 +117,11 @@ class RelayPool {
|
||||
send(.subscribe(.init(filters: filters, sub_id: sub_id)))
|
||||
}
|
||||
|
||||
func subscribe_to(sub_id: String, filters: [NostrFilter], to: [String]?, handler: @escaping (String, NostrConnectionEvent) -> ()) {
|
||||
register_handler(sub_id: sub_id, handler: handler)
|
||||
send(.subscribe(.init(filters: filters, sub_id: sub_id)), to: to)
|
||||
}
|
||||
|
||||
func send(_ req: NostrRequest, to: [String]? = nil) {
|
||||
let relays = to.map{ get_relays($0) } ?? self.relays
|
||||
|
||||
|
||||
Reference in New Issue
Block a user