From b034f503f8ce9327187c2024b7ee74779f397bb8 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sun, 17 Jul 2022 02:45:05 +0600 Subject: [PATCH] MangaPresenter: Incognito and downloaded only label related tweaks (#7535) When manga screen takes time to load incognito and downloaded only label doesn't show up. It's fixed in the pr. --- .../kanade/tachiyomi/ui/manga/MangaPresenter.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index d7bf55bf3..2e4cd5490 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -147,6 +147,17 @@ class MangaPresenter( _state.update { if (it is MangaScreenState.Success) func(it) else it } } + private var incognitoMode = false + set(value) { + updateSuccessState { it.copy(isIncognitoMode = value) } + field = value + } + private var downloadedOnlyMode = false + set(value) { + updateSuccessState { it.copy(isDownloadedOnlyMode = value) } + field = value + } + override fun onCreate(savedState: Bundle?) { super.onCreate(savedState) @@ -174,6 +185,8 @@ class MangaPresenter( isFromSource = isFromSource, trackingAvailable = trackManager.hasLoggedServices(), chapters = chapterItems, + isIncognitoMode = incognitoMode, + isDownloadedOnlyMode = downloadedOnlyMode ) // Update state @@ -195,13 +208,13 @@ class MangaPresenter( preferences.incognitoMode() .asImmediateFlow { incognito -> - updateSuccessState { it.copy(isIncognitoMode = incognito) } + incognitoMode = incognito } .launchIn(presenterScope) preferences.downloadedOnly() .asImmediateFlow { downloadedOnly -> - updateSuccessState { it.copy(isDownloadedOnlyMode = downloadedOnly) } + downloadedOnlyMode = downloadedOnly } .launchIn(presenterScope) }