From 39722055f5a776263dd1b9080271fbeabff9b82b Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 11 Nov 2021 16:25:38 -0500 Subject: [PATCH] Don't auto-download chapters if excluded but no categories selected (fixes #6126) --- .../main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt index f4952d1b06..f1a4fb6238 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt @@ -60,7 +60,10 @@ fun Manga.shouldDownloadNewChapters(db: DatabaseHelper, prefs: PreferencesHelper if (!downloadNew) return false val categoriesToDownload = prefs.downloadNewCategories().get().map(String::toInt) - if (categoriesToDownload.isEmpty()) return true + val categoriesToExclude = prefs.downloadNewCategoriesExclude().get().map(String::toInt) + + // Default: download from all categories + if (categoriesToDownload.isEmpty() && categoriesToExclude.isEmpty()) return true // Get all categories, else default category (0) val categoriesForManga = @@ -68,8 +71,9 @@ fun Manga.shouldDownloadNewChapters(db: DatabaseHelper, prefs: PreferencesHelper .mapNotNull { it.id } .takeUnless { it.isEmpty() } ?: listOf(0) - val categoriesToExclude = prefs.downloadNewCategoriesExclude().get().map(String::toInt) + // In excluded category if (categoriesForManga.intersect(categoriesToExclude).isNotEmpty()) return false + // In included category return categoriesForManga.intersect(categoriesToDownload).isNotEmpty() }