Fix getting sinceId after last items call in FeverDataSource

This commit is contained in:
Shinokuni 2024-08-14 18:58:30 +02:00
parent 7b3920374e
commit dd98c7b0a6
2 changed files with 3 additions and 1 deletions

View File

@ -82,7 +82,7 @@ class FeverDataSource(private val service: FeverService) {
}
sinceId = if (items.isNotEmpty()) {
items.first().remoteId!!.toLong()
items.maxOfOrNull { it.remoteId!!.toLong() }!!
} else {
localSinceId.toLong()
}

View File

@ -157,6 +157,7 @@ class FeverDataSourceTest : KoinTest {
assertEquals(6, result.starredIds.size)
assertEquals(10, result.items.size)
assertEquals(10, result.items.size)
assertEquals(1564058340320135, result.sinceId)
assertEquals("1564058340320135", firstMaxId)
assertEquals("6", secondMaxId)
@ -229,6 +230,7 @@ class FeverDataSourceTest : KoinTest {
assertEquals(6, result.unreadIds.size)
assertEquals(6, result.starredIds.size)
assertEquals(10, result.items.size)
assertEquals(10, result.sinceId)
assertEquals("1", firstLastSinceId)
assertEquals("5", secondLastSinceId)