From 343cc08116b56ea845596806d55842242b990cfe Mon Sep 17 00:00:00 2001 From: NGB-Was-Taken <76197326+NGB-Was-Taken@users.noreply.github.com> Date: Sat, 21 Dec 2024 11:33:49 +0545 Subject: [PATCH 1/2] Apply "Downloaded only" filter to non library entries as well --- app/src/main/java/eu/kanade/domain/manga/model/Manga.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt index ebd2ad3e92..f41ec92491 100644 --- a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt @@ -35,7 +35,7 @@ fun Manga.chaptersFiltered(): Boolean { bookmarkedFilter != TriState.DISABLED } fun Manga.forceDownloaded(): Boolean { - return favorite && Injekt.get().downloadedOnly().get() + return Injekt.get().downloadedOnly().get() } fun Manga.toSManga(): SManga = SManga.create().also { From 76b7a6be2783d2ccdd72ddfac7f33cb31de0b2a3 Mon Sep 17 00:00:00 2001 From: NGB-Was-Taken <76197326+NGB-Was-Taken@users.noreply.github.com> Date: Sat, 25 Jan 2025 10:36:56 +0000 Subject: [PATCH 2/2] Remove the pointless forceDownloaded function. --- app/src/main/java/eu/kanade/domain/manga/model/Manga.kt | 5 +---- .../eu/kanade/presentation/manga/ChapterSettingsDialog.kt | 6 ++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt index f41ec92491..19fad606a1 100644 --- a/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt +++ b/app/src/main/java/eu/kanade/domain/manga/model/Manga.kt @@ -22,7 +22,7 @@ val Manga.readerOrientation: Long val Manga.downloadedFilter: TriState get() { - if (forceDownloaded()) return TriState.ENABLED_IS + if (Injekt.get().downloadedOnly().get()) return TriState.ENABLED_IS return when (downloadedFilterRaw) { Manga.CHAPTER_SHOW_DOWNLOADED -> TriState.ENABLED_IS Manga.CHAPTER_SHOW_NOT_DOWNLOADED -> TriState.ENABLED_NOT @@ -34,9 +34,6 @@ fun Manga.chaptersFiltered(): Boolean { downloadedFilter != TriState.DISABLED || bookmarkedFilter != TriState.DISABLED } -fun Manga.forceDownloaded(): Boolean { - return Injekt.get().downloadedOnly().get() -} fun Manga.toSManga(): SManga = SManga.create().also { it.url = url diff --git a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt index 5f98dbb862..663c8e6c66 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt @@ -26,8 +26,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.manga.model.downloadedFilter -import eu.kanade.domain.manga.model.forceDownloaded import eu.kanade.presentation.components.TabbedDialog import eu.kanade.presentation.components.TabbedDialogPaddings import kotlinx.collections.immutable.persistentListOf @@ -40,6 +40,8 @@ import tachiyomi.presentation.core.components.SortItem import tachiyomi.presentation.core.components.TriStateItem import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.theme.active +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get @Composable fun ChapterSettingsDialog( @@ -97,7 +99,7 @@ fun ChapterSettingsDialog( FilterPage( downloadFilter = manga?.downloadedFilter ?: TriState.DISABLED, onDownloadFilterChanged = onDownloadFilterChanged - .takeUnless { manga?.forceDownloaded() == true }, + .takeUnless { Injekt.get().downloadedOnly().get() == true }, unreadFilter = manga?.unreadFilter ?: TriState.DISABLED, onUnreadFilterChanged = onUnreadFilterChanged, bookmarkedFilter = manga?.bookmarkedFilter ?: TriState.DISABLED,