mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Fix room list search bar focus glitches (#2112)
* Fixes #2112 - Room list search bar focus glitches * Address PR comments
This commit is contained in:
@@ -109,7 +109,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
// Don't capture the values here as combine behaves incorrectly and `isSearchFieldFocused` is sometimes
|
||||
// turning to true after cancelling the search. Read them directly from the state in the updateFilter
|
||||
// method instead on the next run loop to make sure they're up to date.
|
||||
DispatchQueue.main.async {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
||||
self.updateFilter()
|
||||
}
|
||||
}
|
||||
@@ -170,12 +170,14 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
// MARK: - Private
|
||||
|
||||
private func updateFilter() {
|
||||
if !state.bindings.isSearchFieldFocused {
|
||||
roomSummaryProvider?.setFilter(.all)
|
||||
} else if state.bindings.searchQuery.isEmpty {
|
||||
if state.shouldHideRoomList {
|
||||
roomSummaryProvider?.setFilter(.none)
|
||||
} else {
|
||||
roomSummaryProvider?.setFilter(.normalizedMatchRoomName(state.bindings.searchQuery))
|
||||
if state.bindings.isSearchFieldFocused {
|
||||
roomSummaryProvider?.setFilter(.normalizedMatchRoomName(state.bindings.searchQuery))
|
||||
} else {
|
||||
roomSummaryProvider?.setFilter(.all)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user