public Flowable<ViewModel> perform(
Flowable<PaginationParam> paginationSource) {
return Flowable.combineLatest(
mConnectionState.getConnectionState(),
mSessionInfo,
paginationSource,
Holder::combine)
.flatMap(this::toViewModel);
}
Now I want to start perform() when I am on the second page so my point is listen Pagination change and when it is not the first page(0) then call call perform().
final Flowable<PaginationParam > paginationSource =
mPagination.observe(this).filter(it -> it.getOffset() != 0);
I don't know how can I combine these.?
you can change you perform
function:
public Flowable<ViewModel> perform(PaginationParam paginationParam) {
return Flowable.combineLatest(
mConnectionState.getConnectionState(),
mSessionInfo,
{state, info -> Holder.combine(state, info, paginationParam)})
.flatMap(this::toViewModel);
}
and than use it:
paginationSource.flatMap( it -> perform(it))
.subscribe(...)