small change in signature
This commit is contained in:
parent
d1e2d06538
commit
99bea8f7c3
|
@ -52,11 +52,10 @@ class ContactsBookController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val currentState = state ?: return
|
val currentState = state ?: return
|
||||||
val hasSearch = currentState.searchTerm.isNotEmpty()
|
|
||||||
when (val asyncMappedContacts = currentState.mappedContacts) {
|
when (val asyncMappedContacts = currentState.mappedContacts) {
|
||||||
is Uninitialized -> renderEmptyState(false)
|
is Uninitialized -> renderEmptyState(false)
|
||||||
is Loading -> renderLoading()
|
is Loading -> renderLoading()
|
||||||
is Success -> renderSuccess(currentState.filteredMappedContacts, hasSearch, currentState.onlyBoundContacts)
|
is Success -> renderSuccess(currentState)
|
||||||
is Fail -> renderFailure(asyncMappedContacts.error)
|
is Fail -> renderFailure(asyncMappedContacts.error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,13 +74,13 @@ class ContactsBookController @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderSuccess(mappedContacts: List<MappedContact>,
|
private fun renderSuccess(state: ContactsBookViewState) {
|
||||||
hasSearch: Boolean,
|
val mappedContacts = state.filteredMappedContacts
|
||||||
onlyBoundContacts: Boolean) {
|
|
||||||
if (mappedContacts.isEmpty()) {
|
if (mappedContacts.isEmpty()) {
|
||||||
renderEmptyState(hasSearch)
|
renderEmptyState(state.searchTerm.isNotEmpty())
|
||||||
} else {
|
} else {
|
||||||
renderContacts(mappedContacts, onlyBoundContacts)
|
renderContacts(mappedContacts, state.onlyBoundContacts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue