@momo-kits/native-kits 0.89.7 → 0.89.8-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.
@@ -28,20 +28,20 @@ android {
28
28
  }
29
29
 
30
30
  composeOptions {
31
- kotlinCompilerExtensionVersion = "1.5.8"
31
+ kotlinCompilerExtensionVersion = "1.5.11"
32
32
  }
33
33
  }
34
34
 
35
35
  dependencies {
36
- def composeBom = platform('androidx.compose:compose-bom:2023.10.01')
36
+ def composeBom = platform('androidx.compose:compose-bom:2024.05.00')
37
37
  implementation composeBom
38
38
  androidTestImplementation composeBom
39
39
  implementation "androidx.compose.material3:material3"
40
- implementation "androidx.compose.material:material:$rootProject.materialComposeVersion"
41
- implementation "androidx.compose.foundation:foundation:$rootProject.composeVersion"
42
- implementation "androidx.compose.ui:ui:$rootProject.composeVersion"
43
- implementation "androidx.compose.ui:ui-tooling-preview:$rootProject.composeVersion"
44
- debugImplementation "androidx.compose.ui:ui-tooling:$rootProject.composeVersion"
40
+ implementation "androidx.compose.material:material"
41
+ implementation "androidx.compose.foundation:foundation"
42
+ implementation "androidx.compose.ui:ui"
43
+ implementation "androidx.compose.ui:ui-tooling-preview"
44
+ debugImplementation "androidx.compose.ui:ui-tooling"
45
45
  implementation("io.coil-kt:coil-compose:2.5.0")
46
46
  implementation 'com.google.code.gson:gson:2.8.6'
47
47
 
@@ -88,7 +88,6 @@ fun Header(
88
88
  headerType: HeaderType = HeaderType.DEFAULT,
89
89
  titlePosition: TitlePosition,
90
90
  title: String,
91
- backgroundColor: Color,
92
91
  isBack: Boolean,
93
92
  headerRight: @Composable (() -> Unit)? = null,
94
93
  goBack: (() -> Unit) = { },
@@ -108,7 +107,6 @@ fun Header(
108
107
  if (headerType != HeaderType.NONE) {
109
108
  BoxWithConstraints(
110
109
  Modifier.height(statusBarHeight + 52.dp)
111
- .background(backgroundColor)
112
110
  .fillMaxWidth()
113
111
  .bottomBorder(
114
112
  strokeWidth = if (headerType == HeaderType.SURFACE) 2.dp else 0.dp,
@@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
21
21
  import androidx.compose.ui.graphics.Color
22
22
  import androidx.compose.ui.input.pointer.pointerInput
23
23
  import androidx.compose.ui.platform.LocalSoftwareKeyboardController
24
+ import androidx.compose.ui.unit.Dp
24
25
  import androidx.compose.ui.unit.dp
25
26
  import androidx.compose.ui.unit.min
26
27
  import vn.momo.kits.const.AppTheme
@@ -37,7 +38,7 @@ enum class HeaderType {
37
38
 
38
39
  @Composable
39
40
  fun Screen(
40
- backgroundColor: Color = Color.Unspecified,
41
+ backgroundColor: Color? = null,
41
42
  headerBackground: String? = null,
42
43
  isBack: Boolean = true,
43
44
  headerType: HeaderType = HeaderType.DEFAULT,
@@ -47,20 +48,22 @@ fun Screen(
47
48
  titlePosition: TitlePosition = TitlePosition.LEFT,
48
49
  goBack: (() -> Unit) = { },
49
50
  scrollable: Boolean = true,
51
+ useAvoidKeyboard: Boolean = true,
50
52
  footer: @Composable (() -> Unit)? = null,
51
53
  headerRight: @Composable (() -> Unit)? = null,
52
54
  content: @Composable () -> Unit,
53
55
  ) {
54
56
  val keyboardController = LocalSoftwareKeyboardController.current
55
57
  val keyboardHeight = WindowInsets.ime.asPaddingValues().calculateBottomPadding()
56
- val avoidKeyboard = when {
58
+ val keyboardSize = when {
59
+ !useAvoidKeyboard -> 0.dp
57
60
  keyboardHeight > 100.dp && footer == null -> keyboardHeight
58
61
  keyboardHeight > 100.dp && footer != null -> keyboardHeight - 21.dp
59
62
  else -> 0.dp
60
63
  }
61
64
 
62
65
  Box(
63
- Modifier.fillMaxSize().background(AppTheme.current.colors.background.default)
66
+ Modifier.fillMaxSize().background(backgroundColor ?: AppTheme.current.colors.background.default)
64
67
  ) {
65
68
  HeaderImage(headerType, headerBackground ?: AppTheme.current.assets.headerBackground)
66
69
  Column(
@@ -74,16 +77,15 @@ fun Screen(
74
77
  headerType = headerType,
75
78
  title = title,
76
79
  titlePosition = titlePosition,
77
- backgroundColor = backgroundColor,
78
80
  headerRight = headerRight,
79
81
  isBack = isBack,
80
82
  goBack = goBack,
81
83
  )
82
84
 
83
85
  Column(
84
- modifier = if (scrollable) Modifier.weight(1f).padding(bottom = avoidKeyboard)
86
+ modifier = if (scrollable) Modifier.weight(1f).padding(bottom = keyboardSize)
85
87
  .verticalScroll(rememberScrollState()) else
86
- Modifier.padding(bottom = avoidKeyboard),
88
+ Modifier.padding(bottom = keyboardSize),
87
89
  verticalArrangement = verticalArrangement,
88
90
  horizontalAlignment = horizontalAlignment
89
91
  ) {
@@ -91,19 +93,18 @@ fun Screen(
91
93
  }
92
94
 
93
95
  footer?.let {
94
- Footer(footer)
96
+ Footer(footer, keyboardSize)
95
97
  }
96
98
  }
97
99
  }
98
100
  }
99
101
 
100
102
  @Composable
101
- fun Footer(footer: @Composable (() -> Unit)? = null) {
103
+ fun Footer(footer: @Composable (() -> Unit)? = null, keyboardSize: Dp = 0.dp) {
102
104
  val indicator = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
103
- val keyboardHeight = WindowInsets.ime.asPaddingValues().calculateBottomPadding()
104
105
  Box(
105
106
  Modifier
106
- .offset(y = if (keyboardHeight > 150.dp) -keyboardHeight + 21.dp else 0.dp)
107
+ .offset(y = - keyboardSize)
107
108
  .padding(bottom = min(indicator, 21.dp))
108
109
  .shadow(
109
110
  Colors.black_20.copy(alpha = 0.1f),
@@ -22,6 +22,7 @@ import androidx.compose.ui.graphics.Color
22
22
  import androidx.compose.ui.layout.ContentScale
23
23
  import androidx.compose.ui.unit.dp
24
24
  import androidx.compose.ui.unit.sp
25
+ import vn.momo.kits.modifier.noFeedbackClickable
25
26
 
26
27
  val defaultBanner = TrustBannerData(
27
28
  content = mapOf(
@@ -50,7 +51,7 @@ data class TrustBannerClass(
50
51
  val trustBanner: TrustBannerData
51
52
  )
52
53
 
53
- data class TrustBannerData (
54
+ data class TrustBannerData(
54
55
  val content: Map<String, String>,
55
56
  val pciImage: String,
56
57
  val sslImage: String,
@@ -58,6 +59,7 @@ data class TrustBannerData (
58
59
  val momoImage: String,
59
60
  val urlConfig: String
60
61
  )
62
+
61
63
  @Composable
62
64
  fun Avatar(iconURL: String) {
63
65
  Image(
@@ -76,31 +78,45 @@ fun TrustBanner(
76
78
  serviceName: String = "",
77
79
  screenName: String = "",
78
80
  onPress: ((Map<String, String>) -> Unit)? = null,
79
- trackEvent: ((String,Map<String, String>) -> Unit)? = null,
81
+ trackEvent: ((String, Map<String, String>) -> Unit)? = null,
80
82
  language: String = "vi"
81
83
  ) {
84
+ val trackParams = mapOf(
85
+ "service_name" to serviceName,
86
+ "screen_name" to screenName,
87
+ "component_name" to "logo_trust",
88
+ "url_config" to trustBanner.urlConfig
89
+ )
90
+
82
91
  Row(
83
92
  modifier = Modifier
84
93
  .clip(RoundedCornerShape(12.dp))
85
94
  .background(color = Color(backgroundBlue))
86
95
  .padding(12.dp)
87
- .clickable {
88
- if (trackEvent != null) {
89
- trackEvent("service_component_clicked",mapOf(
90
- "service_name" to serviceName,
91
- "screen_name" to screenName,
92
- "component_name" to "logo_trust",
93
- "url_config" to trustBanner.urlConfig
94
- ))
95
- }
96
+ .then(
96
97
  if (onPress != null) {
97
- onPress(mapOf(
98
- "service_name" to serviceName,
99
- "screen_name" to screenName,
100
- "url_config" to trustBanner.urlConfig,
101
- ))
98
+ Modifier.clickable {
99
+ trackEvent?.invoke(
100
+ "service_component_clicked", trackParams
101
+ )
102
+
103
+ onPress(
104
+ mapOf(
105
+ "service_name" to serviceName,
106
+ "screen_name" to screenName,
107
+ "url_config" to trustBanner.urlConfig,
108
+ )
109
+ )
110
+
111
+ }
112
+ } else {
113
+ Modifier.noFeedbackClickable {
114
+ trackEvent?.invoke(
115
+ "service_component_clicked", trackParams
116
+ )
117
+ }
102
118
  }
103
- }
119
+ )
104
120
  ) {
105
121
  Image(
106
122
  source = trustBanner.momoImage,
@@ -0,0 +1,21 @@
1
+ package vn.momo.kits.modifier
2
+
3
+ import androidx.compose.foundation.clickable
4
+ import androidx.compose.foundation.interaction.MutableInteractionSource
5
+ import androidx.compose.runtime.remember
6
+ import androidx.compose.ui.Modifier
7
+ import androidx.compose.ui.composed
8
+ import androidx.compose.ui.semantics.Role
9
+
10
+ fun Modifier.noFeedbackClickable(
11
+ enabled: Boolean = true, onClickLabel: String? = null, role: Role? = null, onClick: () -> Unit
12
+ ): Modifier = composed {
13
+ clickable(
14
+ interactionSource = remember { MutableInteractionSource() },
15
+ indication = null,
16
+ enabled,
17
+ onClickLabel,
18
+ role,
19
+ onClick
20
+ )
21
+ }
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Tue Apr 23 16:40:15 ICT 2024
8
+ sdk.dir=/Users/hung.dao1/Library/Android/sdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.89.7",
3
+ "version": "0.89.8-beta.1",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},