更新代码
This commit is contained in:
@@ -25,7 +25,8 @@ class MomentPagingSource(
|
||||
private val author: Int? = null,
|
||||
private val timelineId: Int? = null,
|
||||
private val contentSearch: String? = null,
|
||||
private val trend: Boolean? = false
|
||||
private val trend: Boolean? = false,
|
||||
private val favoriteUserId: Int? = null
|
||||
) : PagingSource<Int, MomentEntity>() {
|
||||
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, MomentEntity> {
|
||||
return try {
|
||||
@@ -35,7 +36,8 @@ class MomentPagingSource(
|
||||
author = author,
|
||||
timelineId = timelineId,
|
||||
contentSearch = contentSearch,
|
||||
trend = trend
|
||||
trend = trend,
|
||||
favoriteUserId = favoriteUserId
|
||||
)
|
||||
|
||||
LoadResult.Page(
|
||||
@@ -62,14 +64,16 @@ class MomentRemoteDataSource(
|
||||
author: Int?,
|
||||
timelineId: Int?,
|
||||
contentSearch: String?,
|
||||
trend: Boolean?
|
||||
trend: Boolean?,
|
||||
favoriteUserId: Int?
|
||||
): ListContainer<MomentEntity> {
|
||||
return momentService.getMoments(
|
||||
pageNumber = pageNumber,
|
||||
author = author,
|
||||
timelineId = timelineId,
|
||||
contentSearch = contentSearch,
|
||||
trend = trend
|
||||
trend = trend,
|
||||
favoriteUserId = favoriteUserId
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -82,14 +86,16 @@ class MomentServiceImpl() : MomentService {
|
||||
author: Int?,
|
||||
timelineId: Int?,
|
||||
contentSearch: String?,
|
||||
trend: Boolean?
|
||||
trend: Boolean?,
|
||||
favoriteUserId: Int?
|
||||
): ListContainer<MomentEntity> {
|
||||
return momentBackend.fetchMomentItems(
|
||||
pageNumber = pageNumber,
|
||||
author = author,
|
||||
timelineId = timelineId,
|
||||
contentSearch = contentSearch,
|
||||
trend = trend
|
||||
trend = trend,
|
||||
favoriteUserId = favoriteUserId
|
||||
)
|
||||
}
|
||||
|
||||
@@ -136,7 +142,8 @@ class MomentBackend {
|
||||
author: Int? = null,
|
||||
timelineId: Int?,
|
||||
contentSearch: String?,
|
||||
trend: Boolean?
|
||||
trend: Boolean?,
|
||||
favoriteUserId: Int? = null
|
||||
): ListContainer<MomentEntity> {
|
||||
val resp = ApiClient.api.getPosts(
|
||||
pageSize = DataBatchSize,
|
||||
@@ -144,7 +151,8 @@ class MomentBackend {
|
||||
timelineId = timelineId,
|
||||
authorId = author,
|
||||
contentSearch = contentSearch,
|
||||
trend = if (trend == true) "true" else ""
|
||||
trend = if (trend == true) "true" else "",
|
||||
favouriteUserId = favoriteUserId
|
||||
)
|
||||
val body = resp.body() ?: throw ServiceException("Failed to get moments")
|
||||
return ListContainer(
|
||||
|
||||
Reference in New Issue
Block a user