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,6 +1,5 @@
package eu.kanade.data.history
import androidx.paging.PagingSource
import eu.kanade.data.DatabaseHandler
import eu.kanade.data.chapter.chapterMapper
import eu.kanade.data.manga.mangaMapper
@@ -10,19 +9,17 @@ import eu.kanade.domain.history.model.HistoryWithRelations
import eu.kanade.domain.history.repository.HistoryRepository
import eu.kanade.domain.manga.model.Manga
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.flow.Flow
import logcat.LogPriority
class HistoryRepositoryImpl(
private val handler: DatabaseHandler,
) : HistoryRepository {
override fun getHistory(query: String): PagingSource<Long, HistoryWithRelations> {
return handler.subscribeToPagingSource(
countQuery = { historyViewQueries.countHistory(query) },
queryProvider = { limit, offset ->
historyViewQueries.history(query, limit, offset, historyWithRelationsMapper)
},
)
override fun getHistory(query: String): Flow<List<HistoryWithRelations>> {
return handler.subscribeToList {
historyViewQueries.history(query, historyWithRelationsMapper)
}
}
override suspend fun getLastHistory(): HistoryWithRelations? {