@momo-kits/native-kits 0.161.2-beta.15-debug → 0.161.2-beta.16-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.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.161.2-beta.15-debug"
43
+ version = "0.161.2-beta.16-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -38,6 +38,7 @@ import androidx.compose.runtime.produceState
38
38
  import androidx.compose.runtime.remember
39
39
  import androidx.compose.runtime.rememberUpdatedState
40
40
  import androidx.compose.runtime.snapshotFlow
41
+ import androidx.compose.runtime.staticCompositionLocalOf
41
42
  import androidx.compose.ui.Alignment
42
43
  import androidx.compose.ui.Modifier
43
44
  import androidx.compose.ui.composed
@@ -48,6 +49,7 @@ import androidx.compose.ui.geometry.Offset
48
49
  import androidx.compose.ui.geometry.Rect
49
50
  import androidx.compose.ui.graphics.Brush
50
51
  import androidx.compose.ui.graphics.Color
52
+ import androidx.compose.ui.graphics.SolidColor
51
53
  import androidx.compose.ui.graphics.graphicsLayer
52
54
  import androidx.compose.ui.input.pointer.pointerInput
53
55
  import androidx.compose.ui.layout.Layout
@@ -60,19 +62,15 @@ import androidx.compose.ui.layout.layoutId
60
62
  import androidx.compose.ui.platform.LocalDensity
61
63
  import androidx.compose.ui.platform.LocalFocusManager
62
64
  import androidx.compose.ui.platform.LocalSoftwareKeyboardController
63
- import androidx.compose.ui.text.style.TextOverflow
64
65
  import androidx.compose.ui.text.TextStyle
66
+ import androidx.compose.ui.text.style.TextOverflow
65
67
  import androidx.compose.ui.unit.Constraints
66
68
  import androidx.compose.ui.unit.Dp
67
69
  import androidx.compose.ui.unit.IntOffset
68
70
  import androidx.compose.ui.unit.LayoutDirection
69
71
  import androidx.compose.ui.unit.dp
70
- import androidx.compose.ui.unit.sp
71
- import androidx.compose.runtime.staticCompositionLocalOf
72
- import androidx.compose.ui.graphics.Color.Companion
73
- import androidx.compose.ui.graphics.SolidColor
74
72
  import androidx.compose.ui.unit.lerp
75
- import kotlinx.coroutines.flow.StateFlow
73
+ import androidx.compose.ui.unit.sp
76
74
  import kotlinx.coroutines.flow.collectLatest
77
75
  import kotlinx.coroutines.flow.mapNotNull
78
76
  import vn.momo.kits.components.Icon
@@ -81,11 +79,11 @@ import vn.momo.kits.const.AppTheme
81
79
  import vn.momo.kits.const.Colors
82
80
  import vn.momo.kits.const.Spacing
83
81
  import vn.momo.kits.const.Typography
84
- import vn.momo.kits.modifier.conditional
85
82
  import vn.momo.kits.modifier.kitsAutomationId
86
83
  import vn.momo.kits.modifier.noFeedbackClickable
87
84
  import vn.momo.kits.modifier.setAutomationId
88
85
  import vn.momo.kits.modifier.shadow
86
+ import vn.momo.kits.navigation.component.HEADER_HEIGHT
89
87
  import vn.momo.kits.utils.getAppStatusBarHeight
90
88
  import kotlin.math.max
91
89
  import kotlin.math.roundToInt
@@ -441,6 +439,7 @@ private class LiteScreenLayoutPolicy(
441
439
  val spacing12 = Spacing.M.roundToPx()
442
440
  val spaceBetween = headerSpaceBetween?.roundToPx() ?: spacing12
443
441
  val statusBarPx = statusBarHeight.roundToPx()
442
+ val headerRowDefault = HEADER_HEIGHT.dp.roundToPx()
444
443
  val scrollPercent = scrollPercentage.value
445
444
 
446
445
  val contentMeasurable = measurables.find { it.layoutId == HeaderId.CONTENT_ID }
@@ -484,26 +483,20 @@ private class LiteScreenLayoutPolicy(
484
483
  )
485
484
  )
486
485
 
487
- val firstRowMaxHeight = buildList {
488
- add(backIconPlaceable.safeHeight)
489
- add(headerRightPlaceable.safeHeight)
490
- if (!isHeaderExtend) {
491
- add(inputSearchPlaceable.safeHeight)
492
- }
493
- add(HEADER_HEIGHT.dp.roundToPx())
494
- if (isHeaderExtend) {
495
- add(titlePlaceable.safeHeight)
496
- }
497
- }.max()
498
-
499
- var defaultHeight = statusBarPx + spacing12 + firstRowMaxHeight + spacing12
486
+ /**
487
+ * replicate logic from [vn.momo.kits.navigation.component.HeaderBackground]
488
+ * */
489
+ var defaultHeight = statusBarPx + headerRowDefault
500
490
  if (isHeaderExtend) {
501
- defaultHeight += inputSearchPlaceable.safeHeight + spacing12
491
+ defaultHeight = 154.dp.roundToPx()
502
492
  }
503
493
  val headerHeight = when {
504
494
  isHeaderNone -> statusBarPx
505
495
  !useAnimationSearch && !isHeaderExtend -> defaultHeight
506
- else -> (defaultHeight - scrollPercent * (defaultHeight - statusBarPx - HEADER_HEIGHT.dp.roundToPx())).toInt()
496
+ else -> {
497
+ val collapsableSpace = defaultHeight - statusBarPx - headerRowDefault
498
+ (defaultHeight - scrollPercent * collapsableSpace).toInt()
499
+ }
507
500
  }
508
501
 
509
502
  val layoutWidth = constraints.maxWidth
@@ -566,14 +559,14 @@ private class LiteScreenLayoutPolicy(
566
559
  if (backIconPlaceable != null) {
567
560
  backIconPlaceable.place(
568
561
  x = startX,
569
- y = startY + backIconPlaceable.verticalCenterOffset(firstRowMaxHeight),
562
+ y = startY + backIconPlaceable.verticalCenterOffset(headerRowDefault),
570
563
  )
571
564
  curX += backIconPlaceable.safeWidth + spaceBetween
572
565
  }
573
566
 
574
567
  headerRightPlaceable?.place(
575
568
  x = layoutWidth - spacing12 - headerRightPlaceable.safeWidth,
576
- y = startY + headerRightPlaceable.verticalCenterOffset(firstRowMaxHeight),
569
+ y = startY + headerRightPlaceable.verticalCenterOffset(headerRowDefault),
577
570
  )
578
571
 
579
572
  val titleOffset = IntOffset(
@@ -582,19 +575,19 @@ private class LiteScreenLayoutPolicy(
582
575
  space = layoutWidth,
583
576
  layoutDirection = layoutDirection,
584
577
  ),
585
- y = startY + titlePlaceable.verticalCenterOffset(firstRowMaxHeight),
578
+ y = startY + titlePlaceable.verticalCenterOffset(headerRowDefault),
586
579
  )
587
580
 
588
581
  titlePlaceable?.place(titleOffset)
589
582
 
590
583
  if (backIconPlaceable != null || headerRightPlaceable != null || titlePlaceable != null) {
591
- curY += firstRowMaxHeight
584
+ curY += headerRowDefault
592
585
  }
593
586
 
594
587
  val inputSearchOffset = if (isHeaderExtend) {
595
- val baseY = curY + inputSearchPlaceable.verticalCenterOffset(firstRowMaxHeight)
588
+ val baseY = curY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault)
596
589
  val y = (baseY * (1 - scrollPercent)).toInt().coerceAtLeast(
597
- startY + inputSearchPlaceable.verticalCenterOffset(firstRowMaxHeight)
590
+ startY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault)
598
591
  )
599
592
  IntOffset(
600
593
  x = startX + ((backIconPlaceable.safeWidth + spaceBetween) * (scrollPercent * 2f).coerceIn(
@@ -605,7 +598,7 @@ private class LiteScreenLayoutPolicy(
605
598
  } else {
606
599
  IntOffset(
607
600
  x = curX,
608
- y = startY + inputSearchPlaceable.verticalCenterOffset(firstRowMaxHeight),
601
+ y = startY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault),
609
602
  )
610
603
  }
611
604
  val finalPosition = lerp(
@@ -823,7 +816,8 @@ private fun LiteInputSearch(
823
816
  if (!placeHolder.isNullOrEmpty()) {
824
817
  inputSearchProps.customPlaceHolder?.invoke() ?: Text(
825
818
  text = placeHolder ?: "",
826
- style = inputSearchProps.customTextStyle ?: Typography.bodyDefaultRegular,
819
+ style = inputSearchProps.customTextStyle
820
+ ?: Typography.bodyDefaultRegular,
827
821
  maxLines = 1,
828
822
  color = theme.colors.text.hint,
829
823
  overflow = TextOverflow.Ellipsis
@@ -13,7 +13,6 @@ import vn.momo.kits.navigation.component.HeaderBackProps
13
13
  import vn.momo.kits.navigation.component.HeaderRight
14
14
  import vn.momo.kits.navigation.component.HeaderTitle
15
15
  import vn.momo.kits.navigation.component.HeaderType
16
- import vn.momo.kits.navigation.component.TitlePosition
17
16
 
18
17
  class Navigation(
19
18
  val id: Int = -1,
@@ -29,7 +28,6 @@ class Navigation(
29
28
  hiddenBack: Boolean? = null,
30
29
  headerBackProps: HeaderBackProps? = null,
31
30
  headerTitle: HeaderTitle? = null,
32
- titlePosition: TitlePosition? = null,
33
31
  headerRight: HeaderRight? = null,
34
32
  headerType: HeaderType? = null,
35
33
  scrollData: ScrollData? = null,
@@ -45,7 +43,6 @@ class Navigation(
45
43
  hiddenBack = hiddenBack ?: options.hiddenBack,
46
44
  headerBackProps = headerBackProps ?: options.headerBackProps,
47
45
  headerTitle = headerTitle ?: options.headerTitle,
48
- titlePosition = titlePosition ?: options.titlePosition,
49
46
  headerRight = headerRight ?: options.headerRight,
50
47
  headerType = headerType ?: options.headerType,
51
48
  scrollData = scrollData ?: options.scrollData,
@@ -80,7 +77,6 @@ data class NavigationOptions(
80
77
  val hiddenBack: Boolean = false,
81
78
  val headerBackProps: HeaderBackProps = HeaderBackProps(),
82
79
  val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
83
- val titlePosition: TitlePosition = TitlePosition.LEFT,
84
80
  val headerRight: HeaderRight = HeaderRight.Toolkit(),
85
81
  val headerType: HeaderType = HeaderType.Default(),
86
82
  val scrollData: ScrollData = ScrollData(),
@@ -6,6 +6,7 @@ import androidx.compose.foundation.border
6
6
  import androidx.compose.foundation.layout.Arrangement
7
7
  import androidx.compose.foundation.layout.Box
8
8
  import androidx.compose.foundation.layout.Row
9
+ import androidx.compose.foundation.layout.RowScope
9
10
  import androidx.compose.foundation.layout.Spacer
10
11
  import androidx.compose.foundation.layout.fillMaxWidth
11
12
  import androidx.compose.foundation.layout.height
@@ -22,7 +23,6 @@ import androidx.compose.ui.graphics.Brush
22
23
  import androidx.compose.ui.graphics.Color
23
24
  import androidx.compose.ui.layout.onGloballyPositioned
24
25
  import androidx.compose.ui.platform.LocalDensity
25
- import androidx.compose.ui.text.style.TextAlign
26
26
  import androidx.compose.ui.unit.Dp
27
27
  import androidx.compose.ui.unit.dp
28
28
  import vn.momo.kits.components.Icon
@@ -44,7 +44,6 @@ import vn.momo.kits.navigation.getInputSearchType
44
44
 
45
45
  const val HEADER_HEIGHT = 52
46
46
  enum class InputSearchType { None, Header, Animated }
47
- enum class TitlePosition { LEFT, CENTER }
48
47
 
49
48
  @Composable
50
49
  fun Header(onBackHandler: (() -> Unit)? = null) {
@@ -77,13 +76,6 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
77
76
  AppTheme.current.colors.background.surface
78
77
 
79
78
  if (options.headerType == HeaderType.None) return
80
-
81
- val titlePosition = options.titlePosition
82
- val titleColor = headerColor.tintIconColor
83
- .copy(alpha = if (inputSearchType == InputSearchType.Animated) 1f - animatedAlpha else 1f)
84
- // Centered title needs a full-width overlay to stay screen-centered, not boxed between back button and header right.
85
- val centerTitle = titlePosition == TitlePosition.CENTER && options.headerTitle is HeaderTitle.Default
86
-
87
79
  Box(
88
80
  Modifier.height(AppStatusBar.current + HEADER_HEIGHT.dp)
89
81
  .fillMaxWidth()
@@ -112,37 +104,17 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
112
104
  Spacer(Modifier.width(Spacing.M))
113
105
  }
114
106
 
115
- if (centerTitle) {
116
- Spacer(Modifier.weight(1f))
117
- } else {
118
- HeaderContent(
119
- headerTitle = options.headerTitle,
120
- tintIconColor = titleColor,
121
- titlePosition = titlePosition,
122
- modifier = Modifier.weight(1f)
123
- )
124
- }
107
+ HeaderContent(
108
+ options.headerTitle,
109
+ headerColor.tintIconColor
110
+ .copy(alpha = if (inputSearchType == InputSearchType.Animated) 1f - animatedAlpha else 1f)
111
+ )
125
112
  Box(Modifier.onGloballyPositioned {
126
113
  if(headerRightWidthPx.intValue != it.size.width) headerRightWidthPx.intValue = it.size.width
127
114
  }){
128
115
  HeaderRight(options.headerRight, options.tintColor, headerColor)
129
116
  }
130
117
  }
131
- if (centerTitle) {
132
- Box(
133
- modifier = Modifier.height(HEADER_HEIGHT.dp)
134
- .fillMaxWidth()
135
- .padding(horizontal = Spacing.M),
136
- contentAlignment = Alignment.Center
137
- ) {
138
- HeaderContent(
139
- headerTitle = options.headerTitle,
140
- tintIconColor = titleColor,
141
- titlePosition = titlePosition,
142
- modifier = Modifier.fillMaxWidth()
143
- )
144
- }
145
- }
146
118
  VerticalShadow(opacity)
147
119
  }
148
120
  }
@@ -155,7 +127,7 @@ private fun BackButton(borderColor: Color, backgroundButton: Color, tintIconColo
155
127
  .background(backgroundButton, RoundedCornerShape(100))
156
128
  .border(width = 0.2.dp, color = borderColor, shape = RoundedCornerShape(100))
157
129
  .activeOpacityClickable(onClick = onBackHandler)
158
- .padding(Spacing.XS)
130
+ // .padding(Spacing.XS)
159
131
  .setAutomationId("btn_navigation_back"),
160
132
  contentAlignment = Alignment.Center
161
133
  ) {
@@ -168,23 +140,15 @@ private fun BackButton(borderColor: Color, backgroundButton: Color, tintIconColo
168
140
  }
169
141
 
170
142
  @Composable
171
- fun HeaderContent(
172
- headerTitle: HeaderTitle,
173
- tintIconColor: Color,
174
- titlePosition: TitlePosition = TitlePosition.LEFT,
175
- modifier: Modifier = Modifier,
176
- ){
143
+ fun RowScope.HeaderContent(headerTitle: HeaderTitle, tintIconColor: Color){
177
144
  Box(
178
- modifier = modifier,
179
- contentAlignment = if (titlePosition == TitlePosition.CENTER) Alignment.Center else Alignment.CenterStart
145
+ Modifier.weight(1f)
180
146
  ) {
181
147
  when (headerTitle){
182
148
  is HeaderTitle.Default -> {
183
149
  HeaderTitle(
184
150
  title = headerTitle.title,
185
- color = tintIconColor,
186
- modifier = Modifier.fillMaxWidth(fraction = if (titlePosition == TitlePosition.CENTER) 0.5f else 1f),
187
- textAlign = if (titlePosition == TitlePosition.CENTER) TextAlign.Center else TextAlign.Start
151
+ color = tintIconColor
188
152
  )
189
153
  }
190
154
  is HeaderTitle.Journey -> {}
@@ -16,13 +16,11 @@ import vn.momo.kits.modifier.setAutomationId
16
16
  fun HeaderTitle(
17
17
  title: String = "",
18
18
  color: Color? = null,
19
- modifier: Modifier = Modifier.fillMaxWidth(),
20
- textAlign: TextAlign = TextAlign.Start,
21
19
  ) {
22
20
  Text(
23
- modifier = modifier.zIndex(1f).setAutomationId("title_navigation_header"),
21
+ modifier = Modifier.fillMaxWidth().zIndex(1f).setAutomationId("title_navigation_header"),
24
22
  text = title,
25
- textAlign = textAlign,
23
+ textAlign = TextAlign.Start,
26
24
  style = Typography.actionSBold.copy(
27
25
  fontSize = 15.sp,
28
26
  lineHeight = 22.sp,
@@ -11,9 +11,7 @@ import androidx.compose.ui.graphics.Color
11
11
  import io.github.alexzhirkevich.compottie.Compottie
12
12
  import io.github.alexzhirkevich.compottie.ExperimentalCompottieApi
13
13
  import io.github.alexzhirkevich.compottie.LottieCompositionSpec
14
- // AI-GENERATED START
15
14
  import io.github.alexzhirkevich.compottie.animateLottieCompositionAsState
16
- // AI-GENERATED END
17
15
  import io.github.alexzhirkevich.compottie.dynamic.rememberLottieDynamicProperties
18
16
  import io.github.alexzhirkevich.compottie.rememberLottieComposition
19
17
  import io.github.alexzhirkevich.compottie.rememberLottiePainter
@@ -51,15 +49,6 @@ internal fun ComposeLottieAnimation(
51
49
  null
52
50
  }
53
51
 
54
- // AI-GENERATED START
55
- // We use the compottie-core painter (not the umbrella overload) so the `keight`
56
- // umbrella stays out of the iOS link graph (see libs.versions.toml). The core painter
57
- // requires us to drive playback and supply the expression engine ourselves:
58
- // - animateLottieCompositionAsState gives the looping progress (IterateForever).
59
- // - enableExpressions = false disables Lottie JS expressions, which live in the
60
- // umbrella + keight umbrella. MoMo's UI animations do not use JS expressions.
61
- // - expressionEngineFactory is never invoked while enableExpressions = false
62
- // (AnimationState.scriptEngine is `by lazy`), so the stub below cannot run.
63
52
  val lottieState = animateLottieCompositionAsState(
64
53
  composition = composition,
65
54
  iterations = Compottie.IterateForever,
@@ -80,5 +69,4 @@ internal fun ComposeLottieAnimation(
80
69
  modifier = Modifier.fillMaxSize(),
81
70
  )
82
71
  }
83
- // AI-GENERATED END
84
72
  }
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.161.2-beta.15
21
+ version=0.161.2-beta.16
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.161.2-beta.15-debug",
3
+ "version": "0.161.2-beta.16-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},