feat: add read last read chapter shortcut (#7230)
Supersedes #6861 Co-authored-by: Pierre-Monier <65488471+Pierre-Monier@users.noreply.github.com> Co-authored-by: Pierre-Monier <65488471+Pierre-Monier@users.noreply.github.com>
This commit is contained in:
@@ -3,11 +3,16 @@ package eu.kanade.domain.history.interactor
|
||||
import eu.kanade.domain.chapter.model.Chapter
|
||||
import eu.kanade.domain.history.repository.HistoryRepository
|
||||
|
||||
class GetNextChapterForManga(
|
||||
class GetNextChapter(
|
||||
private val repository: HistoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, chapterId: Long): Chapter? {
|
||||
return repository.getNextChapterForManga(mangaId, chapterId)
|
||||
return repository.getNextChapter(mangaId, chapterId)
|
||||
}
|
||||
|
||||
suspend fun await(): Chapter? {
|
||||
val history = repository.getLastHistory() ?: return null
|
||||
return repository.getNextChapter(history.mangaId, history.chapterId)
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,9 @@ interface HistoryRepository {
|
||||
|
||||
fun getHistory(query: String): PagingSource<Long, HistoryWithRelations>
|
||||
|
||||
suspend fun getNextChapterForManga(mangaId: Long, chapterId: Long): Chapter?
|
||||
suspend fun getLastHistory(): HistoryWithRelations?
|
||||
|
||||
suspend fun getNextChapter(mangaId: Long, chapterId: Long): Chapter?
|
||||
|
||||
suspend fun resetHistory(historyId: Long)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user