I need to show error view if status is error and call.isEmpty()
returns true
.
Is there a better way to achieve this result?
val errorVisible = states.asFlowable()
.map { it.status == Status.ERROR }
.flatMap { isError ->
if (isError) call.isEmpty()
else Flowable.just(false)
}
call.isEmpty()
returns Flowable<Boolean>
but can return something else like Single<Boolean>
.
EDIT: Another question, if call.isEmpty()
returns Flowable<Boolean>
how can I merge two streams (two Flowable<Boolean>
s - states.isError
and call.isEmpty()
) and map it to one Flowable<Boolean>
so it's one condition?