@momo-kits/native-kits 0.155.1-hello.14-debug → 0.155.1-hello.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/.gitlab-ci.yml ADDED
@@ -0,0 +1,15 @@
1
+ stages:
2
+ - build_release_publish
3
+
4
+ build_release_publish:
5
+ stage: build_release_publish
6
+ only:
7
+ variables:
8
+ - $CI_COMMIT_MESSAGE =~ /\[ci build\]/
9
+ except:
10
+ variables:
11
+ - $CI_COMMIT_REF_NAME =~ /^engine\/w*/
12
+ tags:
13
+ - momo-publish-package-runner
14
+ script:
15
+ - sh publish_release.sh
@@ -0,0 +1,22 @@
1
+ sample/
2
+ gradle/
3
+ compose/
4
+ build/
5
+
6
+ .fleet
7
+ .gradle
8
+ .idea
9
+ .kotlin
10
+ .run
11
+
12
+ .gitattributes
13
+ .gitlab-ci.yml
14
+
15
+ README.md
16
+ build.gradle.kts
17
+ gradle.properties
18
+ gradlew
19
+ gradlew.bat
20
+ local.properties
21
+ publish_release.sh
22
+ settings.gradle.kts
@@ -1,5 +1,5 @@
1
- // import com.vanniktech.maven.publish.JavadocJar
2
- // import com.vanniktech.maven.publish.KotlinMultiplatform
1
+ import com.vanniktech.maven.publish.JavadocJar
2
+ import com.vanniktech.maven.publish.KotlinMultiplatform
3
3
  import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
4
 
5
5
  plugins {
@@ -7,7 +7,7 @@ plugins {
7
7
  alias(libs.plugins.android.library)
8
8
  alias(libs.plugins.compose)
9
9
  alias(libs.plugins.kotlin.compose.compiler)
10
- // alias(libs.plugins.vanniktech.mavenPublish)
10
+ alias(libs.plugins.vanniktech.mavenPublish)
11
11
  id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
12
12
  kotlin("plugin.serialization")
13
13
  }
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.155.1-hello.14-debug"
43
+ version = gitlabVersion
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -84,14 +84,14 @@ kotlin {
84
84
  }
85
85
 
86
86
  android {
87
- namespace = "vn.momo.kits.kits"
88
- compileSdk = 35
87
+ namespace = "$gitlabGroup.$gitlabArtifactId"
88
+ compileSdk = libs.versions.android.compileSdk.get().toInt()
89
89
  compileOptions {
90
90
  sourceCompatibility = JavaVersion.VERSION_17
91
91
  targetCompatibility = JavaVersion.VERSION_17
92
92
  }
93
93
  defaultConfig {
94
- minSdk = 24
94
+ minSdk = libs.versions.android.minSdk.get().toInt()
95
95
  }
96
96
  }
97
97
 
@@ -125,56 +125,56 @@ compose {
125
125
  }
126
126
  }
127
127
 
128
- // publishing {
129
- // repositories {
130
- // maven {
131
- // name = "${gitlabRepo}Packages"
132
- // credentials {
133
- // username = gitlabUser
134
- // password = gitlabKey
135
- // }
136
- // url = uri("$gitlabUrl")
137
- // }
138
- // }
139
- // }
140
-
141
- // mavenPublishing {
142
- // configure(
143
- // KotlinMultiplatform(
144
- // javadocJar = JavadocJar.Empty(),
145
- // sourcesJar = true,
146
- // androidVariantsToPublish = listOf("release")
147
- // )
148
- // )
149
- //
150
- // repositories {
151
- // maven {
152
- // name = "${gitlabRepo}Packages"
153
- // credentials { username = gitlabUser; password = gitlabKey }
154
- // url = uri("$gitlabUrl")
155
- // }
156
- // }
157
- //
158
- // coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
159
- //
160
- // pom {
161
- // name = "$gitlabName Klib"
162
- // description = "$gitlabName"
163
- // url = "https://gitlab.mservice.com.vn"
164
- // licenses {
165
- // license {
166
- // name = "The Apache License, Version 2.0"
167
- // url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
168
- // distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
169
- // }
170
- // }
171
- // developers {
172
- // developer {
173
- // id = "kotlin-hands-on"
174
- // name = "Kotlin Developer Advocate"
175
- // url = "https://github.com/kotlin-hands-on/"
176
- // }
177
- // }
178
- // }
179
- // }
128
+ publishing {
129
+ repositories {
130
+ maven {
131
+ name = "${gitlabRepo}Packages"
132
+ credentials {
133
+ username = gitlabUser
134
+ password = gitlabKey
135
+ }
136
+ url = uri("$gitlabUrl")
137
+ }
138
+ }
139
+ }
140
+
141
+ mavenPublishing {
142
+ configure(
143
+ KotlinMultiplatform(
144
+ javadocJar = JavadocJar.Empty(),
145
+ sourcesJar = true,
146
+ androidVariantsToPublish = listOf("release")
147
+ )
148
+ )
149
+
150
+ repositories {
151
+ maven {
152
+ name = "${gitlabRepo}Packages"
153
+ credentials { username = gitlabUser; password = gitlabKey }
154
+ url = uri("$gitlabUrl")
155
+ }
156
+ }
157
+
158
+ coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
159
+
160
+ pom {
161
+ name = "$gitlabName Klib"
162
+ description = "$gitlabName"
163
+ url = "https://gitlab.mservice.com.vn"
164
+ licenses {
165
+ license {
166
+ name = "The Apache License, Version 2.0"
167
+ url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
168
+ distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
169
+ }
170
+ }
171
+ developers {
172
+ developer {
173
+ id = "kotlin-hands-on"
174
+ name = "Kotlin Developer Advocate"
175
+ url = "https://github.com/kotlin-hands-on/"
176
+ }
177
+ }
178
+ }
179
+ }
180
180
 
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.155.1-hello.9'
3
+ spec.version = '0.155.1-test.6'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.height
13
13
  import androidx.compose.foundation.layout.offset
14
14
  import androidx.compose.foundation.layout.padding
15
15
  import androidx.compose.foundation.layout.size
16
- import androidx.compose.foundation.layout.width
17
16
  import androidx.compose.foundation.layout.wrapContentSize
18
17
  import androidx.compose.foundation.shape.RoundedCornerShape
19
18
  import androidx.compose.foundation.text.BasicTextField
@@ -29,13 +28,18 @@ import androidx.compose.ui.Alignment
29
28
  import androidx.compose.ui.Modifier
30
29
  import androidx.compose.ui.focus.onFocusChanged
31
30
  import androidx.compose.ui.graphics.Color
31
+ import androidx.compose.ui.text.AnnotatedString
32
+ import androidx.compose.ui.text.SpanStyle
32
33
  import androidx.compose.ui.text.TextStyle
34
+ import androidx.compose.ui.text.font.FontFamily
33
35
  import androidx.compose.ui.text.font.FontWeight
34
36
  import androidx.compose.ui.text.input.KeyboardType
35
- import androidx.compose.ui.text.input.PasswordVisualTransformation
37
+ import androidx.compose.ui.text.input.OffsetMapping
38
+ import androidx.compose.ui.text.input.TransformedText
36
39
  import androidx.compose.ui.text.input.VisualTransformation
37
40
  import androidx.compose.ui.text.style.TextAlign
38
41
  import androidx.compose.ui.unit.Dp
42
+ import androidx.compose.ui.unit.TextUnit
39
43
  import androidx.compose.ui.unit.dp
40
44
  import androidx.compose.ui.unit.sp
41
45
  import androidx.compose.ui.zIndex
@@ -46,9 +50,12 @@ import vn.momo.kits.application.ApplicationContext
46
50
  import vn.momo.kits.application.MiniAppContext.Companion.isShowBaselineDebug
47
51
  import vn.momo.kits.const.Colors
48
52
  import vn.momo.kits.const.Typography
53
+ import vn.momo.kits.const.getFont
49
54
  import vn.momo.kits.const.scaleSize
50
55
  import vn.momo.kits.modifier.conditional
51
56
  import vn.momo.kits.modifier.setAutomationId
57
+ import vn.momo.uikits.resources.Res
58
+ import vn.momo.uikits.resources.sfprotext_regular
52
59
 
53
60
  data class InputSizeDetail(
54
61
  val borderWidth: Dp,
@@ -89,6 +96,38 @@ data class InputState(
89
96
  val hasBeenBlurred: Boolean = false
90
97
  )
91
98
 
99
+ private class PasswordVisualTransformation(
100
+ private val fontFamily: FontFamily,
101
+ private val fontSize: TextUnit
102
+ ) : VisualTransformation {
103
+ private val mask: Char = '\u2022'
104
+
105
+ override fun filter(text: AnnotatedString): TransformedText {
106
+
107
+ val maskedText = AnnotatedString(
108
+ text = mask.toString().repeat(text.length),
109
+ spanStyles = listOf(
110
+ AnnotatedString.Range(
111
+ SpanStyle(fontSize = fontSize, letterSpacing = 0.sp, fontFamily = fontFamily),
112
+ 0,
113
+ text.length
114
+ )
115
+ )
116
+ )
117
+ return TransformedText(maskedText, OffsetMapping.Identity)
118
+ }
119
+
120
+ override fun equals(other: Any?): Boolean {
121
+ if (this === other) return true
122
+ if (other !is PasswordVisualTransformation) return false
123
+ return mask == other.mask && fontSize == other.fontSize
124
+ }
125
+
126
+ override fun hashCode(): Int {
127
+ return 31 * mask.hashCode() + fontSize.hashCode()
128
+ }
129
+ }
130
+
92
131
  @Composable
93
132
  fun getBorderColor(isFocused: Boolean, error: String, disabled: Boolean): Color {
94
133
  val theme = AppTheme.current
@@ -219,7 +258,7 @@ fun Input(
219
258
  if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
220
259
  }
221
260
 
222
- val fontSize = 16.sp
261
+ val fontSize = 14.sp
223
262
  val lineHeight = 24.sp
224
263
  val scaleFontSize = scaleSize(fontSize)
225
264
  val scaleLineHeight = scaleSize(lineHeight)
@@ -244,13 +283,15 @@ fun Input(
244
283
 
245
284
  val keyboardOptionsConfig = remember(secureTextEntry, keyboardType) {
246
285
  KeyboardOptions.Default.copy(
247
- keyboardType = if (secureTextEntry) KeyboardType.Ascii else keyboardType
286
+ keyboardType = keyboardType
248
287
  )
249
288
  }
250
289
 
251
- val visualTransformation = remember(secureTextEntry, inputState.passHidden) {
290
+ val passwordFontFamily = getFont(Res.font.sfprotext_regular)
291
+ val passwordFontSize = scaleSize(24.sp)
292
+ val visualTransformation = remember(secureTextEntry, inputState.passHidden, passwordFontFamily) {
252
293
  if (secureTextEntry && !inputState.passHidden)
253
- PasswordVisualTransformation()
294
+ PasswordVisualTransformation(fontFamily = passwordFontFamily, fontSize = passwordFontSize)
254
295
  else
255
296
  VisualTransformation.None
256
297
  }
@@ -367,8 +408,7 @@ fun Input(
367
408
 
368
409
  // Clear button
369
410
  if (inputState.isFocused && text.value.isNotEmpty()) {
370
- Row {
371
- Spacer(Modifier.width(Spacing.XS))
411
+ Row(Modifier.padding(horizontal = Spacing.XS)) {
372
412
  Icon(
373
413
  source = "24_navigation_close_circle_full",
374
414
  size = 16.dp,
@@ -77,17 +77,21 @@ private fun heightForLines(
77
77
  return heightPx
78
78
  }
79
79
 
80
+ data class PopupNotifyProps(
81
+ val image: String = "",
82
+ val title: String = "Title",
83
+ val description: String = "Description",
84
+ val error: String = "",
85
+ val primary: PopupAction? = null,
86
+ val secondary: PopupAction? = null,
87
+ val buttonDirection: PopupActionDirection = PopupActionDirection.ROW,
88
+ val onIconClose: () -> Unit,
89
+ val isShowCloseIcon: Boolean = true,
90
+ )
91
+
80
92
  @Composable
81
93
  fun PopupNotify(
82
- image: String = "",
83
- title: String = "Title",
84
- description: String = "Description",
85
- error: String = "",
86
- primary: PopupAction? = null,
87
- secondary: PopupAction? = null,
88
- buttonDirection: PopupActionDirection = PopupActionDirection.ROW,
89
- onIconClose: () -> Unit,
90
- isShowCloseIcon: Boolean = true,
94
+ props: PopupNotifyProps,
91
95
  ) {
92
96
  var isScroll by remember { mutableStateOf(false) }
93
97
  val layoutResult = remember { mutableStateOf<TextLayoutResult?>(null) }
@@ -122,7 +126,7 @@ fun PopupNotify(
122
126
  ) {
123
127
  item {
124
128
  Text(
125
- text = description,
129
+ text = props.description,
126
130
  onTextLayout = { layoutResult.value = it },
127
131
  style = Typography.bodyDefaultRegular
128
132
  )
@@ -133,7 +137,7 @@ fun PopupNotify(
133
137
  { modifier ->
134
138
  Box(modifier = modifier) {
135
139
  Text(
136
- text = description,
140
+ text = props.description,
137
141
  onTextLayout = { layoutResult.value = it },
138
142
  style = Typography.bodyDefaultRegular
139
143
  )
@@ -163,9 +167,9 @@ fun PopupNotify(
163
167
  border(1.dp, Colors.blue_03)
164
168
  }
165
169
  ) {
166
- if(image.isNotEmpty()) {
170
+ if(props.image.isNotEmpty()) {
167
171
  Image(
168
- source = image,
172
+ source = props.image,
169
173
  modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
170
174
  options = Options(alignment = Alignment.Center)
171
175
  )
@@ -175,13 +179,13 @@ fun PopupNotify(
175
179
  Text(
176
180
  style = Typography.headerDefaultBold,
177
181
  maxLines = 2,
178
- text = title,
182
+ text = props.title,
179
183
  modifier = Modifier.setAutomationId("title_popup_permission")
180
184
  )
181
185
  content(Modifier.padding(top = Spacing.S))
182
- if (error.isNotEmpty()) {
186
+ if (props.error.isNotEmpty()) {
183
187
  Text(
184
- text = errorCode[language] + error,
188
+ text = errorCode[language] + props.error,
185
189
  style = Typography.descriptionXsRegular,
186
190
  color = AppTheme.current.colors.text.hint,
187
191
  maxLines = 1,
@@ -194,13 +198,13 @@ fun PopupNotify(
194
198
  modifier = Modifier.padding(horizontal = Spacing.XL)
195
199
  .padding(bottom = Spacing.XL)
196
200
  ) {
197
- BuildAction(primary, secondary, buttonDirection, onAction = { callback ->
201
+ BuildAction(props.primary, props.secondary, props.buttonDirection, onAction = { callback ->
198
202
  onClose(callback)
199
203
  })
200
204
  }
201
205
  }
202
206
 
203
- if(isShowCloseIcon) {
207
+ if(props.isShowCloseIcon) {
204
208
  Box(
205
209
  Modifier
206
210
  .width(22.dp)
@@ -219,7 +223,7 @@ fun PopupNotify(
219
223
  .clickable(
220
224
  interactionSource = remember { MutableInteractionSource() },
221
225
  indication = null,
222
- onClick = { onClose { onIconClose() } }
226
+ onClick = { onClose { props.onIconClose() } }
223
227
  ),
224
228
  contentAlignment = Alignment.Center
225
229
  ) {
@@ -9,6 +9,7 @@ import androidx.compose.runtime.staticCompositionLocalOf
9
9
  import androidx.compose.ui.graphics.Color
10
10
  import vn.momo.kits.navigation.bottomtab.setBottomTabOption
11
11
  import vn.momo.kits.navigation.component.FloatingButtonProps
12
+ import vn.momo.kits.navigation.component.HeaderBackProps
12
13
  import vn.momo.kits.navigation.component.HeaderRight
13
14
  import vn.momo.kits.navigation.component.HeaderTitle
14
15
  import vn.momo.kits.navigation.component.HeaderType
@@ -25,6 +26,7 @@ class Navigation(
25
26
  fun setOptions(
26
27
  onBackHandler: (() -> Unit)? = null,
27
28
  hiddenBack: Boolean? = null,
29
+ headerBackProps: HeaderBackProps? = null,
28
30
  headerTitle: HeaderTitle? = null,
29
31
  headerRight: HeaderRight? = null,
30
32
  headerType: HeaderType? = null,
@@ -39,6 +41,7 @@ class Navigation(
39
41
  options.copy(
40
42
  onBackHandler = onBackHandler ?: options.onBackHandler,
41
43
  hiddenBack = hiddenBack ?: options.hiddenBack,
44
+ headerBackProps = headerBackProps ?: options.headerBackProps,
42
45
  headerTitle = headerTitle ?: options.headerTitle,
43
46
  headerRight = headerRight ?: options.headerRight,
44
47
  headerType = headerType ?: options.headerType,
@@ -71,6 +74,7 @@ val LocalNavigation = staticCompositionLocalOf<Navigation> {
71
74
  data class NavigationOptions(
72
75
  val onBackHandler: (() -> Unit)? = null,
73
76
  val hiddenBack: Boolean = false,
77
+ val headerBackProps: HeaderBackProps = HeaderBackProps(),
74
78
  val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
75
79
  val headerRight: HeaderRight = HeaderRight.Toolkit(),
76
80
  val headerType: HeaderType = HeaderType.Default(),
@@ -16,6 +16,8 @@ import kotlinx.coroutines.cancel
16
16
  import kotlinx.coroutines.delay
17
17
  import kotlinx.coroutines.launch
18
18
  import kotlinx.serialization.Serializable
19
+ import vn.momo.kits.components.PopupAction
20
+ import vn.momo.kits.components.PopupNotify
19
21
  import vn.momo.kits.navigation.BottomHeader.*
20
22
  import vn.momo.kits.navigation.component.SnackBar
21
23
  import vn.momo.maxapi.IMaxApi
@@ -40,6 +42,33 @@ class Navigator(
40
42
  }
41
43
  }
42
44
 
45
+ fun onBackSafe(callBack: (() -> Unit)? = null) {
46
+ val latestScreen = DynamicScreenRegistry.getLatestScreen()
47
+ val options = latestScreen?.options
48
+ if (options?.onBackHandler != null) {
49
+ options.onBackHandler.invoke()
50
+ return
51
+ }
52
+ val preventBack = options?.headerBackProps?.preventBack
53
+ if (preventBack != null) {
54
+ showModal(
55
+ content = {
56
+ PopupNotify(preventBack.copy(
57
+ primary = PopupAction(
58
+ title = preventBack.primary?.title ?: "",
59
+ onPress = {
60
+ preventBack.primary?.onPress?.invoke()
61
+ pop(2, callBack) // close popup notify, then close the screen
62
+ }
63
+ )
64
+ ))
65
+ }
66
+ )
67
+ } else {
68
+ pop(1, callBack)
69
+ }
70
+ }
71
+
43
72
  fun pop(count: Int = 1, callBack: (() -> Unit)? = null) {
44
73
  scope.launch {
45
74
  repeat(count) {
@@ -56,13 +85,13 @@ class Navigator(
56
85
  callBack?.invoke()
57
86
  }
58
87
  }
59
- private suspend fun CoroutineScope.dismissOverplay(isDelay: Boolean = true) {
88
+ private suspend fun dismissOverplay(isDelay: Boolean = true) {
60
89
  OverplayComponentRegistry.clear()
61
90
  if (isDelay) delay(300L)
62
91
  OverplayComponentRegistry.hardClearAfterDismiss()
63
92
  }
64
93
 
65
- private suspend fun CoroutineScope.dismissScreen() {
94
+ private suspend fun dismissScreen() {
66
95
  if (navController.previousBackStackEntry != null){
67
96
  navController.popBackStack()
68
97
  delay(300L)
@@ -75,6 +75,7 @@ internal fun StackScreen(
75
75
  navigationOptions: NavigationOptions? = null,
76
76
  id: Int = -1,
77
77
  bottomTabIndex: Int = -1,
78
+ onBackHandler: (() -> Unit)? = null,
78
79
  ) {
79
80
  val navigator = LocalNavigator.current
80
81
  val statusBar = AppStatusBar.current
@@ -95,7 +96,7 @@ internal fun StackScreen(
95
96
  val footerHeightPx = remember { mutableIntStateOf(0) }
96
97
  val headerRightWidthPx = remember { mutableIntStateOf(0) }
97
98
 
98
- BackHandler(true) { navigator.pop() }
99
+ BackHandler(true) { navigator.onBackSafe() }
99
100
 
100
101
  CompositionLocalProvider(
101
102
  StackScreenScrollableState provides options.scrollData.scrollState,
@@ -120,7 +121,7 @@ internal fun StackScreen(
120
121
  }
121
122
 
122
123
  Box(Modifier.zIndex(5f)) {
123
- Header()
124
+ Header(onBackHandler)
124
125
  }
125
126
 
126
127
  Column (Modifier.zIndex(6f)) {
@@ -175,7 +176,10 @@ fun ColumnScope.MainContent(content: @Composable ()-> Unit){
175
176
  val density = LocalDensity.current
176
177
  val scrollState = LocalScrollState.current
177
178
 
178
- Spacer(Modifier.height(if (options.headerType is HeaderType.DefaultOrExtended) AppStatusBar.current + HEADER_HEIGHT.dp else 0.dp))
179
+ Spacer(Modifier.height(
180
+ if (options.headerType is HeaderType.DefaultOrExtended || (options.headerType is HeaderType.Transparent && !options.headerType.isFullScreenContent))
181
+ AppStatusBar.current + HEADER_HEIGHT.dp else 0.dp)
182
+ )
179
183
  if (inputSearchType == InputSearchType.Animated){
180
184
  val scrollDp = with(density) { scrollState.value.toDp() }
181
185
 
@@ -54,16 +54,7 @@ fun BottomTab(
54
54
  val navController = rememberNavController()
55
55
 
56
56
  bottomTabOptionItems = items.mapIndexed { index, item ->
57
- val options = item.options ?: NavigationOptions()
58
- options.copy(
59
- onBackHandler = {
60
- if (index != 0) {
61
- navController.popBackStack()
62
- } else {
63
- navigator.pop()
64
- }
65
- }
66
- )
57
+ item.options ?: NavigationOptions()
67
58
  }.toMutableList()
68
59
 
69
60
 
@@ -114,21 +105,23 @@ fun BottomTab(
114
105
  )
115
106
  }
116
107
  ) {
117
- val option = getBottomTabOption(index)?.copy(
108
+ val option = getBottomTabOption(index)
109
+
110
+ StackScreen(
111
+ content = item.screen,
112
+ navigationOptions = option,
113
+ bottomTabIndex = index,
118
114
  onBackHandler = {
119
115
  if (index != 0) {
120
- navController.popBackStack()
116
+ navController.popBackStack(
117
+ navController.graph.startDestinationRoute!!,
118
+ inclusive = false
119
+ )
121
120
  } else {
122
121
  navigator.pop()
123
122
  }
124
123
  }
125
124
  )
126
-
127
- StackScreen(
128
- content = item.screen,
129
- navigationOptions = option,
130
- bottomTabIndex = index
131
- )
132
125
  }
133
126
  }
134
127
  }
@@ -30,6 +30,7 @@ import vn.momo.kits.const.AppTheme
30
30
  import vn.momo.kits.const.Colors
31
31
  import vn.momo.kits.application.ApplicationContext
32
32
  import vn.momo.kits.application.MiniAppContext.Companion.isShowBaselineDebug
33
+ import vn.momo.kits.components.PopupNotifyProps
33
34
  import vn.momo.kits.const.Spacing
34
35
  import vn.momo.kits.modifier.activeOpacityClickable
35
36
  import vn.momo.kits.modifier.conditional
@@ -43,7 +44,7 @@ const val HEADER_HEIGHT = 52
43
44
  enum class InputSearchType { None, Header, Animated }
44
45
 
45
46
  @Composable
46
- fun Header() {
47
+ fun Header(onBackHandler: (() -> Unit)? = null) {
47
48
  val options = LocalOptions.current
48
49
  val navigator = LocalNavigator.current
49
50
  val scrollState = LocalScrollState.current
@@ -55,7 +56,12 @@ fun Header() {
55
56
  else -> HEADER_HEIGHT
56
57
  }
57
58
  val opacity by animateFloatAsState(
58
- targetValue = ((scrollState.value * 1f / opacityHeight * 1f)).coerceIn(0f, 1f),
59
+ targetValue = if (options.headerType is HeaderType.Transparent) {
60
+ 0f
61
+ } else {
62
+ (scrollState.value / opacityHeight.toFloat())
63
+ .coerceIn(0f, 1f)
64
+ }
59
65
  )
60
66
 
61
67
  val headerColor = getHeaderColor(options.headerType, opacity, options.tintColor, Colors.black_17)
@@ -64,11 +70,16 @@ fun Header() {
64
70
 
65
71
  val application = ApplicationContext.current
66
72
 
73
+ val background = if (options.headerType is HeaderType.Transparent)
74
+ options.backgroundColor ?: AppTheme.current.colors.background.surface
75
+ else
76
+ AppTheme.current.colors.background.surface
77
+
67
78
  if (options.headerType == HeaderType.None) return
68
79
  Box(
69
80
  Modifier.height(AppStatusBar.current + HEADER_HEIGHT.dp)
70
81
  .fillMaxWidth()
71
- .background(AppTheme.current.colors.background.surface.copy(alpha = animatedAlpha))
82
+ .background(background.copy(alpha = animatedAlpha))
72
83
  .conditional(application.isShowBaselineDebug()) {
73
84
  border(1.dp, Colors.blue_03)
74
85
  },
@@ -87,7 +98,7 @@ fun Header() {
87
98
  backgroundButton = headerColor.backgroundButton,
88
99
  tintIconColor = headerColor.tintIconColor,
89
100
  onBackHandler = {
90
- options.onBackHandler?.invoke() ?: navigator.pop()
101
+ onBackHandler?.invoke() ?: navigator.onBackSafe { }
91
102
  }
92
103
  )
93
104
  }
@@ -223,8 +234,16 @@ sealed class HeaderType {
223
234
  val layoutOffSet: Dp = 56.dp,
224
235
  val composable: @Composable (scrollState: Int) -> Unit = {}
225
236
  ) : HeaderType()
237
+
238
+ data class Transparent(
239
+ val isFullScreenContent: Boolean = false
240
+ ) : HeaderType()
226
241
  }
227
242
 
243
+ data class HeaderBackProps(
244
+ val preventBack: PopupNotifyProps? = null,
245
+ )
246
+
228
247
  data class HeaderColor(val tintIconColor: Color, val backgroundButton: Color, val borderColor: Color)
229
248
  fun getHeaderColor(headerType: HeaderType, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
230
249
  return if(headerType is HeaderType.Animated) {
package/gradle.properties CHANGED
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.155.1-hello.14
21
+ version=0.155.1-hello.2
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.155.1-hello.14-debug",
3
+ "version": "0.155.1-hello.2-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},
@@ -62,50 +62,6 @@ else
62
62
  sed -i "s/\"version\": \"$VERSION\"/\"version\": \"$DEBUG_VERSION\"/" package.json
63
63
  fi
64
64
 
65
- # Backup compose/build.gradle.kts
66
- echo "? Backing up compose/build.gradle.kts..."
67
- cp compose/build.gradle.kts compose/build.gradle.kts.backup
68
-
69
- # Comment out maven publish in compose/build.gradle.kts
70
- echo "💬 Commenting out maven publish in compose/build.gradle.kts..."
71
- if [[ "$OSTYPE" == "darwin"* ]]; then
72
- # macOS - Comment out imports
73
- sed -i '' 's/^import com\.vanniktech\.maven\.publish\.JavadocJar$/\/\/ &/' compose/build.gradle.kts
74
- sed -i '' 's/^import com\.vanniktech\.maven\.publish\.KotlinMultiplatform$/\/\/ &/' compose/build.gradle.kts
75
- # Comment out plugin
76
- sed -i '' 's/^ alias(libs\.plugins\.vanniktech\.mavenPublish)$/\/\/ &/' compose/build.gradle.kts
77
- # Comment out publishing block
78
- sed -i '' '/^publishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
79
- # Comment out entire mavenPublishing block (lines starting from mavenPublishing { to its closing })
80
- sed -i '' '/^mavenPublishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
81
- else
82
- # Linux - Comment out imports
83
- sed -i 's/^import com\.vanniktech\.maven\.publish\.JavadocJar$/\/\/ &/' compose/build.gradle.kts
84
- sed -i 's/^import com\.vanniktech\.maven\.publish\.KotlinMultiplatform$/\/\/ &/' compose/build.gradle.kts
85
- # Comment out plugin
86
- sed -i 's/^ alias(libs\.plugins\.vanniktech\.mavenPublish)$/\/\/ &/' compose/build.gradle.kts
87
- # Comment out publishing block
88
- sed -i '/^publishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
89
- # Comment out entire mavenPublishing block
90
- sed -i '/^mavenPublishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
91
- fi
92
-
93
- # Modify android configuration for debug version
94
- echo "🔧 Modifying android configuration for debug version..."
95
- if [[ "$OSTYPE" == "darwin"* ]]; then
96
- # macOS
97
- sed -i '' 's/namespace = "\$gitlabGroup\.\$gitlabArtifactId"/namespace = "vn.momo.kits.kits"/' compose/build.gradle.kts
98
- sed -i '' 's/compileSdk = libs\.versions\.android\.compileSdk\.get()\.toInt()/compileSdk = 35/' compose/build.gradle.kts
99
- sed -i '' 's/minSdk = libs\.versions\.android\.minSdk\.get()\.toInt()/minSdk = 24/' compose/build.gradle.kts
100
- sed -i '' "s/version = gitlabVersion/version = \"$DEBUG_VERSION\"/" compose/build.gradle.kts
101
- else
102
- # Linux
103
- sed -i 's/namespace = "\$gitlabGroup\.\$gitlabArtifactId"/namespace = "vn.momo.kits.kits"/' compose/build.gradle.kts
104
- sed -i 's/compileSdk = libs\.versions\.android\.compileSdk\.get()\.toInt()/compileSdk = 35/' compose/build.gradle.kts
105
- sed -i 's/minSdk = libs\.versions\.android\.minSdk\.get()\.toInt()/minSdk = 24/' compose/build.gradle.kts
106
- sed -i "s/version = gitlabVersion/version = \"$DEBUG_VERSION\"/" compose/build.gradle.kts
107
- fi
108
-
109
65
  # Backup .npmignore
110
66
  cp .npmignore .npmignore.backup
111
67
 
@@ -121,8 +77,6 @@ build/
121
77
  .run
122
78
 
123
79
  .gitattributes
124
- .gitlab-ci.yml
125
- .npmignore.backup
126
80
  EOF
127
81
 
128
82
  echo "📤 Publishing debug version (with compose)..."
@@ -132,10 +86,6 @@ npm publish --tag beta --access=public
132
86
  mv .npmignore.backup .npmignore
133
87
  echo "✅ .npmignore restored"
134
88
 
135
- # Restore compose/build.gradle.kts
136
- mv compose/build.gradle.kts.backup compose/build.gradle.kts
137
- echo "✅ compose/build.gradle.kts restored"
138
-
139
89
  # Restore package.json version to original
140
90
  if [[ "$OSTYPE" == "darwin"* ]]; then
141
91
  # macOS
@@ -1,180 +0,0 @@
1
- import com.vanniktech.maven.publish.JavadocJar
2
- import com.vanniktech.maven.publish.KotlinMultiplatform
3
- import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
-
5
- plugins {
6
- alias(libs.plugins.jetbrains.kotlin.multiplatform)
7
- alias(libs.plugins.android.library)
8
- alias(libs.plugins.compose)
9
- alias(libs.plugins.kotlin.compose.compiler)
10
- alias(libs.plugins.vanniktech.mavenPublish)
11
- id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
12
- kotlin("plugin.serialization")
13
- }
14
-
15
- val gitlabName: String? = findProperty("name") as String? ?: ""
16
- val gitlabRepo: String? = findProperty("repo") as String? ?: ""
17
- val gitlabUrl: String? = findProperty("url") as String? ?: ""
18
- val gitlabGroup: String? = findProperty("group") as String? ?: ""
19
- val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
20
- val gitlabVersion: String? = findProperty("version") as String? ?: ""
21
- val gitlabUser: String? = findProperty("gitlab.user") as String? ?: ""
22
- val gitlabKey: String? = findProperty("gitlab.password") as String? ?: ""
23
-
24
- kotlin {
25
- androidTarget {
26
- compilerOptions {
27
- jvmTarget.set(JvmTarget.JVM_17)
28
- }
29
- publishLibraryVariants("release")
30
- }
31
-
32
- val fwName = gitlabArtifactId
33
- val iosTargets = listOf(iosX64(), iosArm64(), iosSimulatorArm64())
34
- iosTargets.forEach {
35
- it.binaries.framework {
36
- baseName = fwName
37
- binaryOption("bundleId", "$gitlabGroup.$fwName")
38
- isStatic = true
39
- }
40
- }
41
-
42
- cocoapods {
43
- version = gitlabVersion
44
- summary = "IOS Shared module"
45
- homepage = "https://momo.vn"
46
- ios.deploymentTarget = "15.0"
47
-
48
- framework {
49
- baseName = fwName
50
- isStatic = true
51
- }
52
-
53
- pod("lottie-ios") {
54
- moduleName = "Lottie"
55
- version = "4.4.3"
56
- extraOpts += listOf("-compiler-option", "-fmodules")
57
- }
58
- }
59
-
60
- sourceSets {
61
- commonMain.dependencies {
62
- implementation(compose.runtime)
63
- implementation(compose.material)
64
- implementation(compose.material3)
65
- implementation(compose.components.resources)
66
- implementation(libs.ktor.client.core)
67
- implementation(libs.jetbrains.coroutines.core)
68
- implementation(libs.navigation.multiplatform)
69
- implementation(libs.coil.multiplatform.compose)
70
- implementation(libs.coil.multiplatform.core)
71
- implementation(libs.coil.multiplatform.network.ktor)
72
- implementation(libs.jetbrains.serialization.json)
73
- implementation(libs.kotlinx.datetime)
74
- api(libs.native.max.api)
75
- }
76
- androidMain.dependencies {
77
- implementation(libs.ktor.client.okhttp)
78
- implementation(libs.airbnb.lottie)
79
- }
80
- iosMain.dependencies {
81
- implementation(libs.ktor.client.darwin)
82
- }
83
- }
84
- }
85
-
86
- android {
87
- namespace = "$gitlabGroup.$gitlabArtifactId"
88
- compileSdk = libs.versions.android.compileSdk.get().toInt()
89
- compileOptions {
90
- sourceCompatibility = JavaVersion.VERSION_17
91
- targetCompatibility = JavaVersion.VERSION_17
92
- }
93
- defaultConfig {
94
- minSdk = libs.versions.android.minSdk.get().toInt()
95
- }
96
- }
97
-
98
- dependencies {
99
- }
100
-
101
- repositories {
102
- google {
103
- mavenContent {
104
- includeGroupAndSubgroups("androidx")
105
- includeGroupAndSubgroups("com.android")
106
- includeGroupAndSubgroups("com.google")
107
- }
108
- }
109
- mavenCentral()
110
- maven {
111
- url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
112
- credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
113
- }
114
- maven {
115
- url = uri("http://nexus.mservice.com.vn:8081/repository/maven-public/")
116
- isAllowInsecureProtocol = true
117
- }
118
- }
119
-
120
- compose {
121
- resources {
122
- publicResClass = true
123
- packageOfResClass = "vn.momo.uikits.resources"
124
- generateResClass = always
125
- }
126
- }
127
-
128
- publishing {
129
- repositories {
130
- maven {
131
- name = "${gitlabRepo}Packages"
132
- credentials {
133
- username = gitlabUser
134
- password = gitlabKey
135
- }
136
- url = uri("$gitlabUrl")
137
- }
138
- }
139
- }
140
-
141
- mavenPublishing {
142
- configure(
143
- KotlinMultiplatform(
144
- javadocJar = JavadocJar.Empty(),
145
- sourcesJar = true,
146
- androidVariantsToPublish = listOf("release")
147
- )
148
- )
149
-
150
- repositories {
151
- maven {
152
- name = "${gitlabRepo}Packages"
153
- credentials { username = gitlabUser; password = gitlabKey }
154
- url = uri("$gitlabUrl")
155
- }
156
- }
157
-
158
- coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
159
-
160
- pom {
161
- name = "$gitlabName Klib"
162
- description = "$gitlabName"
163
- url = "https://gitlab.mservice.com.vn"
164
- licenses {
165
- license {
166
- name = "The Apache License, Version 2.0"
167
- url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
168
- distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
169
- }
170
- }
171
- developers {
172
- developer {
173
- id = "kotlin-hands-on"
174
- name = "Kotlin Developer Advocate"
175
- url = "https://github.com/kotlin-hands-on/"
176
- }
177
- }
178
- }
179
- }
180
-