@momo-kits/native-kits 0.113.1-beta.8 → 0.113.1-beta.9

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.
@@ -86,13 +86,6 @@ fun Header(
86
86
  )
87
87
  )
88
88
 
89
- fun getHeaderRightOpacity(): Float {
90
- if (useAnimationSearch) {
91
- return 1f - (opacity ?: 1f)
92
- }
93
- return if (animatedHeader !== null) opacity ?: 1f else 1f
94
- }
95
-
96
89
  if (headerType != HeaderType.NONE) {
97
90
  BoxWithConstraints(
98
91
  Modifier.height(statusBarHeight + 52.dp)
@@ -141,7 +134,7 @@ fun Header(
141
134
 
142
135
  if (((useAnimationSearch && inputSearchProps != null) || inputSearchProps == null) && miniAppContext != null) {
143
136
  Box(Modifier.graphicsLayer {
144
- alpha = getHeaderRightOpacity()
137
+ alpha = if (useAnimationSearch) 1f - (opacity ?: 1f) else 1f
145
138
  }) {
146
139
  headerRight?.invoke()
147
140
  }
@@ -25,7 +25,7 @@ import vn.momo.kits.const.Typography
25
25
  fun CheckBox(
26
26
  disabled: Boolean = false,
27
27
  checked: Boolean = false,
28
- onCheckedChange: () -> Unit,
28
+ onCheckedChange: (Boolean) -> Unit,
29
29
  indeterminate: Boolean = false,
30
30
  title: String = "",
31
31
  ) {
@@ -53,7 +53,7 @@ fun CheckBox(
53
53
  .background(backgroundColor, RoundedCornerShape(Radius.XS))
54
54
  .border(Spacing.XXS, borderColor, RoundedCornerShape(Radius.XS))
55
55
  .clickable(
56
- onClick = onCheckedChange,
56
+ onClick = { onCheckedChange(!checked) },
57
57
  enabled = !disabled,
58
58
  ),
59
59
  ) {
@@ -115,7 +115,7 @@ fun PopupNotify(
115
115
  )
116
116
 
117
117
  Column(modifier = Modifier.padding(Spacing.XL)) {
118
- Text(style = Typography.titleXs, maxLines = 1, text = title)
118
+ Text(style = Typography.titleXs, maxLines = 2, text = title)
119
119
  content(Modifier.padding(top = Spacing.S))
120
120
  if (error.isNotEmpty()) {
121
121
  Text(
@@ -23,22 +23,12 @@ public class MiniAppContext {
23
23
  }
24
24
  }
25
25
 
26
- public struct Config: Decodable {
27
- public let trustBanner: TrustBanner?
28
-
29
- enum CodingKeys: String, CodingKey {
30
- case trustBanner = "trust_banner"
31
- }
32
- }
33
-
34
26
  public class ApplicationEnvironment: ObservableObject {
35
27
  let applicationContext: MiniAppContext?
36
28
  let composeApi: KitComposeApi
37
- @Published public var config: Config?
38
29
 
39
- public init(applicationContext: MiniAppContext?, composeApi: KitComposeApi, config: Config? = nil) {
30
+ public init(applicationContext: MiniAppContext?, composeApi: KitComposeApi) {
40
31
  self.applicationContext = applicationContext
41
32
  self.composeApi = composeApi
42
- self.config = config
43
33
  }
44
34
  }
@@ -98,9 +98,8 @@ private extension View {
98
98
  case .secondary:
99
99
  return AnyView(self
100
100
  .background(Colors.card)
101
- .foregroundColor(Colors.text)
101
+ .foregroundColor(Colors.primary)
102
102
  .cornerRadius(8)
103
- .overlay(RoundedRectangle(cornerRadius: Radius.S).stroke(Colors.black06, lineWidth: 1))
104
103
  .padding(2)
105
104
  )
106
105
  case .outline:
@@ -43,6 +43,7 @@ public struct PopupDisplay: View {
43
43
  Image(systemName: "xmark.circle.fill")
44
44
  .resizable()
45
45
  .frame(width: 16, height: 16)
46
+ .overlay(RoundedRectangle(cornerRadius: Radius.S).stroke(Colors.black01, lineWidth: 1))
46
47
  }.foregroundColor(Colors.black20)
47
48
  .background(Colors.black01.cornerRadius(8))
48
49
  .offset(x: 6, y: -6)
@@ -52,15 +53,17 @@ public struct PopupDisplay: View {
52
53
  WebImage(url: URL(string: url), isAnimating: .constant(true))
53
54
  .resizable()
54
55
  .scaledToFill()
55
- .frame(maxWidth: .infinity, maxHeight: 164)
56
+ .frame(maxWidth: .infinity)
56
57
  .clipShape(RoundedCorner(radius: 8, corners: [.topLeft, .topRight]))
58
+ .aspectRatio(2, contentMode: .fit)
57
59
 
58
60
  VStack(alignment: .leading) {
59
61
  Text(title)
60
62
  .foregroundColor(.black)
61
- .font(.headerText1)
62
- .padding(.top, 12)
63
- .padding(.bottom, 24)
63
+ .font(.header_default_bold)
64
+ .padding(.top, 16)
65
+ .padding(.bottom, 8)
66
+ .lineLimit(2)
64
67
 
65
68
  Text(description)
66
69
  .foregroundColor(.black)
@@ -87,10 +90,8 @@ public struct PopupDisplay: View {
87
90
  }.clipped()
88
91
  }
89
92
  }
90
- .background(Color.white.cornerRadius(8))
91
- .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
92
- .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
93
- .padding(.horizontal, 40)
93
+ .background(Color.white.cornerRadius(15))
94
+ .padding(.horizontal, 24)
94
95
  }
95
96
 
96
97
  // MARK: Internal
@@ -106,7 +107,7 @@ public struct PopupDisplay: View {
106
107
  var onClose: () -> Void
107
108
  var actionButtonTitle: String
108
109
  var closeButtonTitle: String
109
-
110
+
110
111
  var RowTextButtons: some View {
111
112
  HStack {
112
113
  SwiftUI.Button(action: onPressCloseButton) {
@@ -143,8 +144,8 @@ public struct PopupDisplay: View {
143
144
 
144
145
  var RowButtons: some View {
145
146
  HStack {
146
- Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary)
147
- Button(title: actionButtonTitle, action: onPressAction)
147
+ Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium)
148
+ Button(title: actionButtonTitle, action: onPressAction, size: .medium)
148
149
  }
149
150
  .frame(maxWidth: .infinity, alignment: .center)
150
151
  .padding(.horizontal, 24)
@@ -153,8 +154,12 @@ public struct PopupDisplay: View {
153
154
 
154
155
  var ColumnButtons: some View {
155
156
  VStack(alignment: .trailing) {
156
- Button(title: actionButtonTitle, action: onPressAction)
157
- Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary)
157
+ Button(
158
+ title: actionButtonTitle,
159
+ action: onPressAction,
160
+ size: .medium
161
+ )
162
+ Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium)
158
163
  }
159
164
  .frame(maxWidth: .infinity, alignment: .trailing)
160
165
  .padding(.horizontal, 24)
@@ -9,9 +9,14 @@ import Foundation
9
9
  import SwiftUI
10
10
  import SDWebImageSwiftUI
11
11
 
12
- public struct TrustBanner: Decodable {
12
+ let jsonUrl = "https://static.momocdn.net/app/json/component-kits/design_system.json"
13
+
14
+ struct TrustBannerData: Decodable {
15
+ let trustBanner: TrustBanner
16
+ }
17
+
18
+ struct TrustBanner: Decodable {
13
19
  let content: Dictionary<String, String>
14
- let subContent: Dictionary<String, String>
15
20
  let pciImage: String
16
21
  let sslImage: String
17
22
  let urlConfig: String
@@ -20,20 +25,18 @@ public struct TrustBanner: Decodable {
20
25
  let momoImage: String
21
26
 
22
27
  enum CodingKeys: String, CodingKey {
23
- case content, subContent, pciImage, sslImage, icons, momoImage
28
+ case content, pciImage, sslImage, icons, momoImage
24
29
  case urlConfig = "url_config"
25
30
  case featureCode = "feature_code"
26
31
  }
27
32
  }
28
33
 
29
34
  let defaultBanner = TrustBanner(
30
- content: ["vi": "An toàn tài sản & Bảo mật thông tin của bạn là ưu tiên hàng đầu của MoMo.",
31
- "en": "Ensuring financial security and data privacy is MoMo's highest priority."],
32
- subContent: ["vi": "Tìm hiểu thêm",
33
- "en": "Learn more"],
34
- pciImage: "https://static.momocdn.net/app/img/kits/trustBanner/pci_dss.png",
35
+ content: ["vi": "Bảo mật thông tin & An toàn tài sản của bạn là ưu tiên hàng đầu của MoMo.",
36
+ "en": "Your data security and money safety are MoMo's top priorities."],
37
+ pciImage: "https://static.momocdn.net/app/img/kits/trustBanner/pci.png",
35
38
  sslImage: "https://static.momocdn.net/app/img/kits/trustBanner/ssl.png",
36
- urlConfig: "login_and_security",
39
+ urlConfig: "https://momo.vn/an-toan-bao-mat",
37
40
  featureCode: "login_and_security",
38
41
  icons: [
39
42
  "https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png",
@@ -41,23 +44,58 @@ let defaultBanner = TrustBanner(
41
44
  "https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png",
42
45
  "https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png"
43
46
  ],
44
- momoImage: "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png"
47
+ momoImage: "https://static.momocdn.net/app/img/kits/trustBanner/ic_momo_secu.png"
45
48
  )
46
49
 
50
+ let defaultData = TrustBannerData(trustBanner: defaultBanner)
51
+
52
+ class TrustBannerViewModel: ObservableObject {
53
+ @Published var trustBanner: TrustBannerData?
54
+
55
+ init() {
56
+ fetchData(from: jsonUrl)
57
+ }
58
+
59
+ func fetchData(from urlString: String) {
60
+ guard let url = URL(string: urlString) else { return }
61
+
62
+ URLSession.shared.dataTask(with: url) { [weak self] data, response, error in
63
+ guard let self = self else { return }
64
+
65
+ if let error = error {
66
+ print("Data fetching error: \(error)")
67
+ return
68
+ }
69
+
70
+ guard let data = data else {
71
+ print("No data received")
72
+ return
73
+ }
74
+ do {
75
+ let decodedData = try JSONDecoder().decode(TrustBannerData.self, from: data)
76
+ DispatchQueue.main.async {
77
+ self.trustBanner = decodedData
78
+ }
79
+ } catch {
80
+ print("Decoding error: \(error)")
81
+ }
82
+ }.resume()
83
+ }
84
+ }
85
+
47
86
  public struct TrustBannerView: View {
48
87
  var serviceName: String? = ""
49
88
  var screenName: String? = ""
50
89
  var onPress: ((_ params: NSDictionary) -> Void)?
51
90
  var trackEvent: ((_ eventName: String, _ params: NSDictionary) -> Void)?
52
91
  var language: String?
53
-
54
- @EnvironmentObject private var environment: ApplicationEnvironment
92
+
93
+ @ObservedObject private var viewModel = TrustBannerViewModel()
55
94
 
56
95
  public init(serviceName: String?,
57
96
  screenName: String?,
58
97
  onPress: ((_ params: NSDictionary) -> Void)?,
59
- trackEvent: ((_ eventName: String,_ params: NSDictionary) -> Void)?,
60
- language: String? = "vi") {
98
+ trackEvent: ((_ eventName: String,_ params: NSDictionary) -> Void)?, language: String? = "vi") {
61
99
  if let trackEvent = trackEvent {
62
100
  trackEvent("service_component_displayed", ["service_name": serviceName ?? "", "screen_name": screenName ?? "", "component_name": "logo_trust"])
63
101
  }
@@ -69,15 +107,9 @@ public struct TrustBannerView: View {
69
107
  }
70
108
 
71
109
  public var body: some View {
72
- let trustBanner = environment.config?.trustBanner ?? defaultBanner
73
- TrustBannerContentView(
74
- trustBanner: trustBanner,
75
- onPress: onPress,
76
- trackEvent: trackEvent,
77
- serviceName: serviceName,
78
- screenName: screenName,
79
- language: language
80
- )
110
+ if let trustBanner = viewModel.trustBanner {
111
+ TrustBannerContentView(trustBanner: trustBanner.trustBanner, onPress: onPress, trackEvent: trackEvent, serviceName: serviceName, screenName: screenName, language: language)
112
+ }
81
113
  }
82
114
  }
83
115
 
@@ -96,47 +128,52 @@ struct TrustBannerContentView: View {
96
128
  .resizable()
97
129
  .scaledToFit()
98
130
  .frame(width: 64, height: 64)
99
- VStack(alignment: .leading, spacing: 8) {
131
+ VStack(alignment: .leading, spacing: 8){
100
132
  Text(trustBanner.content[language ?? "vi"] ?? "")
101
133
  .foregroundColor(Color(hex: 0xFF484848))
102
134
  .lineLimit(2)
103
- .font(.system(size: 12))
104
- .frame(maxWidth: .infinity, alignment: .leading)
105
-
106
- HStack {
107
- HStack(spacing: 2) {
108
- Text(trustBanner.subContent[language ?? "vi"] ?? "")
109
- .foregroundColor(Color(hex: 0xFFEB2F96))
110
- .font(.system(size: 12))
111
-
112
- WebImage(url: URL(string: "https://img.mservice.io/momo_app_v2/new_version/img/appx_icon/16_arrow_chevron_right_small.png"))
135
+ .font(.system(size: 12, weight: Font.Weight.regular))
136
+ .frame(width: geo.size.width - 24 - 64 - 8, height: 40,alignment: .leading)
137
+ HStack{
138
+ HStack{
139
+ WebImage(url: URL(string: trustBanner.pciImage))
113
140
  .resizable()
114
- .renderingMode(.template)
115
- .foregroundColor(Color(hex: 0xFFEB2F96))
116
- .frame(width: 16, height: 16)
141
+ .scaledToFit()
142
+ .frame(width: 52, height: 20)
143
+ WebImage(url: URL(string: trustBanner.sslImage))
144
+ .resizable()
145
+ .scaledToFit()
146
+ .frame(width: 52, height: 20)
117
147
  }
118
-
119
148
  Spacer()
120
-
121
- HStack(spacing: 4) {
122
- if let pciUrl = URL(string: trustBanner.pciImage) {
123
- WebImage(url: pciUrl)
149
+ HStack(spacing: -6){
150
+ ForEach(trustBanner.icons, id: \.self) { iconURL in
151
+ WebImage(url: URL(string: iconURL))
124
152
  .resizable()
125
153
  .scaledToFit()
126
- .frame(width: 27, height: 20)
154
+ .frame(width:24, height: 24)
155
+ .background(Color.white)
156
+ .cornerRadius(12)
157
+ .overlay(
158
+ Circle().stroke(Color(hex: 0xFFE8E8E8), lineWidth: 1)
159
+ )
127
160
  }
128
-
129
- if let sslUrl = URL(string: trustBanner.sslImage) {
130
- WebImage(url: sslUrl)
131
- .resizable()
132
- .scaledToFit()
133
- .frame(width: 52, height: 20)
134
- }
135
- }
161
+ Text("36+")
162
+ .font(.system(size: 10, weight: Font.Weight.regular))
163
+ .frame(width: 24, height: 24, alignment: .center)
164
+ .foregroundColor(Color(hex: 0xFFEB2F96))
165
+ .background(Color(hex: 0xFFFDEAF4))
166
+ .cornerRadius(12)
167
+ .overlay(
168
+ Circle()
169
+ .stroke(Color(hex: 0xFFE8E8E8), lineWidth: 1)
170
+ )
171
+ }.frame(width: 96, height: 24)
136
172
  }
137
173
  }
138
174
  }
139
- .padding(12)
175
+ .frame(width: geo.size.width - 24)
176
+ .padding(EdgeInsets(top: 12, leading: 12, bottom: 12, trailing: 12))
140
177
  .background(Color(hex: 0xFFF2F8FF))
141
178
  .cornerRadius(12)
142
179
  .onTapGesture {
@@ -144,7 +181,7 @@ struct TrustBannerContentView: View {
144
181
  trackEvent("service_component_clicked", ["service_name": self.serviceName ?? "", "screen_name": self.screenName ?? "", "component_name": "logo_trust", "url_config": trustBanner.urlConfig])
145
182
  }
146
183
  if let onPress = onPress {
147
- onPress(["service_name": self.serviceName ?? "", "screen_name": self.screenName ?? "", "url_config": trustBanner.urlConfig])
184
+ onPress(["service_name": self.serviceName ?? "", "screen_name": self.screenName ?? "", "component_name": "logo_trust", "url_config": trustBanner.urlConfig, "feature_code": trustBanner.featureCode])
148
185
  }
149
186
  }
150
187
  }
package/local.properties CHANGED
@@ -4,5 +4,5 @@
4
4
  # Location of the SDK. This is only used by Gradle.
5
5
  # For customization when using a Version Control System, please read the
6
6
  # header note.
7
- #Tue Apr 23 16:40:15 ICT 2024
8
- sdk.dir=/Users/hung.dao1/Library/Android/sdk
7
+ #Thu Jan 09 10:43:10 ICT 2025
8
+ sdk.dir=/Users/sophia/Library/Android/sdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.113.1-beta.8",
3
+ "version": "0.113.1-beta.9",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},