Can't combine multiple flowables from Repositories

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?

Hello Franco!

We appreciate your feedback and understand the challenge you are facing. To provide a solution, we would like to suggest utilizing the Android SDK’s asFlow function to convert Flowable into Flow , which can then be compatible with Jetpack Compose through the use of the .collectAsLazyPagingItems function.

Please refer to the following link for more information: https://docs.amity.co/core-concepts/live-objects-collections/data-stream#flow-functions. Thank you for reaching out to us and please let us know if you have any further questions or concerns.