From 988ec6a224652d9ef536b3e9ab0f5665e1656f76 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 29 Mar 2021 09:13:33 -0400 Subject: [PATCH] Fix nav overlay always showing on start (fixes #4736) --- .../ui/reader/viewer/pager/PagerConfig.kt | 15 ++++++++------- .../ui/reader/viewer/webtoon/WebtoonConfig.kt | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt index 40ca79a52..2965b8b90 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt @@ -8,6 +8,9 @@ import eu.kanade.tachiyomi.ui.reader.viewer.navigation.KindlishNavigation import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation import eu.kanade.tachiyomi.ui.reader.viewer.navigation.RightAndLeftNavigation import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.flow.drop +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -45,13 +48,11 @@ class PagerConfig( .register({ navigationMode = it }, { updateNavigation(navigationMode) }) preferences.pagerNavInverted() - .register( - { tappingInverted = it }, - { - navigator.invertMode = it - navigationModeChangedListener?.invoke() - } - ) + .register({ tappingInverted = it }, { navigator.invertMode = it }) + preferences.pagerNavInverted().asFlow() + .drop(1) + .onEach { navigationModeChangedListener?.invoke() } + .launchIn(scope) preferences.dualPageSplitPaged() .register( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt index 19a121e64..c5a585724 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonConfig.kt @@ -8,6 +8,9 @@ import eu.kanade.tachiyomi.ui.reader.viewer.navigation.KindlishNavigation import eu.kanade.tachiyomi.ui.reader.viewer.navigation.LNavigation import eu.kanade.tachiyomi.ui.reader.viewer.navigation.RightAndLeftNavigation import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.flow.drop +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -36,13 +39,11 @@ class WebtoonConfig( .register({ navigationMode = it }, { updateNavigation(it) }) preferences.webtoonNavInverted() - .register( - { tappingInverted = it }, - { - navigator.invertMode = it - navigationModeChangedListener?.invoke() - } - ) + .register({ tappingInverted = it }, { navigator.invertMode = it }) + preferences.webtoonNavInverted().asFlow() + .drop(1) + .onEach { navigationModeChangedListener?.invoke() } + .launchIn(scope) preferences.dualPageSplitWebtoon() .register({ dualPageSplit = it }, { imagePropertyChangedListener?.invoke() })