@momo-kits/native-kits 0.113.1-beta.7 → 0.113.1-beta.8
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/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +9 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +2 -2
- package/ios/Application/ApplicationEnvironment.swift +11 -1
- package/ios/Template/TrustBanner/TrustBanner.swift +53 -90
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -86,6 +86,13 @@ 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
|
+
|
|
89
96
|
if (headerType != HeaderType.NONE) {
|
|
90
97
|
BoxWithConstraints(
|
|
91
98
|
Modifier.height(statusBarHeight + 52.dp)
|
|
@@ -132,9 +139,9 @@ fun Header(
|
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
141
|
|
|
135
|
-
if (inputSearchProps == null && miniAppContext != null) {
|
|
142
|
+
if (((useAnimationSearch && inputSearchProps != null) || inputSearchProps == null) && miniAppContext != null) {
|
|
136
143
|
Box(Modifier.graphicsLayer {
|
|
137
|
-
alpha =
|
|
144
|
+
alpha = getHeaderRightOpacity()
|
|
138
145
|
}) {
|
|
139
146
|
headerRight?.invoke()
|
|
140
147
|
}
|
|
@@ -79,12 +79,12 @@ object Spacing {
|
|
|
79
79
|
|
|
80
80
|
@Composable
|
|
81
81
|
fun HeaderRight(
|
|
82
|
-
|
|
82
|
+
data: HeaderRightData? = null,
|
|
83
83
|
) {
|
|
84
84
|
Row(
|
|
85
85
|
verticalAlignment = Alignment.CenterVertically,
|
|
86
86
|
) {
|
|
87
|
-
ToolkitHeaderRight(headerRight =
|
|
87
|
+
ToolkitHeaderRight(headerRight = data)
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -23,12 +23,22 @@ 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
|
+
|
|
26
34
|
public class ApplicationEnvironment: ObservableObject {
|
|
27
35
|
let applicationContext: MiniAppContext?
|
|
28
36
|
let composeApi: KitComposeApi
|
|
37
|
+
@Published public var config: Config?
|
|
29
38
|
|
|
30
|
-
public init(applicationContext: MiniAppContext?, composeApi: KitComposeApi) {
|
|
39
|
+
public init(applicationContext: MiniAppContext?, composeApi: KitComposeApi, config: Config? = nil) {
|
|
31
40
|
self.applicationContext = applicationContext
|
|
32
41
|
self.composeApi = composeApi
|
|
42
|
+
self.config = config
|
|
33
43
|
}
|
|
34
44
|
}
|
|
@@ -9,14 +9,9 @@ import Foundation
|
|
|
9
9
|
import SwiftUI
|
|
10
10
|
import SDWebImageSwiftUI
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
struct TrustBannerData: Decodable {
|
|
15
|
-
let trustBanner: TrustBanner
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
struct TrustBanner: Decodable {
|
|
12
|
+
public struct TrustBanner: Decodable {
|
|
19
13
|
let content: Dictionary<String, String>
|
|
14
|
+
let subContent: Dictionary<String, String>
|
|
20
15
|
let pciImage: String
|
|
21
16
|
let sslImage: String
|
|
22
17
|
let urlConfig: String
|
|
@@ -25,18 +20,20 @@ struct TrustBanner: Decodable {
|
|
|
25
20
|
let momoImage: String
|
|
26
21
|
|
|
27
22
|
enum CodingKeys: String, CodingKey {
|
|
28
|
-
case content, pciImage, sslImage, icons, momoImage
|
|
23
|
+
case content, subContent, pciImage, sslImage, icons, momoImage
|
|
29
24
|
case urlConfig = "url_config"
|
|
30
25
|
case featureCode = "feature_code"
|
|
31
26
|
}
|
|
32
27
|
}
|
|
33
28
|
|
|
34
29
|
let defaultBanner = TrustBanner(
|
|
35
|
-
content: ["vi": "
|
|
36
|
-
|
|
37
|
-
|
|
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",
|
|
38
35
|
sslImage: "https://static.momocdn.net/app/img/kits/trustBanner/ssl.png",
|
|
39
|
-
urlConfig: "
|
|
36
|
+
urlConfig: "login_and_security",
|
|
40
37
|
featureCode: "login_and_security",
|
|
41
38
|
icons: [
|
|
42
39
|
"https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png",
|
|
@@ -44,58 +41,23 @@ let defaultBanner = TrustBanner(
|
|
|
44
41
|
"https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png",
|
|
45
42
|
"https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png"
|
|
46
43
|
],
|
|
47
|
-
momoImage: "https://static.momocdn.net/app/img/kits/trustBanner/
|
|
44
|
+
momoImage: "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png"
|
|
48
45
|
)
|
|
49
46
|
|
|
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
|
-
|
|
86
47
|
public struct TrustBannerView: View {
|
|
87
48
|
var serviceName: String? = ""
|
|
88
49
|
var screenName: String? = ""
|
|
89
50
|
var onPress: ((_ params: NSDictionary) -> Void)?
|
|
90
51
|
var trackEvent: ((_ eventName: String, _ params: NSDictionary) -> Void)?
|
|
91
52
|
var language: String?
|
|
92
|
-
|
|
93
|
-
@
|
|
53
|
+
|
|
54
|
+
@EnvironmentObject private var environment: ApplicationEnvironment
|
|
94
55
|
|
|
95
56
|
public init(serviceName: String?,
|
|
96
57
|
screenName: String?,
|
|
97
58
|
onPress: ((_ params: NSDictionary) -> Void)?,
|
|
98
|
-
trackEvent: ((_ eventName: String,_ params: NSDictionary) -> Void)?,
|
|
59
|
+
trackEvent: ((_ eventName: String,_ params: NSDictionary) -> Void)?,
|
|
60
|
+
language: String? = "vi") {
|
|
99
61
|
if let trackEvent = trackEvent {
|
|
100
62
|
trackEvent("service_component_displayed", ["service_name": serviceName ?? "", "screen_name": screenName ?? "", "component_name": "logo_trust"])
|
|
101
63
|
}
|
|
@@ -107,9 +69,15 @@ public struct TrustBannerView: View {
|
|
|
107
69
|
}
|
|
108
70
|
|
|
109
71
|
public var body: some View {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
+
)
|
|
113
81
|
}
|
|
114
82
|
}
|
|
115
83
|
|
|
@@ -128,52 +96,47 @@ struct TrustBannerContentView: View {
|
|
|
128
96
|
.resizable()
|
|
129
97
|
.scaledToFit()
|
|
130
98
|
.frame(width: 64, height: 64)
|
|
131
|
-
VStack(alignment: .leading, spacing: 8){
|
|
99
|
+
VStack(alignment: .leading, spacing: 8) {
|
|
132
100
|
Text(trustBanner.content[language ?? "vi"] ?? "")
|
|
133
101
|
.foregroundColor(Color(hex: 0xFF484848))
|
|
134
102
|
.lineLimit(2)
|
|
135
|
-
.font(.system(size: 12
|
|
136
|
-
.frame(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.
|
|
142
|
-
.
|
|
143
|
-
|
|
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"))
|
|
144
113
|
.resizable()
|
|
145
|
-
.
|
|
146
|
-
.
|
|
114
|
+
.renderingMode(.template)
|
|
115
|
+
.foregroundColor(Color(hex: 0xFFEB2F96))
|
|
116
|
+
.frame(width: 16, height: 16)
|
|
147
117
|
}
|
|
118
|
+
|
|
148
119
|
Spacer()
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
120
|
+
|
|
121
|
+
HStack(spacing: 4) {
|
|
122
|
+
if let pciUrl = URL(string: trustBanner.pciImage) {
|
|
123
|
+
WebImage(url: pciUrl)
|
|
152
124
|
.resizable()
|
|
153
125
|
.scaledToFit()
|
|
154
|
-
.frame(width:
|
|
155
|
-
.background(Color.white)
|
|
156
|
-
.cornerRadius(12)
|
|
157
|
-
.overlay(
|
|
158
|
-
Circle().stroke(Color(hex: 0xFFE8E8E8), lineWidth: 1)
|
|
159
|
-
)
|
|
126
|
+
.frame(width: 27, height: 20)
|
|
160
127
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.stroke(Color(hex: 0xFFE8E8E8), lineWidth: 1)
|
|
170
|
-
)
|
|
171
|
-
}.frame(width: 96, height: 24)
|
|
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
|
+
}
|
|
172
136
|
}
|
|
173
137
|
}
|
|
174
138
|
}
|
|
175
|
-
.
|
|
176
|
-
.padding(EdgeInsets(top: 12, leading: 12, bottom: 12, trailing: 12))
|
|
139
|
+
.padding(12)
|
|
177
140
|
.background(Color(hex: 0xFFF2F8FF))
|
|
178
141
|
.cornerRadius(12)
|
|
179
142
|
.onTapGesture {
|
|
@@ -181,7 +144,7 @@ struct TrustBannerContentView: View {
|
|
|
181
144
|
trackEvent("service_component_clicked", ["service_name": self.serviceName ?? "", "screen_name": self.screenName ?? "", "component_name": "logo_trust", "url_config": trustBanner.urlConfig])
|
|
182
145
|
}
|
|
183
146
|
if let onPress = onPress {
|
|
184
|
-
onPress(["service_name": self.serviceName ?? "", "screen_name": self.screenName ?? "", "
|
|
147
|
+
onPress(["service_name": self.serviceName ?? "", "screen_name": self.screenName ?? "", "url_config": trustBanner.urlConfig])
|
|
185
148
|
}
|
|
186
149
|
}
|
|
187
150
|
}
|
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
|
-
#
|
|
8
|
-
sdk.dir=/Users/
|
|
7
|
+
#Tue Apr 23 16:40:15 ICT 2024
|
|
8
|
+
sdk.dir=/Users/hung.dao1/Library/Android/sdk
|