mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 04:41:47 +01:00
handle default category and add favorite check (#3248)
Download new chapters bug fix
This commit is contained in:
parent
8c2b2f99bc
commit
3edf17d322
@ -53,6 +53,8 @@ fun Manga.updateCoverLastModified(db: DatabaseHelper) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Manga.shouldDownloadNewChapters(db: DatabaseHelper, prefs: PreferencesHelper): Boolean {
|
fun Manga.shouldDownloadNewChapters(db: DatabaseHelper, prefs: PreferencesHelper): Boolean {
|
||||||
|
if (!favorite) return false
|
||||||
|
|
||||||
// Boolean to determine if user wants to automatically download new chapters.
|
// Boolean to determine if user wants to automatically download new chapters.
|
||||||
val downloadNew = prefs.downloadNew().get()
|
val downloadNew = prefs.downloadNew().get()
|
||||||
if (!downloadNew) return false
|
if (!downloadNew) return false
|
||||||
@ -60,7 +62,11 @@ fun Manga.shouldDownloadNewChapters(db: DatabaseHelper, prefs: PreferencesHelper
|
|||||||
val categoriesToDownload = prefs.downloadNewCategories().get().map(String::toInt)
|
val categoriesToDownload = prefs.downloadNewCategories().get().map(String::toInt)
|
||||||
if (categoriesToDownload.isEmpty()) return true
|
if (categoriesToDownload.isEmpty()) return true
|
||||||
|
|
||||||
val categoriesForManga = db.getCategoriesForManga(this).executeAsBlocking().mapNotNull { it.id }
|
// Get all categories, else default category (0)
|
||||||
|
val categoriesForManga =
|
||||||
|
db.getCategoriesForManga(this).executeAsBlocking()
|
||||||
|
.mapNotNull { it.id }
|
||||||
|
.takeUnless { it.isEmpty() } ?: listOf(0)
|
||||||
|
|
||||||
return categoriesForManga.intersect(categoriesToDownload).isNotEmpty()
|
return categoriesForManga.intersect(categoriesToDownload).isNotEmpty()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user