mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Revert "Remove fuzzy searching entirely because of performance issues"
This reverts commit e86f65ad2d.
This commit is contained in:
committed by
Stefan Ceriu
parent
65256bf4ab
commit
ff074e3fae
@@ -79,12 +79,14 @@ struct HomeScreenViewState: BindableState {
|
||||
|
||||
var selectedRoomID: String?
|
||||
|
||||
var fuzzySearchEnabled: Bool
|
||||
|
||||
var visibleRooms: [HomeScreenRoom] {
|
||||
if roomListMode == .skeletons {
|
||||
return placeholderRooms
|
||||
}
|
||||
|
||||
if bindings.searchQuery.isEmpty {
|
||||
if fuzzySearchEnabled || bindings.searchQuery.isEmpty {
|
||||
return rooms
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
roomSummaryProvider = userSession.clientProxy.roomSummaryProvider
|
||||
inviteSummaryProvider = userSession.clientProxy.inviteSummaryProvider
|
||||
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID),
|
||||
super.init(initialViewState: HomeScreenViewState(userID: userSession.userID, fuzzySearchEnabled: appSettings.fuzzySearchEnabled),
|
||||
imageProvider: userSession.mediaProvider)
|
||||
|
||||
userSession.callbacks
|
||||
@@ -74,6 +74,19 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
.weakAssign(to: \.state.selectedRoomID, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.$fuzzySearchEnabled
|
||||
.weakAssign(to: \.state.fuzzySearchEnabled, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
context.$viewState
|
||||
.filter { _ in appSettings.fuzzySearchEnabled }
|
||||
.map(\.bindings.searchQuery)
|
||||
.debounceAndRemoveDuplicates()
|
||||
.sink { [weak self] searchQuery in
|
||||
self?.roomSummaryProvider?.updateFilterPattern(searchQuery)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
setupRoomSummaryProviderSubscriptions()
|
||||
|
||||
updateRooms()
|
||||
|
||||
+1
@@ -49,6 +49,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
||||
var notificationSettingsEnabled: Bool { get set }
|
||||
var swiftUITimelineEnabled: Bool { get set }
|
||||
var pollsInTimelineEnabled: Bool { get set }
|
||||
var fuzzySearchEnabled: Bool { get set }
|
||||
}
|
||||
|
||||
extension AppSettings: DeveloperOptionsProtocol { }
|
||||
|
||||
+7
@@ -38,6 +38,13 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section("Room list") {
|
||||
Toggle(isOn: $context.fuzzySearchEnabled) {
|
||||
Text("Fuzzy search")
|
||||
Text("Requires app reboot")
|
||||
}
|
||||
}
|
||||
|
||||
Section("Notifications") {
|
||||
Toggle(isOn: $context.notificationSettingsEnabled) {
|
||||
Text("Show notification settings")
|
||||
|
||||
Reference in New Issue
Block a user