From 3c947f323fad28a378545f95064b43c1b915fb5f Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 2 May 2021 13:22:32 -0400 Subject: [PATCH] Fix navigation issue when activity is recreated --- .../main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 4f8359d088..2fbd0baa42 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -55,7 +55,9 @@ import eu.kanade.tachiyomi.util.system.InternalResourceHelper import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import timber.log.Timber import java.util.Date import java.util.concurrent.TimeUnit @@ -224,8 +226,9 @@ class MainActivity : BaseViewBindingActivity() { .asImmediateFlow { binding.downloadedOnly.isVisible = it } .launchIn(lifecycleScope) - preferences.incognitoMode() - .asImmediateFlow { + preferences.incognitoMode().asFlow() + .drop(1) + .onEach { binding.incognitoMode.isVisible = it // Close BrowseSourceController and its MangaController child when incognito mode is disabled