Set visible ranges on the home screen sliding sync view (#342)

* Set visible ranges on the home screen sliding sync view
* Prevent the visible items from being updated while in search mode
* Enable diffs on invalidations as they seem to fix duplicated events in the home screen room list
* Promoted some diffing logs to info from verbose
This commit is contained in:
Stefan Ceriu
2022-11-25 17:50:43 +02:00
committed by GitHub
parent 1781f92882
commit 00cd2ab707
14 changed files with 271 additions and 88 deletions
@@ -89,7 +89,7 @@ class ClientProxy: ClientProxyProtocol {
RequiredState(key: "m.room.encryption", value: "")])
.name(name: "HomeScreenView")
.syncMode(mode: .selective)
.addRange(from: 0, to: 50) // FIXME: Replace this with a dynamic solution
.addRange(from: 0, to: 20)
.build()
let slidingSync = try slidingSyncBuilder
@@ -98,8 +98,9 @@ class ClientProxy: ClientProxyProtocol {
.coldCache(name: "ElementX")
.build()
self.roomSummaryProvider = RoomSummaryProvider(slidingSyncController: slidingSync,
slidingSyncView: slidingSyncView,
let slidingSyncViewProxy = SlidingSyncViewProxy(clientProxy: self, slidingSync: slidingSync, slidingSyncView: slidingSyncView)
self.roomSummaryProvider = RoomSummaryProvider(slidingSyncViewProxy: slidingSyncViewProxy,
roomMessageFactory: RoomMessageFactory())
self.slidingSync = slidingSync
@@ -162,6 +163,11 @@ class ClientProxy: ClientProxyProtocol {
slidingSync?.setObserver(observer: nil)
}
func restartSync() {
slidingSyncObserverToken?.cancel()
slidingSyncObserverToken = slidingSync?.sync()
}
func roomForIdentifier(_ identifier: String) async -> RoomProxyProtocol? {
let (slidingSyncRoom, room) = await Task.dispatch(on: clientQueue) {
self.roomTupleForIdentifier(identifier)