mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-28 21:07:57 +01:00
Implement scanlator filter (#8803)
* Implement scanlator filter * Visual improvement to scanlator filter dialog * Review changes + Bug fixes Backup not containing filtered chapters and similar issue fix * Review Changes + Fix SQL query * Lint mamma mia
This commit is contained in:
@@ -2,6 +2,7 @@ package tachiyomi.data.chapter
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.util.lang.toLong
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.data.DatabaseHandler
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
@@ -76,8 +77,22 @@ class ChapterRepositoryImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getChapterByMangaId(mangaId: Long): List<Chapter> {
|
||||
return handler.awaitList { chaptersQueries.getChaptersByMangaId(mangaId, ::mapChapter) }
|
||||
override suspend fun getChapterByMangaId(mangaId: Long, applyScanlatorFilter: Boolean): List<Chapter> {
|
||||
return handler.awaitList {
|
||||
chaptersQueries.getChaptersByMangaId(mangaId, applyScanlatorFilter.toLong(), ::mapChapter)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getScanlatorsByMangaId(mangaId: Long): List<String> {
|
||||
return handler.awaitList {
|
||||
chaptersQueries.getScanlatorsByMangaId(mangaId) { it.orEmpty() }
|
||||
}
|
||||
}
|
||||
|
||||
override fun getScanlatorsByMangaIdAsFlow(mangaId: Long): Flow<List<String>> {
|
||||
return handler.subscribeToList {
|
||||
chaptersQueries.getScanlatorsByMangaId(mangaId) { it.orEmpty() }
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getBookmarkedChaptersByMangaId(mangaId: Long): List<Chapter> {
|
||||
@@ -93,12 +108,9 @@ class ChapterRepositoryImpl(
|
||||
return handler.awaitOneOrNull { chaptersQueries.getChapterById(id, ::mapChapter) }
|
||||
}
|
||||
|
||||
override suspend fun getChapterByMangaIdAsFlow(mangaId: Long): Flow<List<Chapter>> {
|
||||
override suspend fun getChapterByMangaIdAsFlow(mangaId: Long, applyScanlatorFilter: Boolean): Flow<List<Chapter>> {
|
||||
return handler.subscribeToList {
|
||||
chaptersQueries.getChaptersByMangaId(
|
||||
mangaId,
|
||||
::mapChapter,
|
||||
)
|
||||
chaptersQueries.getChaptersByMangaId(mangaId, applyScanlatorFilter.toLong(), ::mapChapter)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user