Add overload method to newHomePageResponse() to allow list of HomePageList

This commit is contained in:
Jace 2022-08-19 09:37:11 +08:00 committed by Cloudburst
parent ecb2fffe96
commit e4a5e00ef4

View file

@ -344,6 +344,10 @@ fun newHomePageResponse(list: HomePageList, hasNext: Boolean? = null): HomePageR
return HomePageResponse(listOf(list), hasNext = hasNext ?: list.list.isNotEmpty()) return HomePageResponse(listOf(list), hasNext = hasNext ?: list.list.isNotEmpty())
} }
fun newHomePageResponse(list: List<HomePageList>, hasNext: Boolean? = null): HomePageResponse {
return HomePageResponse(list, hasNext = hasNext ?: list.any { it.list.isNotEmpty() })
}
/**Every provider will **not** have try catch built in, so handle exceptions when calling these functions*/ /**Every provider will **not** have try catch built in, so handle exceptions when calling these functions*/
abstract class MainAPI { abstract class MainAPI {
companion object { companion object {