Move chapter preferences from PreferencesHelper to LibraryPrefrences (#8061)

This commit is contained in:
Andreas
2022-09-24 16:14:16 +02:00
committed by GitHub
parent 747cbd24cb
commit b5dca2eb09
15 changed files with 154 additions and 128 deletions
@@ -23,7 +23,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.lang.launchNonCancellableIO
import eu.kanade.tachiyomi.util.lang.launchNonCancellable
import eu.kanade.tachiyomi.util.lang.withUIContext
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.Job
@@ -236,7 +236,7 @@ class UpdatesPresenter(
* @param updatesItem the list of chapters to download.
*/
fun downloadChapters(updatesItem: List<UpdatesItem>) {
presenterScope.launchNonCancellableIO {
presenterScope.launchNonCancellable {
val groupedUpdates = updatesItem.groupBy { it.update.mangaId }.values
for (updates in groupedUpdates) {
val mangaId = updates.first().update.mangaId
@@ -255,7 +255,7 @@ class UpdatesPresenter(
* @param updatesItem list of chapters
*/
fun deleteChapters(updatesItem: List<UpdatesItem>) {
presenterScope.launchNonCancellableIO {
presenterScope.launchNonCancellable {
val groupedUpdates = updatesItem.groupBy { it.update.mangaId }.values
val deletedIds = groupedUpdates.flatMap { updates ->
val mangaId = updates.first().update.mangaId
@@ -268,7 +268,7 @@ class UpdatesPresenter(
val deletedUpdates = items.filter {
deletedIds.contains(it.update.chapterId)
}
if (deletedUpdates.isEmpty()) return@launchNonCancellableIO
if (deletedUpdates.isEmpty()) return@launchNonCancellable
// TODO: Don't do this fake status update
state.items = items.toMutableList().apply {