Add option for bookmarked chapters to download dropdown (#2891)
(cherry picked from commit 3c6f0f1697ccab055ee7af47da84b2161d406f0c) # Conflicts: # CHANGELOG.md # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
package tachiyomi.domain.chapter.interactor
|
||||
|
||||
import exh.source.MERGED_SOURCE_ID
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.common.util.system.logcat
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
import tachiyomi.domain.chapter.repository.ChapterRepository
|
||||
import tachiyomi.domain.manga.interactor.GetManga
|
||||
|
||||
class GetBookmarkedChaptersByMangaId(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
// SY -->
|
||||
private val getManga: GetManga,
|
||||
private val getMergedChaptersByMangaId: GetMergedChaptersByMangaId,
|
||||
// SY <--
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long): List<Chapter> {
|
||||
return try {
|
||||
// SY -->
|
||||
val manga = getManga.await(mangaId) ?: return emptyList()
|
||||
if (manga.source == MERGED_SOURCE_ID) {
|
||||
return getMergedChaptersByMangaId.await(mangaId, applyScanlatorFilter = true)
|
||||
.filter { it.bookmark }
|
||||
}
|
||||
// SY <--
|
||||
chapterRepository.getBookmarkedChaptersByMangaId(mangaId)
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user