Remove roomId from SearchAction.
This commit is contained in:
parent
da344fae51
commit
88ca909689
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue