Allow exclusion on Delete After Read per category (#5857)
* Added the exclude category from delete after being read * Stopped it from adding a wildcard to the import * Placed the remove after read to the download manager
This commit is contained in:
@@ -409,6 +409,7 @@ class ReaderPresenter(
|
||||
val currentChapterPosition = chapterList.indexOf(currentChapter)
|
||||
val removeAfterReadSlots = preferences.removeAfterReadSlots()
|
||||
val chapterToDelete = chapterList.getOrNull(currentChapterPosition - removeAfterReadSlots)
|
||||
|
||||
// Check if deleting option is enabled and chapter exists
|
||||
if (removeAfterReadSlots != -1 && chapterToDelete != null) {
|
||||
enqueueDeleteReadChapters(chapterToDelete)
|
||||
|
||||
@@ -21,6 +21,7 @@ import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
import eu.kanade.tachiyomi.util.preference.multiSelectListPreference
|
||||
import eu.kanade.tachiyomi.util.preference.onClick
|
||||
import eu.kanade.tachiyomi.util.preference.preference
|
||||
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
||||
@@ -44,6 +45,9 @@ class SettingsDownloadController : SettingsController() {
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.pref_category_downloads
|
||||
|
||||
val dbCategories = db.getCategories().executeAsBlocking()
|
||||
val categories = listOf(Category.createDefault(context)) + dbCategories
|
||||
|
||||
preference {
|
||||
key = Keys.downloadsDirectory
|
||||
titleRes = R.string.pref_download_directory
|
||||
@@ -93,10 +97,26 @@ class SettingsDownloadController : SettingsController() {
|
||||
titleRes = R.string.pref_remove_bookmarked_chapters
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
multiSelectListPreference {
|
||||
key = Keys.removeExcludeCategories
|
||||
titleRes = R.string.pref_remove_exclude_categories
|
||||
entries = categories.map { it.name }.toTypedArray()
|
||||
entryValues = categories.map { it.id.toString() }.toTypedArray()
|
||||
|
||||
val dbCategories = db.getCategories().executeAsBlocking()
|
||||
val categories = listOf(Category.createDefault(context)) + dbCategories
|
||||
preferences.removeExcludeCategories().asFlow()
|
||||
.onEach { mutable ->
|
||||
val selected = mutable
|
||||
.mapNotNull { id -> categories.find { it.id == id.toInt() } }
|
||||
.sortedBy { it.order }
|
||||
|
||||
summary = if (selected.isEmpty()) {
|
||||
resources?.getString(R.string.none)
|
||||
} else {
|
||||
selected.joinToString { it.name }
|
||||
}
|
||||
}.launchIn(viewScope)
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_category_auto_download
|
||||
|
||||
Reference in New Issue
Block a user