I have two observables that are chained together in a flatMap like this:
override fun getProductObservable(): Observable<List<ProductModel>> {
return observable1(productId)
.flatMap({
val limit = 8 - it.size
observable2(productId, limit)
}, { p1, p2 ->
p1.addAll(p2); p1 //simply return observables1's results already packed with p2 results
})
notice how observable2 depends on a result from observable1 (limit argument). BOTH OBSERVABLES RETURN THE SAME TYPE
Now onto my question, i would like observable1 once complete to immediately call onNext of the subscriber but still carry on to the flatmap. Essentially, the subscribers onNext would be called twice is what i want; once when observable1 completes and then again when the entire call completes. How can this be arranged ?