Sort incoming messages client side, workaround backward stream issues (revisit later with new Rust implementation).

This commit is contained in:
Stefan Ceriu
2022-03-24 14:48:38 +02:00
parent cf42d61d27
commit 762b497940
2 changed files with 5 additions and 2 deletions
@@ -151,10 +151,13 @@ class RoomProxy: RoomProxyProtocol, Equatable {
return
}
let messages = backwardStream.paginateBackwards(count: UInt64(count)).map { message in
var messages = backwardStream.paginateBackwards(count: UInt64(count)).map { message in
self.messageFactory.buildRoomMessageFrom(message)
}
// FIXME: Something wrong on the Rust side and these come in out of order sometimes.
messages = messages.sorted(by: { $0.originServerTs < $1.originServerTs })
DispatchQueue.main.async {
callback?(.success(messages))
if self.lastMessage == nil {