mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
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:
@@ -115,6 +115,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
callback?(.verifySession)
|
||||
case .skipSessionVerification:
|
||||
state.showSessionVerificationBanner = false
|
||||
case .updatedVisibleItemIdentifiers(let identifiers):
|
||||
updateVisibleRange(visibleItemIdentifiers: identifiers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,4 +191,20 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
state.rooms = rooms
|
||||
roomsForIdentifiers = newRoomsForIdentifiers
|
||||
}
|
||||
|
||||
private func updateVisibleRange(visibleItemIdentifiers items: Set<String>) {
|
||||
let result = items.compactMap { itemIdentifier in
|
||||
state.rooms.firstIndex { $0.id == itemIdentifier }
|
||||
}.sorted()
|
||||
|
||||
guard !result.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let lowerBound = result.first, let upperBound = result.last else {
|
||||
return
|
||||
}
|
||||
|
||||
userSession.clientProxy.roomSummaryProvider?.updateVisibleRange(lowerBound...upperBound)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user