@momo-kits/native-kits 0.160.1-beta.20-debug → 0.160.1-beta.20
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/package.json +1 -1
- package/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -183
- package/compose/build.gradle.kts.backup +0 -183
- package/compose/compose.podspec +0 -47
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -125
- 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/Context.kt +0 -109
- 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 -305
- 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 -720
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -403
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -85
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -123
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -224
- 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 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -452
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -259
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -348
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -256
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -494
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -131
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -215
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -531
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -130
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -590
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -192
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
- 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 -239
- 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 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
- 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 -57
- 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/DeprecatedModifier.kt +0 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
- 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 -253
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -133
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -99
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -141
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -333
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -552
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -161
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
- 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 -187
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -279
- 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 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -131
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -167
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -57
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -67
- 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 -73
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -188
- package/gradle/libs.versions.toml +0 -60
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -26
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/local.properties +0 -8
- package/settings.gradle.kts +0 -52
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.utils
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
5
|
-
import androidx.compose.runtime.MutableState
|
|
6
|
-
import androidx.compose.runtime.getValue
|
|
7
|
-
import androidx.compose.runtime.mutableStateOf
|
|
8
|
-
import androidx.compose.runtime.remember
|
|
9
|
-
import org.jetbrains.compose.resources.DrawableResource
|
|
10
|
-
import org.jetbrains.compose.resources.InternalResourceApi
|
|
11
|
-
import org.jetbrains.compose.resources.ResourceItem
|
|
12
|
-
import org.jetbrains.compose.resources.readResourceBytes
|
|
13
|
-
|
|
14
|
-
@OptIn(InternalResourceApi::class)
|
|
15
|
-
@Composable
|
|
16
|
-
fun getResource(name: String): DrawableResource {
|
|
17
|
-
return DrawableResource(
|
|
18
|
-
"drawable:$name",
|
|
19
|
-
setOf(ResourceItem(setOf(), "drawable/$name", -1, -1))
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@OptIn(InternalResourceApi::class)
|
|
24
|
-
@Composable
|
|
25
|
-
fun readJson(name: String): String {
|
|
26
|
-
val path = name.plus(".json")
|
|
27
|
-
// AI-GENERATED START: try raw path first (Android assets find it at the root), then fall
|
|
28
|
-
// back to the fully-qualified compose-resources path (iOS NSBundle needs the
|
|
29
|
-
// "composeResources/<package>/" prefix because DefaultIOsResourceReader prepends only
|
|
30
|
-
// "compose-resources/" to whatever path you pass).
|
|
31
|
-
val candidatePaths = listOf(
|
|
32
|
-
path,
|
|
33
|
-
"composeResources/vn.momo.compose.resources/$path",
|
|
34
|
-
)
|
|
35
|
-
// AI-GENERATED END
|
|
36
|
-
|
|
37
|
-
val jsonContent by rememberState(path, { "" }) {
|
|
38
|
-
val cached = resourceCache.getOrPut(path) {
|
|
39
|
-
val content = candidatePaths.firstNotNullOfOrNull { candidate ->
|
|
40
|
-
try {
|
|
41
|
-
readResourceBytes(candidate).decodeToString()
|
|
42
|
-
} catch (_: Exception) {
|
|
43
|
-
null
|
|
44
|
-
}
|
|
45
|
-
}.orEmpty()
|
|
46
|
-
ResourceCache.JSON(content)
|
|
47
|
-
} as ResourceCache.JSON
|
|
48
|
-
|
|
49
|
-
cached.json
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return jsonContent
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
private val resourceCache = mutableMapOf<String, ResourceCache>()
|
|
57
|
-
|
|
58
|
-
private sealed interface ResourceCache {
|
|
59
|
-
class JSON(val json: String) : ResourceCache
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@Composable
|
|
63
|
-
fun <T> rememberState(
|
|
64
|
-
key: Any,
|
|
65
|
-
getDefault: () -> T,
|
|
66
|
-
block: suspend () -> T
|
|
67
|
-
): MutableState<T> {
|
|
68
|
-
val state = remember(key) { mutableStateOf(getDefault()) }
|
|
69
|
-
LaunchedEffect(key) {
|
|
70
|
-
state.value = block()
|
|
71
|
-
}
|
|
72
|
-
return state
|
|
73
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.utils
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
|
-
import vn.momo.kits.application.LocalComponentInformation
|
|
5
|
-
|
|
6
|
-
@Composable
|
|
7
|
-
fun getComponentId(
|
|
8
|
-
componentName: String? = null,
|
|
9
|
-
accessibilityLabel: String? = null,
|
|
10
|
-
): String {
|
|
11
|
-
val componentInformation = LocalComponentInformation.current
|
|
12
|
-
if (accessibilityLabel != null) return accessibilityLabel
|
|
13
|
-
if (componentInformation?.componentId != null) return componentInformation.componentId
|
|
14
|
-
return ""
|
|
15
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.utils
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.layout.WindowInsets
|
|
4
|
-
import androidx.compose.foundation.layout.asPaddingValues
|
|
5
|
-
import androidx.compose.foundation.layout.systemBars
|
|
6
|
-
import androidx.compose.runtime.Composable
|
|
7
|
-
import androidx.compose.ui.Modifier
|
|
8
|
-
import androidx.compose.ui.composed
|
|
9
|
-
import androidx.compose.ui.draw.drawBehind
|
|
10
|
-
import androidx.compose.ui.geometry.Offset
|
|
11
|
-
import androidx.compose.ui.graphics.Color
|
|
12
|
-
import androidx.compose.ui.platform.LocalDensity
|
|
13
|
-
import androidx.compose.ui.unit.Dp
|
|
14
|
-
import androidx.compose.ui.unit.dp
|
|
15
|
-
import androidx.compose.ui.unit.min
|
|
16
|
-
import vn.momo.kits.const.AppNavigationBar
|
|
17
|
-
import vn.momo.kits.const.AppStatusBar
|
|
18
|
-
import vn.momo.kits.platform.getPlatformName
|
|
19
|
-
import kotlin.math.abs
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
internal fun Modifier.bottomBorder(strokeWidth: Dp, color: Color) = composed(
|
|
23
|
-
factory = {
|
|
24
|
-
val density = LocalDensity.current
|
|
25
|
-
val strokeWidthPx = density.run { strokeWidth.toPx() }
|
|
26
|
-
if (strokeWidth > 0.dp) {
|
|
27
|
-
Modifier.drawBehind {
|
|
28
|
-
val width = size.width
|
|
29
|
-
val height = size.height - strokeWidthPx / 2
|
|
30
|
-
|
|
31
|
-
drawLine(
|
|
32
|
-
color = color,
|
|
33
|
-
start = Offset(x = 0f, y = height),
|
|
34
|
-
end = Offset(x = width, y = height),
|
|
35
|
-
strokeWidth = strokeWidthPx
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
Modifier
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
inline fun <T> Boolean.ifTrue(trueCase: T, falseCase: T): T = if (this) trueCase else falseCase
|
|
45
|
-
inline fun <T> String.ifNotNull(trueCase: T, falseCase: T): T =
|
|
46
|
-
if (this.isBlank()) falseCase else trueCase
|
|
47
|
-
|
|
48
|
-
fun formatNumberToMoney(number: Long, currency: String = "đ"): String {
|
|
49
|
-
if (number == 0L) {
|
|
50
|
-
return "0$currency"
|
|
51
|
-
}
|
|
52
|
-
val array = mutableListOf<Char>()
|
|
53
|
-
var result = ""
|
|
54
|
-
var isNegative = false
|
|
55
|
-
|
|
56
|
-
if (number < 0) {
|
|
57
|
-
isNegative = true
|
|
58
|
-
}
|
|
59
|
-
val numberString = abs(number).toString() // Convert to Int to avoid decimal places
|
|
60
|
-
if (numberString.length < 3) {
|
|
61
|
-
return numberString + currency
|
|
62
|
-
}
|
|
63
|
-
var count = 0
|
|
64
|
-
for (i in numberString.length - 1 downTo 0) {
|
|
65
|
-
count += 1
|
|
66
|
-
array.add(numberString[i])
|
|
67
|
-
if (count == 3 && i >= 1) {
|
|
68
|
-
array.add('.')
|
|
69
|
-
count = 0
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
for (i in array.size - 1 downTo 0) {
|
|
74
|
-
result += array[i]
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (isNegative) {
|
|
78
|
-
result = "-$result"
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return result + currency
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@Composable
|
|
85
|
-
fun getAppStatusBarHeight(): Dp {
|
|
86
|
-
return if (AppStatusBar.current == 0.dp) {
|
|
87
|
-
WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
88
|
-
} else {
|
|
89
|
-
AppStatusBar.current
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
@Composable
|
|
94
|
-
fun getNavigationBarHeight(): Dp {
|
|
95
|
-
return if (AppNavigationBar.current == 0.dp) {
|
|
96
|
-
val systemBottomPadding = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
97
|
-
if (getPlatformName() == "iOS") {
|
|
98
|
-
min(systemBottomPadding, 21.dp)
|
|
99
|
-
} else {
|
|
100
|
-
systemBottomPadding
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
AppNavigationBar.current
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.platform
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.layout.Box
|
|
4
|
-
import androidx.compose.foundation.layout.WindowInsets
|
|
5
|
-
import androidx.compose.foundation.layout.asPaddingValues
|
|
6
|
-
import androidx.compose.foundation.layout.fillMaxSize
|
|
7
|
-
import androidx.compose.foundation.layout.systemBars
|
|
8
|
-
import androidx.compose.runtime.Composable
|
|
9
|
-
import androidx.compose.runtime.CompositionLocalProvider
|
|
10
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
11
|
-
import androidx.compose.runtime.getValue
|
|
12
|
-
import androidx.compose.runtime.mutableStateOf
|
|
13
|
-
import androidx.compose.runtime.remember
|
|
14
|
-
import androidx.compose.runtime.setValue
|
|
15
|
-
import androidx.compose.ui.ExperimentalComposeUiApi
|
|
16
|
-
import androidx.compose.ui.InternalComposeUiApi
|
|
17
|
-
import androidx.compose.ui.Modifier
|
|
18
|
-
import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
|
|
19
|
-
import androidx.compose.ui.graphics.Color
|
|
20
|
-
import androidx.compose.ui.graphics.NativePaint
|
|
21
|
-
import androidx.compose.ui.graphics.toArgb
|
|
22
|
-
import androidx.compose.ui.semantics.SemanticsPropertyKey
|
|
23
|
-
import androidx.compose.ui.semantics.semantics
|
|
24
|
-
import androidx.compose.ui.unit.Dp
|
|
25
|
-
import androidx.compose.ui.unit.dp
|
|
26
|
-
import androidx.compose.ui.viewinterop.UIKitInteropProperties
|
|
27
|
-
import androidx.compose.ui.viewinterop.UIKitView
|
|
28
|
-
import cocoapods.lottie_ios.CompatibleAnimation
|
|
29
|
-
import cocoapods.lottie_ios.CompatibleAnimationKeypath
|
|
30
|
-
import cocoapods.lottie_ios.CompatibleAnimationView
|
|
31
|
-
import kotlinx.cinterop.ExperimentalForeignApi
|
|
32
|
-
import kotlinx.cinterop.get
|
|
33
|
-
import kotlinx.cinterop.memScoped
|
|
34
|
-
import androidx.navigationevent.NavigationEventDispatcher
|
|
35
|
-
import androidx.navigationevent.NavigationEventDispatcherOwner
|
|
36
|
-
import org.jetbrains.skia.FilterBlurMode
|
|
37
|
-
import org.jetbrains.skia.MaskFilter
|
|
38
|
-
import platform.Foundation.NSBundle
|
|
39
|
-
import platform.UIKit.UIColor
|
|
40
|
-
import platform.UIKit.UIDevice
|
|
41
|
-
import platform.UIKit.UIScreen
|
|
42
|
-
|
|
43
|
-
actual fun getPlatformName(): String = "iOS"
|
|
44
|
-
|
|
45
|
-
@OptIn(ExperimentalForeignApi::class)
|
|
46
|
-
@Composable
|
|
47
|
-
actual fun getScreenDimensions(): ScreenDimension = memScoped {
|
|
48
|
-
val config = UIScreen.mainScreen.bounds.ptr[0]
|
|
49
|
-
return ScreenDimension(
|
|
50
|
-
config.size.width.toInt(),
|
|
51
|
-
config.size.height.toInt()
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
actual fun NativePaint.setMaskFilter(blurRadius: Float) {
|
|
56
|
-
this.maskFilter = MaskFilter.makeBlur(FilterBlurMode.NORMAL, blurRadius / 2, true)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@Composable
|
|
60
|
-
actual fun getStatusBarHeight(): Dp {
|
|
61
|
-
return WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@Composable
|
|
65
|
-
actual fun BackHandler(enabled: Boolean, onBack: () -> Unit) {
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@OptIn(InternalComposeUiApi::class)
|
|
69
|
-
@Composable
|
|
70
|
-
actual fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit) {
|
|
71
|
-
val navigationEventDispatcherOwner = remember {
|
|
72
|
-
object : NavigationEventDispatcherOwner {
|
|
73
|
-
override val navigationEventDispatcher = NavigationEventDispatcher().apply {
|
|
74
|
-
isEnabled = false
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
CompositionLocalProvider(
|
|
80
|
-
LocalCompatNavigationEventDispatcherOwner provides navigationEventDispatcherOwner,
|
|
81
|
-
content = content
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@Composable
|
|
86
|
-
actual fun getScreenHeight(): Dp {
|
|
87
|
-
return getScreenDimensions().height.dp
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
actual fun getOSVersion(): OSVersion = OSVersion.IOS(
|
|
91
|
-
major = UIDevice.currentDevice.systemVersion.substringBefore(".").toIntOrNull() ?: 0
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
@OptIn(ExperimentalForeignApi::class, ExperimentalComposeUiApi::class)
|
|
95
|
-
@Composable
|
|
96
|
-
actual fun LottieAnimation(
|
|
97
|
-
path: String,
|
|
98
|
-
tintColor: Color?,
|
|
99
|
-
bgColor: Color?,
|
|
100
|
-
placedAsOverlay: Boolean,
|
|
101
|
-
useCompose: Boolean,
|
|
102
|
-
modifier: Modifier
|
|
103
|
-
) {
|
|
104
|
-
// AI-GENERATED START: dispatch to Compottie renderer when useCompose
|
|
105
|
-
if (useCompose) {
|
|
106
|
-
ComposeLottieAnimation(path, tintColor, bgColor, placedAsOverlay, modifier)
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
// AI-GENERATED END: dispatch to Compottie renderer when useCompose
|
|
110
|
-
|
|
111
|
-
var animation by remember { mutableStateOf<CompatibleAnimation?>(null) }
|
|
112
|
-
|
|
113
|
-
LaunchedEffect(Unit) {
|
|
114
|
-
animation = CompatibleAnimation(name = "compose-resources/composeResources/vn.momo.compose.resources/".plus(path), subdirectory = null, NSBundle.mainBundle)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
when (val value = animation) {
|
|
118
|
-
null -> {
|
|
119
|
-
Box(modifier)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
else -> {
|
|
123
|
-
Box(modifier) {
|
|
124
|
-
UIKitView(
|
|
125
|
-
modifier = Modifier.fillMaxSize(),
|
|
126
|
-
properties = UIKitInteropProperties(placedAsOverlay = placedAsOverlay),
|
|
127
|
-
factory = {
|
|
128
|
-
CompatibleAnimationView(value).apply {
|
|
129
|
-
translatesAutoresizingMaskIntoConstraints = true
|
|
130
|
-
|
|
131
|
-
setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
|
|
132
|
-
|
|
133
|
-
setLoopAnimationCount(-1.0)
|
|
134
|
-
setAnimationSpeed(1.0)
|
|
135
|
-
|
|
136
|
-
if (tintColor != null) {
|
|
137
|
-
val uiColor = tintColor.toUIColor()
|
|
138
|
-
setColorValue(uiColor,
|
|
139
|
-
CompatibleAnimationKeypath("**.Fill 1.Color")
|
|
140
|
-
)
|
|
141
|
-
setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill.Color"))
|
|
142
|
-
setColorValue(uiColor, CompatibleAnimationKeypath("**.Color"))
|
|
143
|
-
setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke 1.Color"))
|
|
144
|
-
setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
play()
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
update = { view ->
|
|
152
|
-
view.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
|
|
153
|
-
|
|
154
|
-
if (tintColor != null) {
|
|
155
|
-
val uiColor = tintColor.toUIColor()
|
|
156
|
-
|
|
157
|
-
view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill 1.Color"))
|
|
158
|
-
view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill.Color"))
|
|
159
|
-
view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Color"))
|
|
160
|
-
view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke 1.Color"))
|
|
161
|
-
view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
fun Color.toUIColor(): UIColor {
|
|
171
|
-
val argb = this.toArgb()
|
|
172
|
-
|
|
173
|
-
val a = ((argb shr 24) and 0xFF) / 255.0
|
|
174
|
-
val r = ((argb shr 16) and 0xFF) / 255.0
|
|
175
|
-
val g = ((argb shr 8) and 0xFF) / 255.0
|
|
176
|
-
val b = (argb and 0xFF) / 255.0
|
|
177
|
-
|
|
178
|
-
return UIColor(
|
|
179
|
-
red = r,
|
|
180
|
-
green = g,
|
|
181
|
-
blue = b,
|
|
182
|
-
alpha = a
|
|
183
|
-
)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
actual fun NativePaint.setColor(color: Color){
|
|
187
|
-
this.color = color.toArgb()
|
|
188
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
[versions]
|
|
2
|
-
android-compileSdk = "36"
|
|
3
|
-
android-minSdk = "24"
|
|
4
|
-
android-targetSdk = "36"
|
|
5
|
-
ktor-version = "3.0.0-rc-1"
|
|
6
|
-
coroutines = "1.9.0"
|
|
7
|
-
kotlin = "2.3.10"
|
|
8
|
-
kSerialize = "1.7.1"
|
|
9
|
-
compose = "1.10.3"
|
|
10
|
-
navigation-multiplatform = "2.9.2"
|
|
11
|
-
coil3-multiplatform = "3.0.0-alpha10"
|
|
12
|
-
androidGradlePlugin = "8.13.2"
|
|
13
|
-
r8 = "8.9.35"
|
|
14
|
-
kotlinx-datetime = "0.7.1"
|
|
15
|
-
airbnb-lottie = "5.2.0"
|
|
16
|
-
compottie = "2.2.0-beta01"
|
|
17
|
-
androidx-activity = "1.9.1"
|
|
18
|
-
androidx-appcompat = "1.7.0"
|
|
19
|
-
material = "1.10.0"
|
|
20
|
-
maxapi = "0.1.1"
|
|
21
|
-
vanniktechMavenPublish = "0.34.0"
|
|
22
|
-
kits = "0.159.1-beta.7"
|
|
23
|
-
nativemaxapi = "0.0.6"
|
|
24
|
-
|
|
25
|
-
[libraries]
|
|
26
|
-
ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor-version" }
|
|
27
|
-
ktor-client-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.ref = "ktor-version" }
|
|
28
|
-
ktor-client-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor-version" }
|
|
29
|
-
jetbrains-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
|
|
30
|
-
jetbrains-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
|
|
31
|
-
jetbrains-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }
|
|
32
|
-
jetbrains-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization", version.ref = "kSerialize" }
|
|
33
|
-
jetbrains-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kSerialize" }
|
|
34
|
-
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" }
|
|
35
|
-
compose-ui-backhandler = { module = "org.jetbrains.compose.ui:ui-backhandler", version.ref = "compose" }
|
|
36
|
-
navigation-multiplatform = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigation-multiplatform" }
|
|
37
|
-
coil-multiplatform-core = { module = "io.coil-kt.coil3:coil-core", version.ref = "coil3-multiplatform" }
|
|
38
|
-
coil-multiplatform-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil3-multiplatform" }
|
|
39
|
-
coil-multiplatform-network-ktor = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coil3-multiplatform" }
|
|
40
|
-
r8 = { module = "com.android.tools:r8", version.ref = "r8" }
|
|
41
|
-
airbnb-lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "airbnb-lottie" }
|
|
42
|
-
compottie = { module = "io.github.alexzhirkevich:compottie", version.ref = "compottie" }
|
|
43
|
-
native-max-api = { group = "vn.momo.maxapi", name = "NativeMaxApi", version.ref = "nativemaxapi" }
|
|
44
|
-
kits = { module = "vn.momo.kits:kits", version.ref = "kits" }
|
|
45
|
-
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
|
|
46
|
-
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
|
|
47
|
-
material = { module = "com.google.android.material:material", version.ref = "material" }
|
|
48
|
-
|
|
49
|
-
[plugins]
|
|
50
|
-
jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|
51
|
-
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
|
52
|
-
jetbrains-kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
|
53
|
-
jetbrains-kotlin-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
|
|
54
|
-
jetbrains-kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
|
55
|
-
jetbrains-kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
|
56
|
-
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
|
57
|
-
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
|
|
58
|
-
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
|
|
59
|
-
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
|
|
60
|
-
vanniktech-mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktechMavenPublish" }
|
|
Binary file
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#Thu Jul 31 17:05:40 ICT 2025
|
|
2
|
-
distributionBase=GRADLE_USER_HOME
|
|
3
|
-
distributionPath=wrapper/dists
|
|
4
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
|
|
5
|
-
networkTimeout=10000
|
|
6
|
-
validateDistributionUrl=true
|
|
7
|
-
zipStoreBase=GRADLE_USER_HOME
|
|
8
|
-
zipStorePath=wrapper/dists
|
package/gradle.properties
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#Kotlin
|
|
2
|
-
kotlin.code.style=official
|
|
3
|
-
kotlin.daemon.jvmargs=-Xmx6144M
|
|
4
|
-
|
|
5
|
-
#Gradle
|
|
6
|
-
org.gradle.jvmargs=-Xmx8192M -Dfile.encoding=UTF-8
|
|
7
|
-
org.gradle.configuration-cache=false
|
|
8
|
-
org.gradle.caching=true
|
|
9
|
-
|
|
10
|
-
#Android
|
|
11
|
-
android.nonTransitiveRClass=true
|
|
12
|
-
android.useAndroidX=true
|
|
13
|
-
|
|
14
|
-
#KMP
|
|
15
|
-
kotlin.apple.xcodeCompatibility.nowarn=true
|
|
16
|
-
|
|
17
|
-
# Publishing
|
|
18
|
-
name="ComposeKits"
|
|
19
|
-
group=vn.momo.kits
|
|
20
|
-
artifact.id=kits
|
|
21
|
-
version=0.160.1-beta.20
|
|
22
|
-
|
|
23
|
-
repo=GitLab
|
|
24
|
-
url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
|
|
25
|
-
gitlab.user=upload_packages
|
|
26
|
-
gitlab.password=gldt-CtTSGmzz57sUL9cnjdaQ
|