Minor cleanup for download delete exclusion

This commit is contained in:
arkon 2021-09-11 18:39:29 -04:00
parent 917a283bd1
commit 2c14a8dee1
2 changed files with 5 additions and 7 deletions

View File

@ -345,12 +345,10 @@ class DownloadManager(
private fun getChaptersToDelete(chapters: List<Chapter>, manga: Manga): List<Chapter> {
// Retrieve the categories that are set to exclude from being deleted on read
val categoriesToExclude = preferences.removeExcludeCategories().get().map(String::toInt)
val categoriesForManga =
manga.let { it ->
db.getCategoriesForManga(it).executeAsBlocking()
val categoriesForManga = db.getCategoriesForManga(manga).executeAsBlocking()
.mapNotNull { it.id }
.takeUnless { it.isEmpty() }
} ?: listOf(0)
?: listOf(0)
return if (categoriesForManga.intersect(categoriesToExclude).isNotEmpty()) {
chapters.filterNot { it.read }

View File

@ -382,7 +382,7 @@
<string name="pref_remove_after_marked_as_read">After marked as read</string>
<string name="pref_remove_after_read">Automatically after reading</string>
<string name="pref_remove_bookmarked_chapters">Allow deleting bookmarked chapters</string>
<string name="pref_remove_exclude_categories">Categories to exclude in deleting</string>
<string name="pref_remove_exclude_categories">Excluded categories</string>
<string name="custom_dir">Custom location</string>
<string name="disabled">Disabled</string>
<string name="last_read_chapter">Last read chapter</string>