Minor cleanup for download delete exclusion
This commit is contained in:
parent
917a283bd1
commit
2c14a8dee1
2 changed files with 5 additions and 7 deletions
|
@ -345,12 +345,10 @@ class DownloadManager(
|
||||||
private fun getChaptersToDelete(chapters: List<Chapter>, manga: Manga): List<Chapter> {
|
private fun getChaptersToDelete(chapters: List<Chapter>, manga: Manga): List<Chapter> {
|
||||||
// Retrieve the categories that are set to exclude from being deleted on read
|
// Retrieve the categories that are set to exclude from being deleted on read
|
||||||
val categoriesToExclude = preferences.removeExcludeCategories().get().map(String::toInt)
|
val categoriesToExclude = preferences.removeExcludeCategories().get().map(String::toInt)
|
||||||
val categoriesForManga =
|
val categoriesForManga = db.getCategoriesForManga(manga).executeAsBlocking()
|
||||||
manga.let { it ->
|
|
||||||
db.getCategoriesForManga(it).executeAsBlocking()
|
|
||||||
.mapNotNull { it.id }
|
.mapNotNull { it.id }
|
||||||
.takeUnless { it.isEmpty() }
|
.takeUnless { it.isEmpty() }
|
||||||
} ?: listOf(0)
|
?: listOf(0)
|
||||||
|
|
||||||
return if (categoriesForManga.intersect(categoriesToExclude).isNotEmpty()) {
|
return if (categoriesForManga.intersect(categoriesToExclude).isNotEmpty()) {
|
||||||
chapters.filterNot { it.read }
|
chapters.filterNot { it.read }
|
||||||
|
|
|
@ -382,7 +382,7 @@
|
||||||
<string name="pref_remove_after_marked_as_read">After marked as read</string>
|
<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_after_read">Automatically after reading</string>
|
||||||
<string name="pref_remove_bookmarked_chapters">Allow deleting bookmarked chapters</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="custom_dir">Custom location</string>
|
||||||
<string name="disabled">Disabled</string>
|
<string name="disabled">Disabled</string>
|
||||||
<string name="last_read_chapter">Last read chapter</string>
|
<string name="last_read_chapter">Last read chapter</string>
|
||||||
|
|
Reference in a new issue