Refactor direct messages model

We can track the pubkey in the DirectMessageModel instead of having a
janky tuple.
This commit is contained in:
William Casarin
2023-04-15 12:41:00 -07:00
parent 247270f3d3
commit b5a3697d78
8 changed files with 74 additions and 58 deletions
+6 -2
View File
@@ -16,6 +16,8 @@ class DirectMessageModel: ObservableObject {
@Published var draft: String
let pubkey: String
var is_request: Bool
var our_pubkey: String
@@ -29,17 +31,19 @@ class DirectMessageModel: ObservableObject {
return true
}
init(events: [NostrEvent], our_pubkey: String) {
init(events: [NostrEvent], our_pubkey: String, pubkey: String) {
self.events = events
self.is_request = false
self.our_pubkey = our_pubkey
self.draft = ""
self.pubkey = pubkey
}
init(our_pubkey: String) {
init(our_pubkey: String, pubkey: String) {
self.events = []
self.is_request = false
self.our_pubkey = our_pubkey
self.draft = ""
self.pubkey = pubkey
}
}