mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Switch entirely to dynamic room list entries (normalizedMatchRoomName brings the same behavior as the old implementation) and cleanup
This commit is contained in:
committed by
Stefan Ceriu
parent
8dca82e65e
commit
269fd3d1f6
@@ -79,18 +79,12 @@ struct HomeScreenViewState: BindableState {
|
||||
|
||||
var selectedRoomID: String?
|
||||
|
||||
var dynamicEntriesEnabled: Bool
|
||||
|
||||
var visibleRooms: [HomeScreenRoom] {
|
||||
if roomListMode == .skeletons {
|
||||
return placeholderRooms
|
||||
}
|
||||
|
||||
if dynamicEntriesEnabled || bindings.searchQuery.isEmpty {
|
||||
return rooms
|
||||
}
|
||||
|
||||
return rooms.filter { $0.name.localizedStandardContains(bindings.searchQuery) }
|
||||
return rooms
|
||||
}
|
||||
|
||||
var bindings = HomeScreenViewStateBindings()
|
||||
|
||||
@@ -49,7 +49,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
roomSummaryProvider = userSession.clientProxy.roomSummaryProvider
|
||||
inviteSummaryProvider = userSession.clientProxy.inviteSummaryProvider
|
||||
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID, dynamicEntriesEnabled: appSettings.dynamicEntriesEnabled),
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID),
|
||||
imageProvider: userSession.mediaProvider)
|
||||
|
||||
userSession.callbacks
|
||||
@@ -74,12 +74,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
.weakAssign(to: \.state.selectedRoomID, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.$dynamicEntriesEnabled
|
||||
.weakAssign(to: \.state.dynamicEntriesEnabled, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
context.$viewState
|
||||
.filter { _ in appSettings.dynamicEntriesEnabled }
|
||||
.map(\.bindings.searchQuery)
|
||||
.debounceAndRemoveDuplicates()
|
||||
.sink { [weak self] searchQuery in
|
||||
|
||||
Reference in New Issue
Block a user