@momo-kits/native-kits 0.162.0-debug → 0.162.1-beta.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.
Files changed (147) hide show
  1. package/.claude/settings.local.json +32 -0
  2. package/package.json +1 -1
  3. package/publish.sh +2 -2
  4. package/build.gradle.kts +0 -11
  5. package/compose/build.gradle.kts +0 -186
  6. package/compose/build.gradle.kts.backup +0 -186
  7. package/compose/compose.podspec +0 -47
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -123
  10. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  11. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -109
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -921
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -403
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -85
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -123
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -224
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -452
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -259
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -338
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -348
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -256
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -494
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -131
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -215
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -531
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -135
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -590
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -192
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -239
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -57
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -14
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -253
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -133
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -100
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -145
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -345
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -556
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -161
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -187
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -279
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -32
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -131
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -167
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -72
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -66
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -70
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -33
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -186
  131. package/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  132. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  133. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
  134. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
  135. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
  136. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
  137. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
  138. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
  139. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
  140. package/gradle/libs.versions.toml +0 -67
  141. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  142. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  143. package/gradle.properties +0 -26
  144. package/gradlew +0 -252
  145. package/gradlew.bat +0 -94
  146. package/local.properties +0 -8
  147. package/settings.gradle.kts +0 -64
@@ -1,70 +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
- val candidatePaths = listOf(
28
- path,
29
- "composeResources/vn.momo.compose.resources/$path",
30
- )
31
-
32
- val jsonContent by rememberState(path, { "" }) {
33
- val cached = resourceCache.getOrPut(path) {
34
- var content = ""
35
- for (candidate in candidatePaths) {
36
- try {
37
- content = readResourceBytes(candidate).decodeToString()
38
- break
39
- } catch (_: Exception) {
40
- // try next candidate
41
- }
42
- }
43
- ResourceCache.JSON(content)
44
- } as ResourceCache.JSON
45
-
46
- cached.json
47
- }
48
-
49
- return jsonContent
50
- }
51
-
52
-
53
- private val resourceCache = mutableMapOf<String, ResourceCache>()
54
-
55
- private sealed interface ResourceCache {
56
- class JSON(val json: String) : ResourceCache
57
- }
58
-
59
- @Composable
60
- fun <T> rememberState(
61
- key: Any,
62
- getDefault: () -> T,
63
- block: suspend () -> T
64
- ): MutableState<T> {
65
- val state = remember(key) { mutableStateOf(getDefault()) }
66
- LaunchedEffect(key) {
67
- state.value = block()
68
- }
69
- return state
70
- }
@@ -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,33 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.DisposableEffect
5
- import platform.Foundation.NSNotification
6
- import platform.Foundation.NSNotificationCenter
7
- import platform.Foundation.NSOperationQueue
8
- import platform.darwin.NSObjectProtocol
9
-
10
- private const val STATUS_BAR_TAPPED_NOTIFICATION = "statusBarSelected"
11
-
12
- @Composable
13
- internal actual fun RegisterScrollToTop(callback: (() -> Unit)?) {
14
- val maxApi = LocalMaxApi.current
15
- DisposableEffect(callback) {
16
- val cb = callback
17
- val token: NSObjectProtocol? = if (cb != null) {
18
- NSNotificationCenter.defaultCenter.addObserverForName(
19
- name = STATUS_BAR_TAPPED_NOTIFICATION,
20
- `object` = null,
21
- queue = NSOperationQueue.mainQueue,
22
- ) { _: NSNotification? ->
23
- runCatching { cb() }.onFailure {
24
- maxApi?.logFile("[ScrollToTop] callback threw: ${it.message}") {}
25
-
26
- }
27
- }
28
- } else null
29
- onDispose {
30
- token?.let { NSNotificationCenter.defaultCenter.removeObserver(it) }
31
- }
32
- }
33
- }
@@ -1,186 +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
- modifier: Modifier,
102
- useCompose: Boolean
103
- ) {
104
- if (useCompose) {
105
- ComposeLottieAnimation(path, tintColor, bgColor, modifier)
106
- return
107
- }
108
-
109
- var animation by remember { mutableStateOf<CompatibleAnimation?>(null) }
110
-
111
- LaunchedEffect(Unit) {
112
- animation = CompatibleAnimation(name = "compose-resources/composeResources/vn.momo.compose.resources/".plus(path), subdirectory = null, NSBundle.mainBundle)
113
- }
114
-
115
- when (val value = animation) {
116
- null -> {
117
- Box(modifier)
118
- }
119
-
120
- else -> {
121
- Box(modifier) {
122
- UIKitView(
123
- modifier = Modifier.fillMaxSize(),
124
- properties = UIKitInteropProperties(placedAsOverlay = placedAsOverlay),
125
- factory = {
126
- CompatibleAnimationView(value).apply {
127
- translatesAutoresizingMaskIntoConstraints = true
128
-
129
- setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
130
-
131
- setLoopAnimationCount(-1.0)
132
- setAnimationSpeed(1.0)
133
-
134
- if (tintColor != null) {
135
- val uiColor = tintColor.toUIColor()
136
- setColorValue(uiColor,
137
- CompatibleAnimationKeypath("**.Fill 1.Color")
138
- )
139
- setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill.Color"))
140
- setColorValue(uiColor, CompatibleAnimationKeypath("**.Color"))
141
- setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke 1.Color"))
142
- setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
143
- }
144
-
145
- play()
146
- }
147
- },
148
-
149
- update = { view ->
150
- view.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
151
-
152
- if (tintColor != null) {
153
- val uiColor = tintColor.toUIColor()
154
-
155
- view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill 1.Color"))
156
- view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill.Color"))
157
- view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Color"))
158
- view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke 1.Color"))
159
- view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
160
- }
161
- }
162
- )
163
- }
164
- }
165
- }
166
- }
167
-
168
- fun Color.toUIColor(): UIColor {
169
- val argb = this.toArgb()
170
-
171
- val a = ((argb shr 24) and 0xFF) / 255.0
172
- val r = ((argb shr 16) and 0xFF) / 255.0
173
- val g = ((argb shr 8) and 0xFF) / 255.0
174
- val b = (argb and 0xFF) / 255.0
175
-
176
- return UIColor(
177
- red = r,
178
- green = g,
179
- blue = b,
180
- alpha = a
181
- )
182
- }
183
-
184
- actual fun NativePaint.setColor(color: Color){
185
- this.color = color.toArgb()
186
- }
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>Example.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict />
5
- </plist>
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1600"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "3B6FB503A75BF5BC1FA6F30BC06B9D28"
18
- BuildableName = "MoMoUIKits.framework"
19
- BlueprintName = "MoMoUIKits"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1600"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "0AEE99A309977BD12A049FF48AF9BA4B"
18
- BuildableName = "Pods_Example.framework"
19
- BlueprintName = "Pods-Example"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1600"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "3847153A6E5EEFB86565BA840768F429"
18
- BuildableName = "SDWebImage.framework"
19
- BlueprintName = "SDWebImage"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1600"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "92EBFA3E7005B4C18A9C0B44324EB80F"
18
- BuildableName = "SDWebImageSwiftUI.framework"
19
- BlueprintName = "SDWebImageSwiftUI"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>