@momo-kits/native-kits 0.117.1 → 0.117.2-beta.2
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 +8 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +12 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +22 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +24 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +9 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +23 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +35 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{PromotionPopup.kt → PopupPromotion.kt} +15 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +30 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +3 -3
- package/ios/Application/Components.swift +30 -11
- package/ios/Application/HeaderRight.swift +22 -12
- package/ios/Application/Screen.swift +17 -4
- package/ios/Button/Button.swift +4 -4
- package/ios/Image/Image.swift +2 -2
- package/ios/Popup/PopupDisplay.swift +91 -47
- package/ios/Popup/PopupPromotion.swift +55 -36
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import SwiftUI
|
|
|
6
6
|
public enum PopupButtonDirection {
|
|
7
7
|
case row
|
|
8
8
|
case column
|
|
9
|
+
case auto
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
// MARK: - PopupButtonType
|
|
@@ -20,7 +21,7 @@ public enum PopupButtonType {
|
|
|
20
21
|
public struct PopupDisplay: View {
|
|
21
22
|
// MARK: Lifecycle
|
|
22
23
|
|
|
23
|
-
public init(isPresented: Binding<Bool>, title: String = "", description: String = "", url: String = "", buttonDirection: PopupButtonDirection = .column, buttonType: PopupButtonType = .button, actionButtonTitle: String = "", closeButtonTitle: String = "", onPressAction: @escaping () -> Void = {}, onPressCloseButton: @escaping () -> Void = {}, onClose: @escaping () -> Void = {}) {
|
|
24
|
+
public init(isPresented: Binding<Bool>, title: String = "", description: String = "", url: String = "", buttonDirection: PopupButtonDirection = .column, buttonType: PopupButtonType = .button, actionButtonTitle: String = "", closeButtonTitle: String = "", onPressAction: @escaping () -> Void = {}, onPressCloseButton: @escaping () -> Void = {}, onClose: @escaping () -> Void = {}, errorCode: String = "", isShowCloseIcon: Bool = true) {
|
|
24
25
|
self._isPresented = isPresented
|
|
25
26
|
self.title = title
|
|
26
27
|
self.description = description
|
|
@@ -32,69 +33,112 @@ public struct PopupDisplay: View {
|
|
|
32
33
|
self.onClose = onClose
|
|
33
34
|
self.closeButtonTitle = closeButtonTitle
|
|
34
35
|
self.actionButtonTitle = actionButtonTitle
|
|
36
|
+
self.errorCode = errorCode
|
|
37
|
+
self.isShowCloseIcon = isShowCloseIcon
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
// MARK: Public
|
|
38
41
|
|
|
42
|
+
@State private var textHeight: CGFloat = .zero
|
|
43
|
+
@State private var isScrollable = false
|
|
44
|
+
|
|
39
45
|
public var body: some View {
|
|
46
|
+
var shouldUseColumn: Bool {
|
|
47
|
+
buttonDirection == .column || (buttonDirection == .auto && (closeButtonTitle.count > 12 || actionButtonTitle.count > 12))
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
VStack(spacing: 12) {
|
|
41
51
|
ZStack(alignment: .topTrailing) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
VStack {
|
|
55
|
-
if(!url.isEmpty) {
|
|
56
|
-
WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
57
|
-
.resizable()
|
|
58
|
-
.placeholder {
|
|
59
|
-
Rectangle()
|
|
60
|
-
.fill(Color.gray.opacity(0.3))
|
|
61
|
-
.frame(maxWidth: .infinity, maxHeight: 184)
|
|
62
|
-
}
|
|
63
|
-
.scaledToFill()
|
|
64
|
-
.frame(maxWidth: .infinity)
|
|
65
|
-
.clipShape(RoundedCorner(radius: 15, corners: [.topLeft, .topRight]))
|
|
66
|
-
.aspectRatio(2, contentMode: .fit)
|
|
52
|
+
if(isShowCloseIcon) {
|
|
53
|
+
SwiftUI.Button(action: onClose) {
|
|
54
|
+
Image(systemName: "xmark.circle.fill")
|
|
55
|
+
.resizable()
|
|
56
|
+
.frame(width: 22, height: 22)
|
|
57
|
+
.overlay(RoundedRectangle(cornerRadius: Radius.L).stroke(Colors.black01, lineWidth: 2))
|
|
58
|
+
}.foregroundColor(Colors.black20)
|
|
59
|
+
.background(Colors.black01.cornerRadius(15))
|
|
60
|
+
.padding(.trailing, -11)
|
|
61
|
+
.padding(.top, -11)
|
|
62
|
+
.zIndex(1)
|
|
63
|
+
.accessibility(identifier: "ic_popup_close")
|
|
67
64
|
}
|
|
65
|
+
|
|
66
|
+
VStack {
|
|
67
|
+
if(!url.isEmpty) {
|
|
68
|
+
WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
69
|
+
.resizable()
|
|
70
|
+
.placeholder {
|
|
71
|
+
Rectangle()
|
|
72
|
+
.fill(Color.gray.opacity(0.3))
|
|
73
|
+
.frame(maxWidth: .infinity, maxHeight: 184)
|
|
74
|
+
}
|
|
75
|
+
.aspectRatio(2, contentMode: .fit)
|
|
76
|
+
.frame(maxWidth: .infinity, alignment: .center)
|
|
77
|
+
.clipShape(RoundedCorner(radius: 15, corners: [.topLeft, .topRight]))
|
|
78
|
+
.clipped()
|
|
79
|
+
}
|
|
68
80
|
VStack(alignment: .leading) {
|
|
69
81
|
Text(title)
|
|
70
82
|
.foregroundColor(.black)
|
|
71
83
|
.font(.header_default_semibold)
|
|
72
|
-
.padding(.top,
|
|
84
|
+
.padding(.top, 24)
|
|
73
85
|
.padding(.bottom, 8)
|
|
74
86
|
.lineLimit(2)
|
|
75
87
|
.accessibility(identifier: "title_popup_permission")
|
|
76
88
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
Group {
|
|
90
|
+
if isScrollable {
|
|
91
|
+
ScrollView(showsIndicators: false) {
|
|
92
|
+
Text(description)
|
|
93
|
+
.font(.paragraph)
|
|
94
|
+
.foregroundColor(Colors.black17)
|
|
95
|
+
.multilineTextAlignment(.leading)
|
|
96
|
+
.background(GeometryReader { geo in
|
|
97
|
+
Color.clear
|
|
98
|
+
.onAppear {
|
|
99
|
+
textHeight = geo.size.height
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
.frame(height: 60)
|
|
104
|
+
} else {
|
|
105
|
+
Text(description)
|
|
106
|
+
.font(.paragraph)
|
|
107
|
+
.foregroundColor(Colors.black17)
|
|
108
|
+
.multilineTextAlignment(.leading)
|
|
109
|
+
.background(GeometryReader { geo in
|
|
110
|
+
Color.clear
|
|
111
|
+
.onAppear {
|
|
112
|
+
textHeight = geo.size.height
|
|
113
|
+
isScrollable = textHeight > 60 // adjust threshold to ~3 lines
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
}.padding(.bottom, 8)
|
|
118
|
+
|
|
119
|
+
if(!errorCode.isEmpty) {
|
|
120
|
+
Text("Mã lỗi: " + errorCode)
|
|
121
|
+
.foregroundColor(Colors.black12)
|
|
122
|
+
.font(.description_xs_regular)
|
|
123
|
+
.lineLimit(1)
|
|
124
|
+
.padding(.bottom, 8)
|
|
125
|
+
}
|
|
83
126
|
}
|
|
84
127
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
85
128
|
.padding(.horizontal, 24)
|
|
129
|
+
.padding(.bottom, 16)
|
|
86
130
|
|
|
87
|
-
if
|
|
131
|
+
if shouldUseColumn {
|
|
88
132
|
if buttonType == .text {
|
|
89
|
-
|
|
133
|
+
ColumnTextButtons
|
|
90
134
|
} else {
|
|
91
|
-
|
|
135
|
+
ColumnButtons
|
|
92
136
|
}
|
|
93
137
|
} else {
|
|
94
138
|
if buttonType == .text {
|
|
95
|
-
|
|
139
|
+
RowTextButtons
|
|
96
140
|
} else {
|
|
97
|
-
|
|
141
|
+
RowButtons
|
|
98
142
|
}
|
|
99
143
|
}
|
|
100
144
|
|
|
@@ -120,7 +164,9 @@ public struct PopupDisplay: View {
|
|
|
120
164
|
var onClose: () -> Void
|
|
121
165
|
var actionButtonTitle: String
|
|
122
166
|
var closeButtonTitle: String
|
|
123
|
-
|
|
167
|
+
var errorCode: String
|
|
168
|
+
var isShowCloseIcon: Bool
|
|
169
|
+
|
|
124
170
|
var RowTextButtons: some View {
|
|
125
171
|
HStack {
|
|
126
172
|
SwiftUI.Button(action: onPressCloseButton) {
|
|
@@ -157,7 +203,9 @@ public struct PopupDisplay: View {
|
|
|
157
203
|
|
|
158
204
|
var RowButtons: some View {
|
|
159
205
|
HStack {
|
|
160
|
-
|
|
206
|
+
if(!closeButtonTitle.isEmpty) {
|
|
207
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium).accessibility(identifier: "btn_popup_cancel")
|
|
208
|
+
}
|
|
161
209
|
Button(title: actionButtonTitle, action: onPressAction, size: .medium)
|
|
162
210
|
.accessibility(identifier: "btn_popup_allow")
|
|
163
211
|
}
|
|
@@ -173,17 +221,13 @@ public struct PopupDisplay: View {
|
|
|
173
221
|
action: onPressAction,
|
|
174
222
|
size: .medium
|
|
175
223
|
).accessibility(identifier: "btn_popup_allow")
|
|
176
|
-
|
|
177
|
-
|
|
224
|
+
if(!closeButtonTitle.isEmpty) {
|
|
225
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium).accessibility(identifier: "btn_popup_cancel")
|
|
226
|
+
}
|
|
178
227
|
}
|
|
179
228
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
180
229
|
.padding(.horizontal, 24)
|
|
181
230
|
.padding(.bottom, 24)
|
|
182
231
|
}
|
|
183
232
|
|
|
184
|
-
|
|
185
|
-
func onPressClose(){
|
|
186
|
-
isPresented = false
|
|
187
|
-
onClose()
|
|
188
|
-
}
|
|
189
233
|
}
|
|
@@ -1,52 +1,71 @@
|
|
|
1
|
-
import SDWebImageSwiftUI
|
|
2
1
|
import SwiftUI
|
|
2
|
+
import SDWebImageSwiftUI
|
|
3
3
|
|
|
4
4
|
public struct PopupPromotion: View {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
self._isPresented = isPresented
|
|
9
|
-
self.onPressAction = onPressAction
|
|
10
|
-
self.buttonTitle = buttonTitle
|
|
11
|
-
self.onClose = onClose
|
|
12
|
-
self.url = url
|
|
13
|
-
}
|
|
5
|
+
var imageUrl: String
|
|
6
|
+
var onIconClose: (() -> Void)?
|
|
7
|
+
var onAction: (() -> Void)?
|
|
14
8
|
|
|
15
|
-
|
|
9
|
+
|
|
10
|
+
public init(
|
|
11
|
+
imageUrl: String,
|
|
12
|
+
onIconClose: (() -> Void)? = nil,
|
|
13
|
+
onAction: (() -> Void)? = nil
|
|
14
|
+
) {
|
|
15
|
+
self.imageUrl = imageUrl
|
|
16
|
+
self.onIconClose = onIconClose
|
|
17
|
+
self.onAction = onAction
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
public var body: some View {
|
|
18
|
-
VStack(spacing:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
VStack(spacing: 8) {
|
|
22
|
+
if(imageUrl.isEmpty) {
|
|
23
|
+
Icon(source: "media_fail", size: UIScreen.main.bounds.width - Spacing.XL * 2)
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
WebImage(url: URL(string: imageUrl)!)
|
|
21
27
|
.resizable()
|
|
22
28
|
.placeholder {
|
|
23
|
-
|
|
29
|
+
Color.gray
|
|
30
|
+
.aspectRatio(0.72, contentMode: .fit)
|
|
31
|
+
.frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
|
|
32
|
+
.clipped()
|
|
24
33
|
}
|
|
25
34
|
.scaledToFill()
|
|
26
|
-
.
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
35
|
+
.aspectRatio(0.72, contentMode: .fit)
|
|
36
|
+
.frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2, alignment: .center)
|
|
37
|
+
.clipped()
|
|
38
|
+
.onTapGesture {
|
|
39
|
+
onAction?()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
buildCloseIcon()
|
|
33
43
|
}
|
|
34
|
-
.
|
|
35
|
-
.shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
|
|
36
|
-
.shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
|
|
37
|
-
.padding(.horizontal, 40)
|
|
44
|
+
.accessibility(identifier: "popup_promotion")
|
|
38
45
|
}
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
@ViewBuilder
|
|
48
|
+
private func buildCloseIcon() -> some View {
|
|
49
|
+
HStack {
|
|
50
|
+
Spacer()
|
|
51
|
+
SwiftUI.Button(action: {
|
|
52
|
+
onIconClose?()
|
|
53
|
+
}) {
|
|
54
|
+
ZStack {
|
|
55
|
+
Circle()
|
|
56
|
+
.strokeBorder(Colors.black01, lineWidth: 2)
|
|
57
|
+
.background(Circle().fill(Colors.black17))
|
|
58
|
+
.frame(width: 20, height: 20)
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
func onPressClose(){
|
|
49
|
-
isPresented = false
|
|
50
|
-
onClose()
|
|
60
|
+
Icon(source: "navigation_close", size: 14, color: Colors.black01)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
.padding(8)
|
|
64
|
+
Spacer()
|
|
65
|
+
}
|
|
51
66
|
}
|
|
67
|
+
|
|
52
68
|
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
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
|
+
#Thu Jan 09 10:43:10 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sophia/Library/Android/sdk
|