SearchViewModel

ViewModel responsible for searching for messages that match a particular search query.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
data class State(val query: String = "", val canLoadMore: Boolean = true, val results: List<Message> = emptyList(), val isLoading: Boolean = false, val isLoadingMore: Boolean = false)

Represents the search screen state, used to render the required UI.

Properties

Link copied to clipboard

One shot error events when search fails.

Link copied to clipboard

The current state of the search screen.

Functions

Link copied to clipboard
fun loadMore()

Loads more data when the user reaches the end of the found message list.

Link copied to clipboard
fun setQuery(query: String)

Changes the current query state. An empty search query

Inherited functions

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "bind")
fun SearchViewModel.bindView(view: SearchResultListView, lifecycleOwner: LifecycleOwner)

Binds SearchResultListView with SearchViewModel, updating the view's state based on data provided by the ViewModel, and propagating view events to the ViewModel as needed.