Slide 46
Slide 46 text
MVI
val reducer: BiFunction =
BiFunction { previousState, result ->
when (result) {
is LoadTasksResult -> {
when (result) {
is Success -> previousState.copy(isLoading = false,
contacts = result.contacts.map { mapper.mapToDisplayObject(it) })
is Failure -> previousState.copy(isLoading = false,
error = result.error)
is InFlight -> previousState.copy(isLoading = true)
}
}
}
}
VIEW