This commit is contained in:
fmodf 2024-07-24 15:35:17 +02:00
parent 3756dfa527
commit 9155aa5ad8

View file

@ -73,13 +73,7 @@ final class XMPPService: ObservableObject {
} }
.store(in: &clientMessagesCancellables) .store(in: &clientMessagesCancellables)
// enable carbons if available // subscribe to archived messages
client.module(.messageCarbons).$isAvailable.filter { $0 }
.sink(receiveValue: { [weak client] _ in
client?.module(.messageCarbons).enable()
})
.store(in: &clientMessagesCancellables)
client.module(.mam).archivedMessagesPublisher client.module(.mam).archivedMessagesPublisher
.sink(receiveValue: { [weak self] archived in .sink(receiveValue: { [weak self] archived in
let message = archived.message let message = archived.message
@ -88,6 +82,13 @@ final class XMPPService: ObservableObject {
}) })
.store(in: &clientMessagesCancellables) .store(in: &clientMessagesCancellables)
// enable carbons if available
client.module(.messageCarbons).$isAvailable.filter { $0 }
.sink(receiveValue: { [weak client] _ in
client?.module(.messageCarbons).enable()
})
.store(in: &clientMessagesCancellables)
// finally, do login // finally, do login
client.login() client.login()
} }