Remove roomId from SearchAction.

This commit is contained in:
Onuray Sahin 2020-09-29 12:37:44 +03:00 committed by Benoit Marty
parent da344fae51
commit 88ca909689
4 changed files with 7 additions and 4 deletions

View File

@ -19,7 +19,7 @@ package im.vector.app.features.home.room.detail.search
import im.vector.app.core.platform.VectorViewModelAction
sealed class SearchAction : VectorViewModelAction {
data class SearchWith(val roomId: String, val searchTerm: String) : SearchAction()
data class SearchWith(val searchTerm: String) : SearchAction()
object ScrolledToTop : SearchAction()
object Retry : SearchAction()
}

View File

@ -123,7 +123,7 @@ class SearchFragment @Inject constructor(
fun search(query: String) {
view?.hideKeyboard()
searchViewModel.handle(SearchAction.SearchWith(fragmentArgs.roomId, query))
searchViewModel.handle(SearchAction.SearchWith(query))
}
override fun onRetryClicked() {

View File

@ -57,7 +57,7 @@ class SearchViewModel @AssistedInject constructor(
private fun handleSearchWith(action: SearchAction.SearchWith) {
if (action.searchTerm.length > 1) {
setState {
copy(searchTerm = action.searchTerm, roomId = action.roomId, isNextBatch = false)
copy(searchTerm = action.searchTerm, isNextBatch = false)
}
startSearching()

View File

@ -27,4 +27,7 @@ data class SearchViewState(
val searchTerm: String? = null,
val roomId: String? = null,
val isNextBatch: Boolean = false
) : MvRxState
) : MvRxState {
constructor(args: SearchArgs) : this(roomId = args.roomId)
}