Add debounce/minimum length for add user search (#387)

This functionality was already implemented, it just didn't
have the right parameters configured for the user list
presenter.

Closes #109
This commit is contained in:
Chris Smith 2023-05-04 13:30:20 +01:00 committed by GitHub
parent 014c0f4186
commit a6569387e3
3 changed files with 13 additions and 4 deletions

View file

@ -35,7 +35,11 @@ class AddPeoplePresenter @Inject constructor(
private val userListPresenter by lazy {
userListPresenterFactory.create(
UserListPresenterArgs(selectionMode = SelectionMode.Multiple),
UserListPresenterArgs(
selectionMode = SelectionMode.Multiple,
minimumSearchLength = 3,
searchDebouncePeriodMillis = UserListPresenterArgs.DEFAULT_DEBOUNCE
),
userListDataSource,
dataStore.selectedUserListDataStore,
)

View file

@ -49,7 +49,7 @@ class CreateRoomRootPresenter @Inject constructor(
UserListPresenterArgs(
selectionMode = SelectionMode.Single,
minimumSearchLength = 3,
searchDebouncePeriodMillis = 500,
searchDebouncePeriodMillis = UserListPresenterArgs.DEFAULT_DEBOUNCE,
),
userListDataSource,
userListDataStore,

View file

@ -19,8 +19,13 @@ package io.element.android.features.userlist.api
data class UserListPresenterArgs(
val selectionMode: SelectionMode,
val minimumSearchLength: Int = 1,
val searchDebouncePeriodMillis: Long = 0,
)
val searchDebouncePeriodMillis: Long = NO_DEBOUNCE,
) {
companion object {
const val NO_DEBOUNCE = 0L
const val DEFAULT_DEBOUNCE = 500L
}
}
enum class SelectionMode {
Single,