@momo-kits/native-kits 0.117.1-beta.9 → 0.117.2-beta.1
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/HeaderDefault.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +4 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +34 -30
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +5 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +30 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +3 -3
- package/ios/Application/HeaderRight.swift +5 -5
- package/ios/Application/Screen.swift +4 -1
- package/ios/Button/Button.swift +4 -4
- package/ios/Popup/PopupDisplay.swift +65 -27
- package/ios/Popup/PopupPromotion.swift +20 -15
- package/package.json +1 -1
|
@@ -29,10 +29,10 @@ fun HeaderDefault(
|
|
|
29
29
|
val height = statusBarHeight + HEADER_HEIGHT.dp
|
|
30
30
|
Box(
|
|
31
31
|
modifier = Modifier.fillMaxWidth().height(height)
|
|
32
|
-
.background(backgroundColor
|
|
32
|
+
.background(if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.background.surface)
|
|
33
33
|
.bottomBorder(
|
|
34
34
|
strokeWidth = 1.dp,
|
|
35
|
-
color = backgroundColor
|
|
35
|
+
color = if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.border.default
|
|
36
36
|
)
|
|
37
37
|
) {
|
|
38
38
|
Box(
|
|
@@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
|
|
|
4
4
|
import androidx.compose.ui.Modifier
|
|
5
5
|
import androidx.compose.ui.graphics.Color
|
|
6
6
|
import androidx.compose.ui.text.style.TextAlign
|
|
7
|
+
import androidx.compose.ui.text.style.TextOverflow
|
|
7
8
|
import androidx.compose.ui.unit.sp
|
|
8
9
|
import androidx.compose.ui.zIndex
|
|
9
10
|
import vn.momo.kits.components.Text
|
|
@@ -25,6 +26,7 @@ fun HeaderTitle(
|
|
|
25
26
|
lineHeight = 22.sp,
|
|
26
27
|
),
|
|
27
28
|
color = color,
|
|
28
|
-
maxLines = 1
|
|
29
|
+
maxLines = 1,
|
|
30
|
+
overflow = TextOverflow.Ellipsis,
|
|
29
31
|
)
|
|
30
32
|
}
|
|
@@ -200,9 +200,8 @@ fun Footer(footer: @Composable (() -> Unit)? = null, keyboardSize: Dp = 0.dp, bo
|
|
|
200
200
|
Box(
|
|
201
201
|
Modifier
|
|
202
202
|
.offset(y = -keyboardSize)
|
|
203
|
-
.padding(bottom = bottom)
|
|
204
203
|
.shadow(
|
|
205
|
-
Colors.black_20.copy(alpha = 0.
|
|
204
|
+
Colors.black_20.copy(alpha = 0.2f),
|
|
206
205
|
borderRadius = 0.dp,
|
|
207
206
|
10f,
|
|
208
207
|
offsetX = 0.dp,
|
|
@@ -212,7 +211,9 @@ fun Footer(footer: @Composable (() -> Unit)? = null, keyboardSize: Dp = 0.dp, bo
|
|
|
212
211
|
.background(AppTheme.current.colors.background.surface)
|
|
213
212
|
) {
|
|
214
213
|
Box(
|
|
215
|
-
Modifier.fillMaxWidth()
|
|
214
|
+
Modifier.fillMaxWidth()
|
|
215
|
+
.padding(bottom = bottom)
|
|
216
|
+
.padding(vertical = Spacing.S, horizontal = Spacing.M)
|
|
216
217
|
) {
|
|
217
218
|
footer?.invoke()
|
|
218
219
|
}
|
|
@@ -57,6 +57,7 @@ fun PopupNotify(
|
|
|
57
57
|
secondary: PopupAction? = null,
|
|
58
58
|
buttonDirection: PopupActionDirection = PopupActionDirection.ROW,
|
|
59
59
|
onIconClose: () -> Unit,
|
|
60
|
+
isShowCloseIcon: Boolean = true,
|
|
60
61
|
) {
|
|
61
62
|
var isScroll by remember { mutableStateOf(false) }
|
|
62
63
|
val layoutResult = remember { mutableStateOf<TextLayoutResult?>(null) }
|
|
@@ -107,12 +108,13 @@ fun PopupNotify(
|
|
|
107
108
|
RoundedCornerShape(Radius.L)
|
|
108
109
|
)
|
|
109
110
|
) {
|
|
110
|
-
image.
|
|
111
|
+
if(image.isNotEmpty()) {
|
|
111
112
|
Image(
|
|
112
113
|
source = image,
|
|
113
|
-
modifier = Modifier.fillMaxWidth().aspectRatio(1.777f)
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
|
|
115
|
+
options = Options(alignment = Alignment.Center)
|
|
116
|
+
)
|
|
117
|
+
}
|
|
116
118
|
|
|
117
119
|
Column(modifier = Modifier.padding(Spacing.XL)) {
|
|
118
120
|
Text(
|
|
@@ -143,34 +145,36 @@ fun PopupNotify(
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
148
|
+
if(isShowCloseIcon) {
|
|
149
|
+
Box(
|
|
150
|
+
Modifier
|
|
151
|
+
.width(22.dp)
|
|
152
|
+
.height(22.dp)
|
|
153
|
+
.offset(x = -(1).dp, y = (-11).dp)
|
|
154
|
+
.background(
|
|
155
|
+
color = AppTheme.current.colors.text.default,
|
|
156
|
+
shape = RoundedCornerShape(Radius.M)
|
|
157
|
+
)
|
|
158
|
+
.border(
|
|
159
|
+
width = 2.dp,
|
|
160
|
+
color = AppTheme.current.colors.background.surface,
|
|
161
|
+
shape = RoundedCornerShape(Radius.M)
|
|
162
|
+
)
|
|
163
|
+
.clip(RoundedCornerShape(100))
|
|
164
|
+
.clickable(
|
|
165
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
166
|
+
indication = null,
|
|
167
|
+
onClick = { onClose { onIconClose() } }
|
|
168
|
+
),
|
|
169
|
+
contentAlignment = Alignment.Center
|
|
170
|
+
) {
|
|
171
|
+
Icon(
|
|
172
|
+
source = "navigation_close",
|
|
157
173
|
color = AppTheme.current.colors.background.surface,
|
|
158
|
-
|
|
174
|
+
size = 16.dp,
|
|
175
|
+
modifier = Modifier.setAutomationId("ic_popup_close")
|
|
159
176
|
)
|
|
160
|
-
|
|
161
|
-
.clickable(
|
|
162
|
-
interactionSource = remember { MutableInteractionSource() },
|
|
163
|
-
indication = null,
|
|
164
|
-
onClick = { onClose { onIconClose() } }
|
|
165
|
-
),
|
|
166
|
-
contentAlignment = Alignment.Center
|
|
167
|
-
) {
|
|
168
|
-
Icon(
|
|
169
|
-
source = "navigation_close",
|
|
170
|
-
color = AppTheme.current.colors.background.surface,
|
|
171
|
-
size = 16.dp,
|
|
172
|
-
modifier = Modifier.setAutomationId("ic_popup_close")
|
|
173
|
-
)
|
|
177
|
+
}
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
}
|
|
@@ -24,6 +24,7 @@ import androidx.compose.ui.unit.dp
|
|
|
24
24
|
import vn.momo.kits.const.AppTheme
|
|
25
25
|
import vn.momo.kits.const.Radius
|
|
26
26
|
import vn.momo.kits.const.Spacing
|
|
27
|
+
import vn.momo.kits.utils.ifNotNull
|
|
27
28
|
|
|
28
29
|
@Composable
|
|
29
30
|
fun PopupPromotion(
|
|
@@ -32,7 +33,7 @@ fun PopupPromotion(
|
|
|
32
33
|
onClose: (() -> Unit) = {},
|
|
33
34
|
) {
|
|
34
35
|
Column(Modifier.semantics { testTag = "popup_notify" }) {
|
|
35
|
-
|
|
36
|
+
source.ifNotNull(
|
|
36
37
|
Image(
|
|
37
38
|
source = source,
|
|
38
39
|
modifier = Modifier.fillMaxWidth()
|
|
@@ -42,9 +43,9 @@ fun PopupPromotion(
|
|
|
42
43
|
indication = null,
|
|
43
44
|
onClick = onPress
|
|
44
45
|
),
|
|
45
|
-
options = Options(alignment = Alignment.Center, contentScale = ContentScale.
|
|
46
|
-
)
|
|
47
|
-
|
|
46
|
+
options = Options(alignment = Alignment.Center, contentScale = ContentScale.Crop)
|
|
47
|
+
), null
|
|
48
|
+
)
|
|
48
49
|
Box(
|
|
49
50
|
modifier = Modifier
|
|
50
51
|
.padding(top = Spacing.S)
|
|
@@ -17,6 +17,7 @@ import androidx.compose.ui.graphics.Color
|
|
|
17
17
|
import androidx.compose.ui.unit.dp
|
|
18
18
|
import vn.momo.kits.const.Colors
|
|
19
19
|
import vn.momo.kits.const.Spacing
|
|
20
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
20
21
|
import vn.momo.kits.utils.ifTrue
|
|
21
22
|
|
|
22
23
|
@Composable
|
|
@@ -24,6 +25,8 @@ fun Switch(
|
|
|
24
25
|
value: Boolean = false,
|
|
25
26
|
onChange: (Boolean) -> Unit = {},
|
|
26
27
|
disabled: Boolean = false,
|
|
28
|
+
title: String? = "",
|
|
29
|
+
accessibilityId: String? = ""
|
|
27
30
|
) {
|
|
28
31
|
val circleBackgroundColor = value.ifTrue(Colors.black_01, Colors.black_03)
|
|
29
32
|
var backgroundColor = value.ifTrue(Colors.green_03, Colors.black_07)
|
|
@@ -32,27 +35,35 @@ fun Switch(
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
Box(
|
|
35
|
-
modifier = Modifier.
|
|
36
|
-
Modifier.width(38.dp).height(20.dp).border(
|
|
37
|
-
0.dp, Color.Unspecified,
|
|
38
|
-
RoundedCornerShape(20.dp)
|
|
39
|
-
).background(backgroundColor, RoundedCornerShape(20.dp)).clip(RoundedCornerShape(20.dp))
|
|
40
|
-
.clickable(
|
|
41
|
-
enabled = !disabled,
|
|
42
|
-
onClick = { onChange(!value) }
|
|
43
|
-
)
|
|
44
|
-
.padding(horizontal = Spacing.XS)
|
|
45
|
-
),
|
|
46
|
-
contentAlignment = value.ifTrue(Alignment.CenterEnd, Alignment.CenterStart)
|
|
38
|
+
modifier = Modifier.setAutomationId( accessibilityId ?: "toggle_${title ?: "unknown"}_${value}")
|
|
47
39
|
) {
|
|
48
40
|
Box(
|
|
49
|
-
modifier = Modifier.
|
|
50
|
-
.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
modifier = Modifier.then(
|
|
42
|
+
Modifier.width(38.dp).height(20.dp).border(
|
|
43
|
+
0.dp, Color.Unspecified,
|
|
44
|
+
RoundedCornerShape(20.dp)
|
|
45
|
+
).background(backgroundColor, RoundedCornerShape(20.dp))
|
|
46
|
+
.clip(RoundedCornerShape(20.dp))
|
|
47
|
+
.clickable(
|
|
48
|
+
enabled = !disabled,
|
|
49
|
+
onClick = { onChange(!value) }
|
|
50
|
+
)
|
|
51
|
+
.padding(horizontal = Spacing.XS)
|
|
52
|
+
),
|
|
53
|
+
contentAlignment = value.ifTrue(Alignment.CenterEnd, Alignment.CenterStart)
|
|
54
|
+
) {
|
|
55
|
+
Box(
|
|
56
|
+
modifier = Modifier.size(14.dp)
|
|
57
|
+
.border(0.dp, Color.Unspecified, RoundedCornerShape(percent = 100))
|
|
58
|
+
.background(circleBackgroundColor, RoundedCornerShape(percent = 100)),
|
|
59
|
+
contentAlignment = Alignment.Center
|
|
60
|
+
)
|
|
61
|
+
{
|
|
62
|
+
Box(
|
|
63
|
+
Modifier.size(6.dp)
|
|
64
|
+
.background(backgroundColor, RoundedCornerShape(percent = 100))
|
|
65
|
+
)
|
|
66
|
+
}
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
}
|
|
@@ -46,15 +46,15 @@ fun getFont(font: String): FontFamily {
|
|
|
46
46
|
fun getFontFamily(fontFamily: String, fontWeight: FontWeight? = FontWeight.Normal): FontFamily {
|
|
47
47
|
val key = "$fontFamily-${fontWeight?.weight}"
|
|
48
48
|
val fontMap = mapOf(
|
|
49
|
-
"SFProText-100" to "sfprotext_thin.
|
|
50
|
-
"SFProText-200" to "sfprotext_ultralight.
|
|
49
|
+
"SFProText-100" to "sfprotext_thin.ttf",
|
|
50
|
+
"SFProText-200" to "sfprotext_ultralight.ttf",
|
|
51
51
|
"SFProText-300" to "sfprotext_light.ttf",
|
|
52
52
|
"SFProText-400" to "sfprotext_regular.ttf",
|
|
53
53
|
"SFProText-500" to "sfprotext_medium.ttf",
|
|
54
54
|
"SFProText-600" to "sfprotext_semibold.ttf",
|
|
55
55
|
"SFProText-700" to "sfprotext_bold.ttf",
|
|
56
56
|
"SFProText-800" to "sfprotext_heavy.ttf",
|
|
57
|
-
"SFProText-900" to "sfprotext_black.
|
|
57
|
+
"SFProText-900" to "sfprotext_black.ttf",
|
|
58
58
|
|
|
59
59
|
"MoMoSignature-100" to "momosignature.otf",
|
|
60
60
|
"MoMoSignature-200" to "momosignature.otf",
|
|
@@ -179,14 +179,14 @@ struct ToolkitHeaderRight: View {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
var body: some View {
|
|
182
|
-
let backgroundButtonColor: Color = tintColor == Colors.black01 ?
|
|
183
|
-
let borderColor: Color = tintColor == Colors.black01 ?
|
|
182
|
+
let backgroundButtonColor: Color = tintColor == Colors.black01 ? Colors.black20.opacity(0.6) : Colors.black01.opacity(0.6)
|
|
183
|
+
let borderColor: Color = tintColor == Colors.black01 ? Colors.black01.opacity(0.2) : Colors.black20.opacity(0.2)
|
|
184
184
|
let navButtonConfig = getNavigationButtonConfig()
|
|
185
185
|
let showBadge = headerRight?.tools.contains { group in
|
|
186
186
|
group.items.contains { $0.showBadge }
|
|
187
187
|
} ?? false
|
|
188
188
|
|
|
189
|
-
HStack(alignment: .center) {
|
|
189
|
+
HStack(alignment: .center, spacing: 0) {
|
|
190
190
|
if headerRight?.useShortcut == true {
|
|
191
191
|
NavigationButton(
|
|
192
192
|
disabled: isLoading,
|
|
@@ -234,8 +234,8 @@ struct NavigationButton: View {
|
|
|
234
234
|
var tintColor: Color?
|
|
235
235
|
|
|
236
236
|
var body: some View {
|
|
237
|
-
let backgroundButtonColor: Color = tintColor == Colors.black01 ?
|
|
238
|
-
let borderColor: Color = tintColor == Colors.black01 ?
|
|
237
|
+
let backgroundButtonColor: Color = tintColor == Colors.black01 ? Colors.black20.opacity(0.6) : Colors.black01.opacity(0.6)
|
|
238
|
+
let borderColor: Color = tintColor == Colors.black01 ? Colors.black01.opacity(0.2) : Colors.black20.opacity(0.2)
|
|
239
239
|
|
|
240
240
|
ZStack {
|
|
241
241
|
Circle()
|
|
@@ -88,7 +88,8 @@ public struct Screen<Content: View>: View {
|
|
|
88
88
|
let screenHeight = height + topInset + bottomInset
|
|
89
89
|
|
|
90
90
|
ZStack {
|
|
91
|
-
(backgroundColor ?? Color.white)
|
|
91
|
+
(backgroundColor ?? Color.white)
|
|
92
|
+
.edgesIgnoringSafeArea(.top)
|
|
92
93
|
|
|
93
94
|
VStack(spacing: 0) {
|
|
94
95
|
ZStack(alignment: .top) {
|
|
@@ -184,6 +185,8 @@ struct Footer: View {
|
|
|
184
185
|
VStack {
|
|
185
186
|
footerView
|
|
186
187
|
}
|
|
188
|
+
.padding(.vertical, Spacing.S)
|
|
189
|
+
.padding(.horizontal, Spacing.M)
|
|
187
190
|
.padding(.bottom, keyboardSize)
|
|
188
191
|
.background(Colors.black01)
|
|
189
192
|
}
|
package/ios/Button/Button.swift
CHANGED
|
@@ -42,7 +42,7 @@ public struct Button: View {
|
|
|
42
42
|
SwiftUI.Button(action: action) {
|
|
43
43
|
HStack {
|
|
44
44
|
iconLeft
|
|
45
|
-
renderTitle(title: title, type: type, size: size)
|
|
45
|
+
renderTitle(title: title, type: type, size: size).lineLimit(1).truncationMode(.tail)
|
|
46
46
|
iconRight
|
|
47
47
|
}
|
|
48
48
|
.buttonSize(size)
|
|
@@ -123,15 +123,15 @@ private extension View {
|
|
|
123
123
|
case .large:
|
|
124
124
|
return self
|
|
125
125
|
.frame(maxWidth: .infinity, minHeight: 48, maxHeight: 48)
|
|
126
|
-
.padding([.leading, .trailing], Spacing.
|
|
126
|
+
.padding([.leading, .trailing], Spacing.L)
|
|
127
127
|
case .medium:
|
|
128
128
|
return self
|
|
129
129
|
.frame(minWidth: 80, maxWidth: .infinity, minHeight: 36, maxHeight: 36)
|
|
130
|
-
.padding([.leading, .trailing], Spacing.
|
|
130
|
+
.padding([.leading, .trailing], Spacing.M)
|
|
131
131
|
case .small:
|
|
132
132
|
return self
|
|
133
133
|
.frame(minWidth: 56, maxWidth: 76, minHeight: 28, maxHeight: 28)
|
|
134
|
-
.padding([.leading, .trailing], Spacing.
|
|
134
|
+
.padding([.leading, .trailing], Spacing.S)
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -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 = {}, errorCode: String = "") {
|
|
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
|
|
@@ -33,24 +34,34 @@ public struct PopupDisplay: View {
|
|
|
33
34
|
self.closeButtonTitle = closeButtonTitle
|
|
34
35
|
self.actionButtonTitle = actionButtonTitle
|
|
35
36
|
self.errorCode = errorCode
|
|
37
|
+
self.isShowCloseIcon = isShowCloseIcon
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
// MARK: Public
|
|
39
41
|
|
|
42
|
+
@State private var textHeight: CGFloat = .zero
|
|
43
|
+
@State private var isScrollable = false
|
|
44
|
+
|
|
40
45
|
public var body: some View {
|
|
46
|
+
var shouldUseColumn: Bool {
|
|
47
|
+
buttonDirection == .column || (buttonDirection == .auto && (closeButtonTitle.count > 12 || actionButtonTitle.count > 12))
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
VStack(spacing: 12) {
|
|
42
51
|
ZStack(alignment: .topTrailing) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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")
|
|
64
|
+
}
|
|
54
65
|
|
|
55
66
|
VStack {
|
|
56
67
|
if(!url.isEmpty) {
|
|
@@ -75,15 +86,38 @@ public struct PopupDisplay: View {
|
|
|
75
86
|
.lineLimit(2)
|
|
76
87
|
.accessibility(identifier: "title_popup_permission")
|
|
77
88
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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)
|
|
84
118
|
|
|
85
119
|
if(!errorCode.isEmpty) {
|
|
86
|
-
Text(errorCode)
|
|
120
|
+
Text("Mã lỗi: " + errorCode)
|
|
87
121
|
.foregroundColor(Colors.black12)
|
|
88
122
|
.font(.description_xs_regular)
|
|
89
123
|
.lineLimit(1)
|
|
@@ -94,17 +128,17 @@ public struct PopupDisplay: View {
|
|
|
94
128
|
.padding(.horizontal, 24)
|
|
95
129
|
.padding(.bottom, 16)
|
|
96
130
|
|
|
97
|
-
if
|
|
131
|
+
if shouldUseColumn {
|
|
98
132
|
if buttonType == .text {
|
|
99
|
-
|
|
133
|
+
ColumnTextButtons
|
|
100
134
|
} else {
|
|
101
|
-
|
|
135
|
+
ColumnButtons
|
|
102
136
|
}
|
|
103
137
|
} else {
|
|
104
138
|
if buttonType == .text {
|
|
105
|
-
|
|
139
|
+
RowTextButtons
|
|
106
140
|
} else {
|
|
107
|
-
|
|
141
|
+
RowButtons
|
|
108
142
|
}
|
|
109
143
|
}
|
|
110
144
|
|
|
@@ -131,6 +165,7 @@ public struct PopupDisplay: View {
|
|
|
131
165
|
var actionButtonTitle: String
|
|
132
166
|
var closeButtonTitle: String
|
|
133
167
|
var errorCode: String
|
|
168
|
+
var isShowCloseIcon: Bool
|
|
134
169
|
|
|
135
170
|
var RowTextButtons: some View {
|
|
136
171
|
HStack {
|
|
@@ -168,7 +203,9 @@ public struct PopupDisplay: View {
|
|
|
168
203
|
|
|
169
204
|
var RowButtons: some View {
|
|
170
205
|
HStack {
|
|
171
|
-
|
|
206
|
+
if(!closeButtonTitle.isEmpty) {
|
|
207
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium).accessibility(identifier: "btn_popup_cancel")
|
|
208
|
+
}
|
|
172
209
|
Button(title: actionButtonTitle, action: onPressAction, size: .medium)
|
|
173
210
|
.accessibility(identifier: "btn_popup_allow")
|
|
174
211
|
}
|
|
@@ -184,8 +221,9 @@ public struct PopupDisplay: View {
|
|
|
184
221
|
action: onPressAction,
|
|
185
222
|
size: .medium
|
|
186
223
|
).accessibility(identifier: "btn_popup_allow")
|
|
187
|
-
|
|
188
|
-
|
|
224
|
+
if(!closeButtonTitle.isEmpty) {
|
|
225
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary, size: .medium).accessibility(identifier: "btn_popup_cancel")
|
|
226
|
+
}
|
|
189
227
|
}
|
|
190
228
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
191
229
|
.padding(.horizontal, 24)
|
|
@@ -19,21 +19,26 @@ public struct PopupPromotion: View {
|
|
|
19
19
|
|
|
20
20
|
public var body: some View {
|
|
21
21
|
VStack(spacing: 8) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
if(imageUrl.isEmpty) {
|
|
23
|
+
Icon(source: "media_fail")
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
WebImage(url: URL(string: imageUrl)!)
|
|
27
|
+
.resizable()
|
|
28
|
+
.placeholder {
|
|
29
|
+
Color.gray
|
|
30
|
+
.aspectRatio(0.72, contentMode: .fit)
|
|
31
|
+
.frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
|
|
32
|
+
.clipped()
|
|
33
|
+
}
|
|
34
|
+
.scaledToFill()
|
|
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
|
+
}
|
|
37
42
|
buildCloseIcon()
|
|
38
43
|
}
|
|
39
44
|
.accessibility(identifier: "popup_promotion")
|