Remove enableplaceholders config option
This commit is contained in:
parent
f22cd47452
commit
58b668e09a
|
@ -48,8 +48,7 @@ class FeedContentRepository<T: FeedContentDatabase> @ExperimentalPagingApi
|
|||
return Pager(
|
||||
config = PagingConfig(initialLoadSize = NETWORK_PAGE_SIZE,
|
||||
pageSize = NETWORK_PAGE_SIZE,
|
||||
enablePlaceholders = false,
|
||||
prefetchDistance = 50
|
||||
prefetchDistance = 20
|
||||
),
|
||||
remoteMediator = mediator,
|
||||
pagingSourceFactory = pagingSourceFactory
|
||||
|
|
|
@ -41,18 +41,14 @@ class NotificationsRemoteMediator @Inject constructor(
|
|||
|
||||
override suspend fun load(loadType: LoadType, state: PagingState<Int, Notification>): MediatorResult {
|
||||
|
||||
val (max_id, min_id) = when (loadType) {
|
||||
LoadType.REFRESH -> {
|
||||
Pair<String?, String?>(null, null)
|
||||
}
|
||||
val maxId = when (loadType) {
|
||||
LoadType.REFRESH -> null
|
||||
LoadType.PREPEND -> {
|
||||
//No prepend for the moment, might be nice to add later
|
||||
return MediatorResult.Success(endOfPaginationReached = true)
|
||||
}
|
||||
LoadType.APPEND -> {
|
||||
Pair<String?, String?>(state.lastItemOrNull()?.id, null)
|
||||
}
|
||||
|
||||
LoadType.APPEND -> state.lastItemOrNull()?.id
|
||||
?: return MediatorResult.Success(endOfPaginationReached = true)
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -61,9 +57,8 @@ class NotificationsRemoteMediator @Inject constructor(
|
|||
val api = apiHolder.api ?: apiHolder.setToCurrentUser()
|
||||
|
||||
val apiResponse = api.notifications(
|
||||
max_id = max_id,
|
||||
min_id = min_id,
|
||||
limit = state.config.pageSize.toString(),
|
||||
max_id = maxId,
|
||||
limit = state.config.pageSize.toString()
|
||||
)
|
||||
|
||||
apiResponse.forEach{it.user_id = user.user_id; it.instance_uri = user.instance_uri}
|
||||
|
|
|
@ -26,18 +26,14 @@ class HomeFeedRemoteMediator @Inject constructor(
|
|||
|
||||
override suspend fun load(loadType: LoadType, state: PagingState<Int, HomeStatusDatabaseEntity>): MediatorResult {
|
||||
|
||||
val (max_id, min_id) = when (loadType) {
|
||||
LoadType.REFRESH -> {
|
||||
Pair<String?, String?>(null, null)
|
||||
}
|
||||
val maxId = when (loadType) {
|
||||
LoadType.REFRESH -> null
|
||||
LoadType.PREPEND -> {
|
||||
//No prepend for the moment, might be nice to add later
|
||||
return MediatorResult.Success(endOfPaginationReached = true)
|
||||
}
|
||||
LoadType.APPEND -> {
|
||||
Pair<String?, String?>(state.lastItemOrNull()?.id, null)
|
||||
}
|
||||
|
||||
LoadType.APPEND -> state.lastItemOrNull()?.id
|
||||
?: return MediatorResult.Success(endOfPaginationReached = true)
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -46,8 +42,7 @@ class HomeFeedRemoteMediator @Inject constructor(
|
|||
val api = apiHolder.api ?: apiHolder.setToCurrentUser()
|
||||
|
||||
val apiResponse = api.timelineHome(
|
||||
max_id= max_id,
|
||||
min_id = min_id, limit = state.config.pageSize.toString()
|
||||
max_id= maxId, limit = state.config.pageSize.toString()
|
||||
)
|
||||
|
||||
val dbObjects = apiResponse.map{
|
||||
|
|
|
@ -41,18 +41,14 @@ class PublicFeedRemoteMediator @Inject constructor(
|
|||
|
||||
override suspend fun load(loadType: LoadType, state: PagingState<Int, PublicFeedStatusDatabaseEntity>): MediatorResult {
|
||||
|
||||
val (max_id, min_id) = when (loadType) {
|
||||
LoadType.REFRESH -> {
|
||||
Pair<String?, String?>(null, null)
|
||||
}
|
||||
val maxId = when (loadType) {
|
||||
LoadType.REFRESH -> null
|
||||
LoadType.PREPEND -> {
|
||||
//No prepend for the moment, might be nice to add later
|
||||
return MediatorResult.Success(endOfPaginationReached = true)
|
||||
}
|
||||
LoadType.APPEND -> {
|
||||
Pair<String?, String?>(state.lastItemOrNull()?.id, null)
|
||||
}
|
||||
|
||||
LoadType.APPEND -> state.lastItemOrNull()?.id
|
||||
?: return MediatorResult.Success(endOfPaginationReached = true)
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -61,8 +57,7 @@ class PublicFeedRemoteMediator @Inject constructor(
|
|||
val api = apiHolder.api ?: apiHolder.setToCurrentUser()
|
||||
|
||||
val apiResponse = api.timelinePublic(
|
||||
max_id = max_id,
|
||||
min_id = min_id,
|
||||
max_id = maxId,
|
||||
limit = state.config.pageSize.toString(),
|
||||
)
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@ class FollowersContentRepository @ExperimentalPagingApi
|
|||
return Pager(
|
||||
config = PagingConfig(
|
||||
initialLoadSize = NETWORK_PAGE_SIZE,
|
||||
pageSize = NETWORK_PAGE_SIZE,
|
||||
enablePlaceholders = false),
|
||||
pageSize = NETWORK_PAGE_SIZE),
|
||||
pagingSourceFactory = {
|
||||
FollowersPagingSource(api, accountId, following)
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ class HashTagContentRepository @ExperimentalPagingApi
|
|||
return Pager(
|
||||
config = PagingConfig(
|
||||
initialLoadSize = NETWORK_PAGE_SIZE,
|
||||
pageSize = NETWORK_PAGE_SIZE,
|
||||
enablePlaceholders = false),
|
||||
pageSize = NETWORK_PAGE_SIZE
|
||||
),
|
||||
pagingSourceFactory = {
|
||||
HashTagPagingSource(api, hashtag)
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ class ProfileContentRepository @ExperimentalPagingApi
|
|||
return Pager(
|
||||
config = PagingConfig(
|
||||
initialLoadSize = NETWORK_PAGE_SIZE,
|
||||
pageSize = NETWORK_PAGE_SIZE,
|
||||
enablePlaceholders = false),
|
||||
pageSize = NETWORK_PAGE_SIZE),
|
||||
pagingSourceFactory = {
|
||||
ProfilePagingSource(api, accountId)
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ class SearchContentRepository<T: FeedContent> @ExperimentalPagingApi
|
|||
return Pager(
|
||||
config = PagingConfig(
|
||||
initialLoadSize = NETWORK_PAGE_SIZE,
|
||||
pageSize = NETWORK_PAGE_SIZE,
|
||||
enablePlaceholders = false),
|
||||
pageSize = NETWORK_PAGE_SIZE),
|
||||
pagingSourceFactory = {
|
||||
SearchPagingSource<T>(api, query, type)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue