This commit is contained in:
Woit 2024-12-09 19:25:52 +01:00
parent bfb7bd00aa
commit ae767456dd
3 changed files with 4 additions and 1 deletions

View file

@ -25,6 +25,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
} }
func applicationDidEnterBackground(_: UIApplication) { func applicationDidEnterBackground(_: UIApplication) {
MLXMPPManager.sharedInstance().nowBackgrounded() // MLXMPPManager.sharedInstance().nowBackgrounded()
} }
} }

View file

@ -63,6 +63,7 @@ final class WrapperChat: ObservableObject {
deinit { deinit {
notificationObservers.forEach { NotificationCenter.default.removeObserver($0) } notificationObservers.forEach { NotificationCenter.default.removeObserver($0) }
print("Chat wrapper deinit")
} }
var chatTitle: String { var chatTitle: String {
@ -139,6 +140,7 @@ private extension WrapperChat {
default: default:
guard let mlMessage = notification.userInfo?["message"] as? MLMessage else { return } guard let mlMessage = notification.userInfo?["message"] as? MLMessage else { return }
guard let message = Message(mlMessage) else { return } guard let message = Message(mlMessage) else { return }
guard message.accountId == contact.ownerId, message.participantJid == contact.contactJid else { return }
if let index = messages.firstIndex(where: { $0.id == message.id }) { if let index = messages.firstIndex(where: { $0.id == message.id }) {
messages[index] = message messages[index] = message
} else { } else {

View file

@ -30,6 +30,7 @@ final class WrapperXMPP: ObservableObject {
deinit { deinit {
notificationObservers.forEach { NotificationCenter.default.removeObserver($0) } notificationObservers.forEach { NotificationCenter.default.removeObserver($0) }
print("XMPP wrapper deinit")
} }
} }