@momo-kits/native-kits 0.161.2-beta.2-debug → 0.161.2-beta.20-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.2-debug"
43
+ version = "0.161.2-beta.20-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.161.2-beta.1'
3
+ spec.version = '0.161.2-beta.15'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -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
@@ -1,6 +1,7 @@
1
1
  package vn.momo.kits.components
2
2
 
3
3
  import androidx.compose.foundation.border
4
+ import androidx.compose.foundation.text.InlineTextContent
4
5
  import androidx.compose.runtime.Composable
5
6
  import androidx.compose.runtime.remember
6
7
  import androidx.compose.ui.Modifier
@@ -37,8 +38,9 @@ fun Text(
37
38
  minLines: Int = 1,
38
39
  letterSpacing: TextUnit = TextUnit.Unspecified,
39
40
  softWrap: Boolean = true,
40
- accessibilityId: String? = null
41
- ) {
41
+ accessibilityId: String? = null,
42
+ inlineContent: Map<String, InlineTextContent> = mapOf(),
43
+ ) {
42
44
  Text(
43
45
  text = AnnotatedString(text),
44
46
  color = color,
@@ -53,7 +55,8 @@ fun Text(
53
55
  minLines = minLines,
54
56
  letterSpacing = letterSpacing,
55
57
  softWrap = softWrap,
56
- accessibilityId = accessibilityId
58
+ accessibilityId = accessibilityId,
59
+ inlineContent = inlineContent
57
60
  )
58
61
  }
59
62
 
@@ -73,7 +76,8 @@ fun Text(
73
76
  minLines: Int = 1,
74
77
  letterSpacing: TextUnit = TextUnit.Unspecified,
75
78
  softWrap: Boolean = true,
76
- accessibilityId: String? = null
79
+ accessibilityId: String? = null,
80
+ inlineContent: Map<String, InlineTextContent> = mapOf(),
77
81
  ) {
78
82
  // Cache theme access to avoid repeated lookups
79
83
  val theme = AppTheme.current
@@ -124,7 +128,8 @@ fun Text(
124
128
  minLines = minLines,
125
129
  textDecoration = textDecoration,
126
130
  onTextLayout = onTextLayout ?: {},
127
- overflow = overflow
131
+ overflow = overflow,
132
+ inlineContent = inlineContent
128
133
  )
129
134
  }
130
135
 
@@ -274,7 +274,7 @@ fun ScreenContent(content: @Composable () -> Unit) {
274
274
  Box(Modifier.fillMaxWidth().aspectRatio(animatedHeader.aspectRatio.value)) {
275
275
  animatedHeader.composable.invoke(scrollState.value)
276
276
  }
277
- Box(Modifier.offset(x = 0.dp, y = AppStatusBar.current + HEADER_HEIGHT.dp + animatedHeader.layoutOffSet)) {
277
+ Box(Modifier.padding(top = AppStatusBar.current + HEADER_HEIGHT.dp + animatedHeader.layoutOffSet)) {
278
278
  content()
279
279
  }
280
280
  }
@@ -11,6 +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
+ import io.github.alexzhirkevich.compottie.animateLottieCompositionAsState
14
15
  import io.github.alexzhirkevich.compottie.dynamic.rememberLottieDynamicProperties
15
16
  import io.github.alexzhirkevich.compottie.rememberLottieComposition
16
17
  import io.github.alexzhirkevich.compottie.rememberLottiePainter
@@ -48,12 +49,21 @@ internal fun ComposeLottieAnimation(
48
49
  null
49
50
  }
50
51
 
52
+ val lottieState = animateLottieCompositionAsState(
53
+ composition = composition,
54
+ iterations = Compottie.IterateForever,
55
+ )
56
+
51
57
  Box(modifier.background(bgColor ?: Color.Transparent)) {
52
58
  Image(
53
59
  painter = rememberLottiePainter(
54
60
  composition = composition,
55
- iterations = Compottie.IterateForever,
61
+ progress = lottieState::value,
56
62
  dynamicProperties = dynamicProperties,
63
+ enableExpressions = false,
64
+ expressionEngineFactory = { _, _ ->
65
+ error("Lottie JS expressions are disabled in MoMo kits")
66
+ },
57
67
  ),
58
68
  contentDescription = null,
59
69
  modifier = Modifier.fillMaxSize(),
@@ -13,7 +13,7 @@ androidGradlePlugin = "8.13.2"
13
13
  r8 = "8.9.35"
14
14
  kotlinx-datetime = "0.7.1"
15
15
  airbnb-lottie = "5.2.0"
16
- compottie = "2.2.1"
16
+ compottie = "2.1.0"
17
17
  androidx-activity = "1.9.1"
18
18
  androidx-appcompat = "1.7.0"
19
19
  material = "1.10.0"
@@ -39,7 +39,14 @@ coil-multiplatform-compose = { module = "io.coil-kt.coil3:coil-compose", version
39
39
  coil-multiplatform-network-ktor = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coil3-multiplatform" }
40
40
  r8 = { module = "com.android.tools:r8", version.ref = "r8" }
41
41
  airbnb-lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "airbnb-lottie" }
42
- compottie = { module = "io.github.alexzhirkevich:compottie", version.ref = "compottie" }
42
+ # AI-GENERATED START
43
+ # Depend on compottie-core (not the `compottie` umbrella). The umbrella drags in the
44
+ # separate `keight` umbrella artifact, which collides with `keight-core` on the
45
+ # `findRoot__at__ScriptRuntime` symbol (duplicate symbol at the iOS `ld` link of
46
+ # shared.framework). compottie-core pulls only `keight-core` (which declares
47
+ # keight.js.JsAny, so the earlier unlinked-symbol error stays fixed too).
48
+ compottie = { module = "io.github.alexzhirkevich:compottie-core", version.ref = "compottie" }
49
+ # AI-GENERATED END
43
50
  native-max-api = { group = "vn.momo.maxapi", name = "NativeMaxApi", version.ref = "nativemaxapi" }
44
51
  kits = { module = "vn.momo.kits:kits", version.ref = "kits" }
45
52
  androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
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.2
21
+ version=0.161.2-beta.20
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.2-debug",
3
+ "version": "0.161.2-beta.20-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},