Add option to prevent deleting bookmarked chapters (closes #2082)

This commit is contained in:
arkon
2020-08-09 12:18:05 -04:00
parent b6a1e89535
commit dbaac69fad
6 changed files with 30 additions and 8 deletions

View File

@@ -494,8 +494,14 @@ class MangaPresenter(
* @param chapters the chapters to delete.
*/
private fun deleteChaptersInternal(chapters: List<ChapterItem>) {
downloadManager.deleteChapters(chapters, manga, source)
chapters.forEach {
val filteredChapters = if (!preferences.removeBookmarkedChapters()) {
chapters.filterNot { it.bookmark }
} else {
chapters
}
downloadManager.deleteChapters(filteredChapters, manga, source)
filteredChapters.forEach {
it.status = Download.NOT_DOWNLOADED
it.download = null
}

View File

@@ -84,6 +84,11 @@ class SettingsDownloadController : SettingsController() {
defaultValue = "-1"
summary = "%s"
}
switchPreference {
key = Keys.removeBookmarkedChapters
titleRes = R.string.pref_remove_bookmarked_chapters
defaultValue = false
}
}
val dbCategories = db.getCategories().executeAsBlocking()