From cb9c5a35cb3065bb2c153951861d72c9639d57b3 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 13 Oct 2021 09:13:38 -0400 Subject: [PATCH] Minor cleanup --- .../eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 992906fd96..ce6acd2bc9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -105,7 +105,7 @@ class ReaderPresenter( val chaptersForReader = when { (preferences.skipRead() || preferences.skipFiltered()) -> { - val list = dbChapters.filterNot { + val filteredChapters = dbChapters.filterNot { when { preferences.skipRead() && it.read -> true preferences.skipFiltered() -> { @@ -119,13 +119,12 @@ class ReaderPresenter( else -> false } } - .toMutableList() - val find = list.find { it.id == chapterId } - if (find == null) { - list.add(selectedChapter) + if (filteredChapters.any { it.id == chapterId }) { + filteredChapters + } else { + filteredChapters + listOf(selectedChapter) } - list } else -> dbChapters }