@momo-kits/native-kits 0.164.1-trustsans-12-debug → 0.165.1-beta.10-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codegraph/codegraph.db +0 -0
- package/.codegraph/daemon.log +100 -0
- package/CLAUDE.md +1 -0
- package/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +18 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +30 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +104 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +3 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +8 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +3 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +66 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +22 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +25 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +19 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +13 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +75 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +98 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +13 -3
- package/gradle.properties +1 -1
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/package.json +1 -1
- package/.codegraph/.gitignore +0 -5
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
5
|
+
import androidx.compose.runtime.State
|
|
6
|
+
import androidx.compose.runtime.mutableStateOf
|
|
7
|
+
import androidx.compose.runtime.remember
|
|
8
|
+
import androidx.compose.ui.InternalComposeUiApi
|
|
9
|
+
import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
|
|
10
|
+
import androidx.navigationevent.NavigationEventTransitionState
|
|
11
|
+
import vn.momo.kits.navigation.HostBackGestureBridge
|
|
12
|
+
|
|
13
|
+
// transitionState is a passive observer; its progress is touch.x / view width.
|
|
14
|
+
@OptIn(InternalComposeUiApi::class)
|
|
15
|
+
@Composable
|
|
16
|
+
actual fun rememberBackGestureProgress(): State<Float?> {
|
|
17
|
+
val dispatcher = LocalCompatNavigationEventDispatcherOwner.current?.navigationEventDispatcher
|
|
18
|
+
val progress = remember { mutableStateOf<Float?>(null) }
|
|
19
|
+
|
|
20
|
+
LaunchedEffect(dispatcher) {
|
|
21
|
+
if (dispatcher == null) {
|
|
22
|
+
progress.value = null
|
|
23
|
+
return@LaunchedEffect
|
|
24
|
+
}
|
|
25
|
+
dispatcher.transitionState.collect { state ->
|
|
26
|
+
progress.value = (state as? NavigationEventTransitionState.InProgress)
|
|
27
|
+
?.takeIf { it.direction == NavigationEventTransitionState.TRANSITIONING_BACK }
|
|
28
|
+
?.latestEvent
|
|
29
|
+
?.progress
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return progress
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
actual fun reportFloatingArrowBack(shouldUse: Boolean) {
|
|
37
|
+
HostBackGestureBridge.shouldUseFloatingArrowBack = shouldUse
|
|
38
|
+
}
|
|
@@ -17,6 +17,7 @@ import androidx.compose.ui.ExperimentalComposeUiApi
|
|
|
17
17
|
import androidx.compose.ui.InternalComposeUiApi
|
|
18
18
|
import androidx.compose.ui.Modifier
|
|
19
19
|
import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
|
|
20
|
+
import androidx.compose.ui.backhandler.BackHandler as ComposeBackHandler
|
|
20
21
|
import androidx.compose.ui.graphics.Color
|
|
21
22
|
import androidx.compose.ui.graphics.NativePaint
|
|
22
23
|
import androidx.compose.ui.graphics.toArgb
|
|
@@ -38,6 +39,7 @@ import platform.Foundation.NSBundle
|
|
|
38
39
|
import platform.UIKit.UIColor
|
|
39
40
|
import platform.UIKit.UIDevice
|
|
40
41
|
import platform.UIKit.UIScreen
|
|
42
|
+
import vn.momo.kits.navigation.AttachHostBackGesture
|
|
41
43
|
|
|
42
44
|
actual fun getPlatformName(): String = "iOS"
|
|
43
45
|
|
|
@@ -60,21 +62,29 @@ actual fun getStatusBarHeight(): Dp {
|
|
|
60
62
|
return WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
// Registered inside the NavHost destination, so an enabled one out-ranks NavHost's own
|
|
66
|
+
// predictive-back handler — that is how a screen opts out of swipe-back.
|
|
67
|
+
@Suppress("DEPRECATION")
|
|
68
|
+
@OptIn(ExperimentalComposeUiApi::class)
|
|
63
69
|
@Composable
|
|
64
70
|
actual fun BackHandler(enabled: Boolean, onBack: () -> Unit) {
|
|
71
|
+
ComposeBackHandler(enabled = enabled, onBack = onBack)
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
@OptIn(InternalComposeUiApi::class)
|
|
68
75
|
@Composable
|
|
69
76
|
actual fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit) {
|
|
77
|
+
// Detached on purpose: the scene's owner would arm Compose's own recogniser alongside the
|
|
78
|
+
// host's, and UIKit resolves that by driving one to .failed — a fabricated completed back.
|
|
79
|
+
// Enabled on purpose: dispatchOn* early-returns while disabled, muting the host-driven seek.
|
|
70
80
|
val navigationEventDispatcherOwner = remember {
|
|
71
81
|
object : NavigationEventDispatcherOwner {
|
|
72
|
-
override val navigationEventDispatcher = NavigationEventDispatcher()
|
|
73
|
-
isEnabled = false
|
|
74
|
-
}
|
|
82
|
+
override val navigationEventDispatcher = NavigationEventDispatcher()
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
|
|
86
|
+
AttachHostBackGesture(navigationEventDispatcherOwner.navigationEventDispatcher)
|
|
87
|
+
|
|
78
88
|
CompositionLocalProvider(
|
|
79
89
|
LocalCompatNavigationEventDispatcherOwner provides navigationEventDispatcherOwner,
|
|
80
90
|
content = content
|
package/gradle.properties
CHANGED
package/ios/native-kits.podspec
CHANGED
package/package.json
CHANGED
package/.codegraph/.gitignore
DELETED