Skip to content

Commit

Permalink
Fix usage of combine framework
Browse files Browse the repository at this point in the history
The sinks have to run in the main queue because they are triggering ui
updates (by defaults they run in the queue the nsnotification was sent
in).
  • Loading branch information
tmolitor-stud-tu committed Sep 14, 2024
1 parent bd4e00f commit 7e8ced1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Monal/Classes/ContactsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ class Contacts: ObservableObject {
self.requestCount = DataLayer.sharedInstance().allContactRequests().count
subscriptions = [
NotificationCenter.default.publisher(for: NSNotification.Name("kMonalContactRemoved"))
.receive(on: DispatchQueue.main)
.sink() { _ in self.refreshContacts() },
NotificationCenter.default.publisher(for: NSNotification.Name("kMonalContactRefresh"))
.receive(on: DispatchQueue.main)
.sink() { _ in self.refreshContacts() }
]
}
Expand Down
2 changes: 2 additions & 0 deletions Monal/Classes/OmemoKeysView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,10 @@ class OmemoKeysForChat: ObservableObject {
self.contacts = OmemoKeysForChat.knownDevices(viewContact: self.viewContact)
subscriptions = [
NotificationCenter.default.publisher(for: NSNotification.Name("kMonalOmemoStateUpdated"))
.receive(on: DispatchQueue.main)
.sink() { _ in self.updateContactDevices() },
NotificationCenter.default.publisher(for: NSNotification.Name("kMonalMucParticipantsAndMembersUpdated"))
,receive(on: DispatchQueue.main)
.sink() { _ in self.updateContactDevices() },
]
}
Expand Down

0 comments on commit 7e8ced1

Please sign in to comment.