correctly detect end of pagination in network timeline (#2296)

* correctly detect end of pagination in network timeline

closes #2293

* improve NetworkTimelineRemoteMediatorTest

* remove unused import
This commit is contained in:
Konrad Pozniak 2022-01-20 18:30:21 +01:00 committed by GitHub
commit a000228165
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 105 additions and 1 deletions

View file

@ -47,7 +47,11 @@ class NetworkTimelineRemoteMediator(
}
LoadType.APPEND -> {
val maxId = viewModel.nextKey
viewModel.fetchStatusesForKind(maxId, null, limit = state.config.pageSize)
if (maxId != null) {
viewModel.fetchStatusesForKind(maxId, null, limit = state.config.pageSize)
} else {
return MediatorResult.Success(endOfPaginationReached = true)
}
}
}