Caching the room proxies and their messages. Improved performance throughout.

This commit is contained in:
Stefan Ceriu
2022-03-31 15:37:52 +03:00
parent b50bf724a3
commit 49f7678ce8
22 changed files with 191 additions and 189 deletions
@@ -17,8 +17,7 @@ enum RoomProxyError: Error {
}
enum RoomProxyCallback {
case addedMessage(RoomMessageProtocol)
case updatedLastMessage
case updatedMessages
}
protocol RoomProxyProtocol {
@@ -32,7 +31,7 @@ protocol RoomProxyProtocol {
var name: String? { get }
var topic: String? { get }
var lastMessage: String? { get }
var messages: [RoomMessageProtocol] { get }
var avatarURL: String? { get }
@@ -42,7 +41,7 @@ protocol RoomProxyProtocol {
func displayNameForUserId(_ userId: String, completion: @escaping (Result<String?, RoomProxyError>) -> Void)
func paginateBackwards(count: UInt, callback: ((Result<[RoomMessageProtocol], RoomProxyError>) -> Void)?)
func paginateBackwards(count: UInt, callback: ((Result<Void, RoomProxyError>) -> Void)?)
var callbacks: PassthroughSubject<RoomProxyCallback, Never> { get }
}