@momo-kits/native-kits 0.157.1-test.1-debug → 0.157.1-test.2-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +2 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +5 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -41
- package/gradle.properties +1 -1
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -25,7 +25,6 @@ import com.airbnb.lottie.compose.rememberLottieDynamicProperties
|
|
|
25
25
|
import com.airbnb.lottie.compose.rememberLottieDynamicProperty
|
|
26
26
|
import vn.momo.kits.const.AppNavigationBar
|
|
27
27
|
import vn.momo.kits.const.AppStatusBar
|
|
28
|
-
import vn.momo.kits.utils.readJson
|
|
29
28
|
import androidx.activity.compose.BackHandler as AndroidBackHandler
|
|
30
29
|
|
|
31
30
|
actual fun getPlatformName(): String = "Android"
|
|
@@ -72,15 +71,9 @@ actual fun LottieAnimation(
|
|
|
72
71
|
bgColor: Color?,
|
|
73
72
|
modifier: Modifier
|
|
74
73
|
) {
|
|
75
|
-
val
|
|
76
|
-
|
|
77
|
-
if (json.isEmpty()) {
|
|
78
|
-
Box(modifier)
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
|
|
74
|
+
val assetPath = "composeResources/vn.momo.compose.resources/${path}.json"
|
|
82
75
|
val composition by rememberLottieComposition(
|
|
83
|
-
|
|
76
|
+
LottieCompositionSpec.Asset(assetPath)
|
|
84
77
|
)
|
|
85
78
|
|
|
86
79
|
val colorFilter = PorterDuffColorFilter(
|
|
@@ -135,8 +135,9 @@ internal fun RenderTitle(size: Size, title: String = "", textColor: Color) {
|
|
|
135
135
|
)
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
//TODO add internal
|
|
138
139
|
@Composable
|
|
139
|
-
|
|
140
|
+
fun RenderIcon(
|
|
140
141
|
size: Size,
|
|
141
142
|
isIconLeft: Boolean,
|
|
142
143
|
useTintColor: Boolean = true,
|
|
@@ -128,7 +128,7 @@ private class PasswordVisualTransformation(
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
@Composable
|
|
131
|
-
|
|
131
|
+
fun getBorderColor(isFocused: Boolean, error: String, disabled: Boolean): Color {
|
|
132
132
|
val theme = AppTheme.current
|
|
133
133
|
return remember(isFocused, error, disabled, theme) {
|
|
134
134
|
when {
|
|
@@ -140,8 +140,9 @@ internal fun getBorderColor(isFocused: Boolean, error: String, disabled: Boolean
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
//TODO add internal
|
|
143
144
|
@Composable
|
|
144
|
-
|
|
145
|
+
fun RenderRightIcon(loading: Boolean, icon: String, color: Color, onClick: () -> Unit, modifier: Modifier = Modifier) {
|
|
145
146
|
if (loading) {
|
|
146
147
|
Box {
|
|
147
148
|
CircularProgressIndicator(
|
|
@@ -166,8 +167,9 @@ internal fun RenderRightIcon(loading: Boolean, icon: String, color: Color, onCli
|
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
|
|
170
|
+
//TODO add internal
|
|
169
171
|
@Composable
|
|
170
|
-
|
|
172
|
+
fun ErrorView(errorMessage: String, errorSpacing: Boolean, hintText: String) {
|
|
171
173
|
val theme = AppTheme.current
|
|
172
174
|
val errorColor = remember(theme) { theme.colors.error.primary }
|
|
173
175
|
val hintColor = remember(theme) { theme.colors.text.hint }
|
|
@@ -46,8 +46,9 @@ import vn.momo.kits.const.Typography
|
|
|
46
46
|
import vn.momo.kits.const.scaleSize
|
|
47
47
|
import vn.momo.kits.modifier.conditional
|
|
48
48
|
|
|
49
|
+
//TODO add internal
|
|
49
50
|
@Composable
|
|
50
|
-
|
|
51
|
+
fun OTPCaret() {
|
|
51
52
|
val duration = 500
|
|
52
53
|
val backgroundColor = AppTheme.current.colors.primary
|
|
53
54
|
|
|
@@ -18,45 +18,4 @@ fun getResource(name: String): DrawableResource {
|
|
|
18
18
|
"drawable:$name",
|
|
19
19
|
setOf(ResourceItem(setOf(), "drawable/$name", -1, -1))
|
|
20
20
|
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@OptIn(InternalResourceApi::class)
|
|
24
|
-
@Composable
|
|
25
|
-
fun readJson(name: String): String {
|
|
26
|
-
val path = name.plus(".json")
|
|
27
|
-
|
|
28
|
-
val jsonContent by rememberState(path, { "" }) {
|
|
29
|
-
val cached = resourceCache.getOrPut(path) {
|
|
30
|
-
val content = try {
|
|
31
|
-
readResourceBytes(path).decodeToString()
|
|
32
|
-
} catch (_: Exception) {
|
|
33
|
-
""
|
|
34
|
-
}
|
|
35
|
-
ResourceCache.JSON(content)
|
|
36
|
-
} as ResourceCache.JSON
|
|
37
|
-
|
|
38
|
-
cached.json
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return jsonContent
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
private val resourceCache = mutableMapOf<String, ResourceCache>()
|
|
46
|
-
|
|
47
|
-
private sealed interface ResourceCache {
|
|
48
|
-
class JSON(val json: String) : ResourceCache
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@Composable
|
|
52
|
-
fun <T> rememberState(
|
|
53
|
-
key: Any,
|
|
54
|
-
getDefault: () -> T,
|
|
55
|
-
block: suspend () -> T
|
|
56
|
-
): MutableState<T> {
|
|
57
|
-
val state = remember(key) { mutableStateOf(getDefault()) }
|
|
58
|
-
LaunchedEffect(key) {
|
|
59
|
-
state.value = block()
|
|
60
|
-
}
|
|
61
|
-
return state
|
|
62
21
|
}
|
package/gradle.properties
CHANGED