HistoryScreen: Remove paging (#8125)

* HistoryScreen: Remove paging

Per my testing performance-wise there's virtually no
difference in loading time.

* cleanups

* add key and contentType
This commit is contained in:
Ivan Iskandar
2022-10-01 21:50:25 +07:00
committed by GitHub
parent 8d1f99a480
commit 42b0e3e438
9 changed files with 52 additions and 160 deletions

View File

@@ -1,8 +1,5 @@
package eu.kanade.domain.history.interactor
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import eu.kanade.domain.history.model.HistoryWithRelations
import eu.kanade.domain.history.repository.HistoryRepository
import kotlinx.coroutines.flow.Flow
@@ -10,12 +7,7 @@ import kotlinx.coroutines.flow.Flow
class GetHistory(
private val repository: HistoryRepository,
) {
fun subscribe(query: String): Flow<PagingData<HistoryWithRelations>> {
return Pager(
PagingConfig(pageSize = 25),
) {
repository.getHistory(query)
}.flow
fun subscribe(query: String): Flow<List<HistoryWithRelations>> {
return repository.getHistory(query)
}
}

View File

@@ -1,13 +1,13 @@
package eu.kanade.domain.history.repository
import androidx.paging.PagingSource
import eu.kanade.domain.chapter.model.Chapter
import eu.kanade.domain.history.model.HistoryUpdate
import eu.kanade.domain.history.model.HistoryWithRelations
import kotlinx.coroutines.flow.Flow
interface HistoryRepository {
fun getHistory(query: String): PagingSource<Long, HistoryWithRelations>
fun getHistory(query: String): Flow<List<HistoryWithRelations>>
suspend fun getLastHistory(): HistoryWithRelations?