@momo-kits/native-kits 0.160.1-scrolltotop.21-debug → 0.160.1-scrolltotop.21

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.
Files changed (135) hide show
  1. package/package.json +1 -1
  2. package/build.gradle.kts +0 -11
  3. package/compose/build.gradle.kts +0 -180
  4. package/compose/build.gradle.kts.backup +0 -180
  5. package/compose/compose.podspec +0 -47
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -9
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -117
  8. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  9. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  10. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  11. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -109
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -720
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -403
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -85
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -123
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -224
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -452
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -259
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -370
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -338
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -348
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -256
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -494
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -131
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -215
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -531
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -130
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -590
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -192
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -239
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -57
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -14
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -253
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -133
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -100
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -144
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -343
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -11
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -566
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -161
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -187
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -279
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -32
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -131
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -167
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -58
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -147
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -180
  128. package/gradle/libs.versions.toml +0 -58
  129. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  130. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  131. package/gradle.properties +0 -26
  132. package/gradlew +0 -252
  133. package/gradlew.bat +0 -94
  134. package/local.properties +0 -8
  135. package/settings.gradle.kts +0 -52
@@ -1,343 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.foundation.layout.Box
4
- import androidx.compose.foundation.layout.fillMaxSize
5
- import androidx.compose.runtime.Composable
6
- import androidx.compose.runtime.MutableState
7
- import androidx.compose.runtime.mutableStateOf
8
- import androidx.compose.runtime.staticCompositionLocalOf
9
- import androidx.compose.ui.Alignment
10
- import androidx.compose.ui.Modifier
11
- import androidx.navigation.NavController
12
- import androidx.navigation.toRoute
13
- import kotlinx.coroutines.CoroutineScope
14
- import kotlinx.coroutines.Dispatchers
15
- import kotlinx.coroutines.SupervisorJob
16
- import kotlinx.coroutines.cancel
17
- import kotlinx.coroutines.delay
18
- import kotlinx.coroutines.launch
19
- import kotlinx.serialization.Serializable
20
- import vn.momo.kits.components.PopupAction
21
- import vn.momo.kits.components.PopupNotify
22
- import vn.momo.kits.navigation.BottomHeader.*
23
- import vn.momo.kits.navigation.component.SnackBar
24
- import vn.momo.maxapi.IMaxApi
25
-
26
- class Navigator(
27
- private val navController: NavController,
28
- private val maxApi: IMaxApi?
29
- ) {
30
- private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
31
-
32
- fun push(screenName: String, content: @Composable () -> Unit, options: NavigationOptions? = null) {
33
- val route = DynamicScreenRegistry.register(screenName, content, options)
34
- navController.navigate(DynamicScreenRoute(route.id))
35
- }
36
-
37
- fun replace(screenName: String, content: @Composable () -> Unit, options: NavigationOptions? = null) {
38
- if (navController.previousBackStackEntry != null){
39
- val latestScreen = DynamicScreenRegistry.getLatestScreen()
40
- latestScreen?.let { DynamicScreenRegistry.unregisterScreen(it.id) }
41
- navController.popBackStack()
42
- push(screenName, content, options)
43
- }
44
- }
45
-
46
- fun onBackSafe(callBack: (() -> Unit)? = null) {
47
- val latestScreen = DynamicScreenRegistry.getLatestScreen()
48
- val options = latestScreen?.options
49
- if (options?.onBackHandler != null) {
50
- options.onBackHandler.invoke()
51
- return
52
- }
53
- val preventBack = options?.headerBackProps?.preventBack
54
- if (preventBack != null) {
55
- showModal(
56
- content = {
57
- PopupNotify(preventBack.copy(
58
- primary = PopupAction(
59
- title = preventBack.primary?.title ?: "",
60
- onPress = {
61
- preventBack.primary?.onPress?.invoke()
62
- pop(2, callBack) // close popup notify, then close the screen
63
- }
64
- )
65
- ))
66
- }
67
- )
68
- } else {
69
- pop(1, callBack)
70
- }
71
- }
72
-
73
- fun pop(count: Int = 1, callBack: (() -> Unit)? = null) {
74
- scope.launch {
75
- repeat(count) {
76
- if (OverplayComponentRegistry.getOverplayType() == OverplayComponentType.SNACK_BAR){
77
- dismissScreen()
78
- OverplayComponentRegistry.hardClearAfterDismiss()
79
- }
80
- else if (OverplayComponentRegistry.isOverplayShowing()){
81
- dismissOverplay()
82
- } else {
83
- dismissScreen()
84
- }
85
- }
86
- callBack?.invoke()
87
- }
88
- }
89
- private suspend fun dismissOverplay(isDelay: Boolean = true) {
90
- OverplayComponentRegistry.clear()
91
- if (isDelay) delay(300L)
92
- OverplayComponentRegistry.hardClearAfterDismiss()
93
- }
94
-
95
- private suspend fun dismissScreen() {
96
- if (navController.previousBackStackEntry != null){
97
- navController.popBackStack()
98
- delay(300L)
99
- DynamicScreenRegistry.getLatestScreen()?.let { it1 ->
100
- DynamicScreenRegistry.unregisterScreen(it1.id)
101
- }
102
- } else {
103
- maxApi?.dismiss { }
104
- }
105
- }
106
-
107
- fun present(screenName: String, content: @Composable () -> Unit, options: NavigationOptions? = null) {
108
- val route = DynamicScreenRegistry.register(screenName, content, options)
109
- navController.navigate(DynamicDialogRoute(route.id))
110
- }
111
-
112
- fun reset(screenName: String, content: @Composable () -> Unit, options: NavigationOptions? = null) {
113
- DynamicScreenRegistry.unregisterAll()
114
-
115
- val route = DynamicScreenRegistry.register(screenName, content, options)
116
- navController.navigate(DynamicScreenRoute(route.id)) {
117
- popUpTo(0) { inclusive = true }
118
- }
119
- }
120
-
121
- fun showModal(
122
- content: @Composable () -> Unit,
123
- barrierDismissible: Boolean = true,
124
- onDismiss: (() -> Unit)? = null
125
- ){
126
- val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
127
- OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.MODAL, false, barrierDismissible, onDismiss)
128
- }
129
-
130
- fun showBottomSheet(
131
- content: @Composable () -> Unit,
132
- isSurface: Boolean = false,
133
- barrierDismissible: Boolean = true,
134
- onDismiss: (() -> Unit)? = null,
135
- bottomSheetHeader: BottomHeader? = null
136
- ){
137
- val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
138
- OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.BOTTOM_SHEET, isSurface, barrierDismissible, onDismiss, bottomSheetHeader)
139
- }
140
-
141
- fun showSnackBar(snackBar: SnackBar, onDismiss: (() -> Unit)? = null) {
142
- val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
143
- scope.launch {
144
- OverplayComponentRegistry.registerOverplay(
145
- id = id,
146
- content = {
147
- SnackBar(snackBar, onDismiss)
148
- },
149
- type = OverplayComponentType.SNACK_BAR,
150
- onDismiss = onDismiss
151
- )
152
- }
153
- }
154
-
155
- fun hideSnackBar() {
156
- scope.launch {
157
- OverplayComponentRegistry.clear()
158
- delay(250L)
159
- OverplayComponentRegistry.hardClearAfterDismiss()
160
- }
161
- }
162
-
163
- fun dispose(){
164
- scope.cancel()
165
- }
166
- }
167
-
168
- val LocalNavigator = staticCompositionLocalOf<Navigator> {
169
- error("No NavigationStack provided")
170
- }
171
-
172
- @Serializable
173
- data class DynamicScreenRoute(val id: Int)
174
-
175
- @Serializable
176
- data class DynamicDialogRoute(val id: Int)
177
-
178
- data class DynamicScreen(
179
- val id: Int,
180
- val name: String,
181
- val content: @Composable () -> Unit,
182
- var options: NavigationOptions? = null
183
- )
184
-
185
- object DynamicScreenRegistry {
186
- private val screens = mutableMapOf<Int, DynamicScreen>()
187
- private var idCounter = 1
188
-
189
- fun register(screenName: String, content: @Composable () -> Unit, options: NavigationOptions?): DynamicScreenRoute {
190
- val id = idCounter++
191
- println("getLatestScreen register la ${id} ")
192
- screens[id] = DynamicScreen(
193
- id = id,
194
- name = screenName,
195
- content = content,
196
- options = options
197
- )
198
- return DynamicScreenRoute(id)
199
- }
200
-
201
- fun unregisterScreen(id: Int) {
202
- screens.remove(id)
203
- }
204
-
205
- fun getLatestScreen(): DynamicScreen?{
206
- return screens.entries.lastOrNull()?.value
207
- }
208
-
209
- fun unregisterAll(){
210
- val ids = screens.keys.toList()
211
- for (id in ids) {
212
- unregisterScreen(id)
213
- }
214
- }
215
-
216
- fun getScreen(id: Int): DynamicScreen? = screens[id]
217
-
218
- fun setOptions(id: Int, options: NavigationOptions){
219
- screens[id]?.options = options
220
- }
221
-
222
- fun scrollToTop() {
223
- //
224
- println("getLatestScreen la ${screens.keys.joinToString(separator = ",") { it.toString() }}")
225
- println("getLatestScreen la ${getLatestScreen()?.id}")
226
- println("getLatestScreen callback la ${getLatestScreen()?.options?.scrollData?.scrollToTopCallback}")
227
- getLatestScreen()?.options?.scrollData?.scrollToTopCallback?.invoke()
228
- }
229
- }
230
-
231
-
232
- sealed class OverplayComponentParams {
233
- class Modal(
234
- val onDismiss: (() -> Unit)? = null,
235
- val barrierDismissible: Boolean = true
236
- ) : OverplayComponentParams()
237
-
238
- class BottomSheet(
239
- val isSurface: Boolean = false,
240
- val onDismiss: (() -> Unit)? = null,
241
- val barrierDismissible: Boolean = true,
242
- val bottomSheetHeader: BottomHeader? = null,
243
- ) : OverplayComponentParams()
244
-
245
- class SnackBar() : OverplayComponentParams()
246
- }
247
-
248
- data class OverplayComponent(
249
- val id: Int,
250
- val type: OverplayComponentType? = null,
251
- val content: @Composable () -> Unit,
252
- val params: OverplayComponentParams? = null
253
- )
254
-
255
- enum class OverplayComponentType {
256
- MODAL, BOTTOM_SHEET, SNACK_BAR
257
- }
258
-
259
- object OverplayComponentRegistry {
260
- private var currentOverlayComponent : MutableState<OverplayComponent?> = mutableStateOf(null)
261
- private var requestClose: (() -> Unit)? = null
262
- internal fun bindClose(handler: (() -> Unit)?) {
263
- requestClose = handler
264
- }
265
-
266
- fun registerOverplay(
267
- id: Int,
268
- content: @Composable () -> Unit,
269
- type: OverplayComponentType,
270
- isSurface: Boolean = false,
271
- barrierDismissible: Boolean = true,
272
- onDismiss: (() -> Unit)?,
273
- bottomSheetHeader: BottomHeader? = null,
274
- ){
275
- val params = when(type){
276
- OverplayComponentType.MODAL -> OverplayComponentParams.Modal(onDismiss, barrierDismissible)
277
- OverplayComponentType.BOTTOM_SHEET -> OverplayComponentParams.BottomSheet(isSurface, onDismiss, barrierDismissible, bottomSheetHeader)
278
- OverplayComponentType.SNACK_BAR -> OverplayComponentParams.SnackBar()
279
- }
280
-
281
- currentOverlayComponent.value = OverplayComponent(
282
- id = id,
283
- type = type,
284
- content = content,
285
- params = params
286
- )
287
- }
288
-
289
- fun isOverplayShowing(): Boolean = currentOverlayComponent.value != null
290
-
291
- fun getOverplayType(): OverplayComponentType? = currentOverlayComponent.value?.type
292
-
293
- fun currentRootId(): Int? = currentOverlayComponent.value?.id
294
-
295
- fun clear(){
296
- if (requestClose != null) {
297
- requestClose?.invoke()
298
- } else {
299
- currentOverlayComponent.value = null
300
- }
301
- }
302
-
303
- internal fun hardClearAfterDismiss() {
304
- currentOverlayComponent.value = null
305
- requestClose = null
306
- }
307
-
308
- @Composable
309
- fun OverlayComponent(){
310
- val overplay = currentOverlayComponent.value ?: return
311
-
312
- when (val params = overplay.params) {
313
- is OverplayComponentParams.BottomSheet -> {
314
- BottomSheet(
315
- content = overplay.content,
316
- header = params.bottomSheetHeader ?: Title(),
317
- isSurface = params.isSurface,
318
- barrierDismissible = params.barrierDismissible,
319
- onDismiss = params.onDismiss
320
- )
321
- }
322
-
323
- is OverplayComponentParams.Modal -> {
324
- ModalScreen(
325
- content = overplay.content,
326
- barrierDismissible = params.barrierDismissible,
327
- onDismiss = params.onDismiss
328
- )
329
- }
330
-
331
- is OverplayComponentParams.SnackBar -> {
332
- Box(
333
- modifier = Modifier.fillMaxSize(),
334
- contentAlignment = Alignment.BottomCenter
335
- ) {
336
- overplay.content()
337
- }
338
- }
339
-
340
- null -> {}
341
- }
342
- }
343
- }
@@ -1,11 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.runtime.Composable
4
-
5
- @Composable
6
- internal expect fun RegisterScrollToTop(callback: (() -> Unit)?)
7
-
8
-
9
- internal expect fun onNavigatorEntered(navigator: Navigator)
10
-
11
- internal expect fun onNavigatorExited(navigator: Navigator)