Эх сурвалжийг харах

Fix nav overlay always showing on start (fixes #4736)

arkon 4 жил өмнө
parent
commit
988ec6a224

+ 8 - 7
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(

+ 8 - 7
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() })