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