mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Filters, Mark Unread/Read/Favourites FF removals + code and tests clean up (#2541)
This commit is contained in:
@@ -21,7 +21,6 @@ typealias StartChatScreenViewModelType = StateStoreViewModel<StartChatScreenView
|
||||
|
||||
class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenViewModelProtocol {
|
||||
private let userSession: UserSessionProtocol
|
||||
private let userSuggestionsEnabled: Bool
|
||||
private let analytics: AnalyticsService
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
@@ -33,12 +32,10 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
}
|
||||
|
||||
init(userSession: UserSessionProtocol,
|
||||
userSuggestionsEnabled: Bool,
|
||||
analytics: AnalyticsService,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
userDiscoveryService: UserDiscoveryServiceProtocol) {
|
||||
self.userSession = userSession
|
||||
self.userSuggestionsEnabled = userSuggestionsEnabled
|
||||
self.analytics = analytics
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.userDiscoveryService = userDiscoveryService
|
||||
@@ -105,7 +102,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
|
||||
private func fetchUsers() {
|
||||
guard searchQuery.count >= 3 else {
|
||||
fetchSuggestions()
|
||||
state.usersSection = .init(type: .suggestions, users: [])
|
||||
return
|
||||
}
|
||||
fetchUsersTask = Task {
|
||||
@@ -115,18 +112,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
}
|
||||
}
|
||||
|
||||
private func fetchSuggestions() {
|
||||
guard userSuggestionsEnabled else {
|
||||
state.usersSection = .init(type: .suggestions, users: [])
|
||||
return
|
||||
}
|
||||
fetchUsersTask = Task {
|
||||
let result = await userDiscoveryService.fetchSuggestions()
|
||||
guard !Task.isCancelled else { return }
|
||||
handleResult(for: .suggestions, result: result)
|
||||
}
|
||||
}
|
||||
|
||||
private func handleResult(for sectionType: UserDiscoverySectionType, result: Result<[UserProfileProxy], UserDiscoveryErrorType>) {
|
||||
switch result {
|
||||
case .success(let users):
|
||||
|
||||
Reference in New Issue
Block a user