All repositories are returning flowables of PagingData, which makes it difficult to combine them.
For example, if we want to combine 2 community requests of 2 different categoriesId, sth like:
val flowables = socialCategories.map {
amityCommunityRepository.getCommunities()
.filter(AmityCommunityFilter.ALL)
.categoryId(it)
.build()
.query()
}
Flowable.concat(flowables)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnNext { relevantData ->}
The relevantData
is of type PagingData, which makes it hard to go through the underlying data without doing some hacky workarounds (like doing a relevantData.map{} to manipulate each item and ignoring the result list)
Also, pagingData kind of forces to use a PagingDataAdapter with a RecyclerView, which is not relevant to a Jetpack Compose application.
Is there a workaround to this?