@momo-kits/native-kits 0.114.2-beta.20 → 0.114.2-beta.22
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.
|
@@ -45,13 +45,24 @@ func safeAreaTopInset() -> CGFloat {
|
|
|
45
45
|
public struct HeaderBackground: View {
|
|
46
46
|
var headerType: HeaderType = .default
|
|
47
47
|
var scrollState: CGFloat
|
|
48
|
+
var isTransparent: Bool = false
|
|
49
|
+
|
|
50
|
+
public init(
|
|
51
|
+
headerType: HeaderType = .default,
|
|
52
|
+
scrollState: CGFloat = 0,
|
|
53
|
+
isTransparent: Bool = false
|
|
54
|
+
) {
|
|
55
|
+
self.headerType = headerType
|
|
56
|
+
self.scrollState = scrollState
|
|
57
|
+
self.isTransparent = isTransparent
|
|
58
|
+
}
|
|
48
59
|
|
|
49
60
|
public var body: some View {
|
|
50
61
|
|
|
51
62
|
let statusBarHeight = safeAreaTopInset()
|
|
52
63
|
|
|
53
64
|
let opacity = 1 - CGFloat(scrollState) / 200
|
|
54
|
-
let backgroundColor =
|
|
65
|
+
let backgroundColor = isTransparent ? Color.clear : Colors.black01
|
|
55
66
|
|
|
56
67
|
Group {
|
|
57
68
|
if headerType == .default {
|
|
@@ -62,7 +73,9 @@ public struct HeaderBackground: View {
|
|
|
62
73
|
.fill(backgroundColor)
|
|
63
74
|
.frame(height: height)
|
|
64
75
|
.shadow(color: Colors.black20.opacity(0.2), radius: 10, x: 0, y: -2)
|
|
65
|
-
.overlay(
|
|
76
|
+
.overlay(
|
|
77
|
+
isTransparent ? nil :
|
|
78
|
+
Rectangle()
|
|
66
79
|
.fill(LinearGradient(
|
|
67
80
|
gradient: Gradient(colors: [
|
|
68
81
|
Color(red: 1, green: 0.8, blue: 0.87),
|
|
@@ -111,6 +124,7 @@ public struct Header: View {
|
|
|
111
124
|
var animatedHeader: AnimatedHeader? = nil
|
|
112
125
|
var scrollState: CGFloat = 0
|
|
113
126
|
var inputSearchProps: InputSearchProps? = nil
|
|
127
|
+
var tintColor: Color? = nil
|
|
114
128
|
|
|
115
129
|
@State private var colorFraction: CGFloat = 0
|
|
116
130
|
|
|
@@ -123,7 +137,8 @@ public struct Header: View {
|
|
|
123
137
|
opacity: CGFloat? = nil,
|
|
124
138
|
animatedHeader: AnimatedHeader? = nil,
|
|
125
139
|
scrollState: CGFloat = 0,
|
|
126
|
-
inputSearchProps: InputSearchProps? = nil
|
|
140
|
+
inputSearchProps: InputSearchProps? = nil,
|
|
141
|
+
tintColor: Color? = nil
|
|
127
142
|
) {
|
|
128
143
|
self.headerType = headerType
|
|
129
144
|
self.titlePosition = titlePosition
|
|
@@ -134,27 +149,27 @@ public struct Header: View {
|
|
|
134
149
|
self.animatedHeader = animatedHeader
|
|
135
150
|
self.scrollState = scrollState
|
|
136
151
|
self.inputSearchProps = inputSearchProps
|
|
152
|
+
self.tintColor = tintColor
|
|
137
153
|
}
|
|
138
154
|
|
|
139
155
|
public var body: some View {
|
|
140
156
|
|
|
141
|
-
let
|
|
142
|
-
let
|
|
143
|
-
let
|
|
157
|
+
// let tintIconColor = Colors.black17
|
|
158
|
+
let backgroundButton = tintColor == Colors.black01 ? Color.white.opacity(0.2) : Colors.black01.opacity(0.6)
|
|
159
|
+
let borderColor: Color = tintColor == Colors.black01 ? Color.black.opacity(0.6) : Color.black.opacity(0.2)
|
|
144
160
|
|
|
145
161
|
if headerType != .none {
|
|
146
|
-
|
|
162
|
+
VStack(spacing: 0) {
|
|
147
163
|
ZStack {
|
|
148
164
|
HStack {
|
|
149
165
|
if let goBack = goBack {
|
|
150
166
|
SwiftUI.Button(action: goBack) {
|
|
151
167
|
Circle()
|
|
152
|
-
.stroke(
|
|
168
|
+
.stroke(borderColor, lineWidth: 0.2)
|
|
153
169
|
.background(Circle().fill(backgroundButton))
|
|
154
170
|
.frame(width: 28, height: 28)
|
|
155
171
|
.overlay(
|
|
156
|
-
|
|
157
|
-
.foregroundColor(.black)
|
|
172
|
+
Icon(source: "arrow-back", size: 20, color: tintColor)
|
|
158
173
|
)
|
|
159
174
|
}
|
|
160
175
|
|
|
@@ -167,14 +182,11 @@ public struct Header: View {
|
|
|
167
182
|
}
|
|
168
183
|
|
|
169
184
|
}
|
|
170
|
-
.
|
|
171
|
-
.padding(.horizontal)
|
|
172
|
-
|
|
173
|
-
|
|
185
|
+
.padding(.horizontal, 12)
|
|
174
186
|
|
|
175
187
|
HStack {
|
|
176
188
|
if titlePosition == .left, goBack != nil {
|
|
177
|
-
Spacer().frame(width:
|
|
189
|
+
Spacer().frame(width: 38)
|
|
178
190
|
}
|
|
179
191
|
|
|
180
192
|
if inputSearchProps != nil {
|
|
@@ -201,20 +213,22 @@ public struct Header: View {
|
|
|
201
213
|
}
|
|
202
214
|
} else {
|
|
203
215
|
Text(title)
|
|
204
|
-
.font(.
|
|
205
|
-
.foregroundColor(
|
|
206
|
-
.frame(maxWidth: titlePosition == .center ? .
|
|
216
|
+
.font(Font.system(size: 17).weight(.bold)) .lineSpacing(22)
|
|
217
|
+
.foregroundColor(Colors.black17)
|
|
218
|
+
.frame(maxWidth: titlePosition == .center ? UIScreen.main.bounds.width - 252 : nil)
|
|
219
|
+
.frame(maxWidth: titlePosition == .center ? .infinity : UIScreen.main.bounds.width - 172, alignment: titlePosition == .center ? .center : .leading)
|
|
220
|
+
.lineLimit(1)
|
|
221
|
+
|
|
207
222
|
}
|
|
208
223
|
Spacer()
|
|
209
224
|
}
|
|
210
|
-
.frame(height: 52)
|
|
211
225
|
.padding(.horizontal)
|
|
212
226
|
}
|
|
213
227
|
.background(Color.clear)
|
|
214
228
|
}
|
|
215
|
-
|
|
229
|
+
.frame(height: 52)
|
|
216
230
|
}
|
|
217
|
-
|
|
231
|
+
}
|
|
218
232
|
}
|
|
219
233
|
|
|
220
234
|
|
|
@@ -9,6 +9,8 @@ import SwiftUI
|
|
|
9
9
|
|
|
10
10
|
public struct Screen<Content: View>: View {
|
|
11
11
|
var backgroundColor: Color?
|
|
12
|
+
var headerTransparent: Bool = false
|
|
13
|
+
var tintColor: Color? = Colors.black17
|
|
12
14
|
var isBack: Bool
|
|
13
15
|
var headerType: HeaderType
|
|
14
16
|
var verticalAlignment: VerticalAlignment
|
|
@@ -29,12 +31,14 @@ public struct Screen<Content: View>: View {
|
|
|
29
31
|
|
|
30
32
|
public init(
|
|
31
33
|
backgroundColor: Color? = nil,
|
|
34
|
+
headerTransparent: Bool = false,
|
|
35
|
+
tintColor: Color = Colors.black17,
|
|
32
36
|
isBack: Bool = true,
|
|
33
37
|
headerType: HeaderType = .default,
|
|
34
38
|
verticalAlignment: VerticalAlignment = .top,
|
|
35
39
|
horizontalAlignment: HorizontalAlignment = .leading,
|
|
36
40
|
title: String = "Stack",
|
|
37
|
-
titlePosition: TitlePosition = .
|
|
41
|
+
titlePosition: TitlePosition = .left,
|
|
38
42
|
goBack: (() -> Void)? = nil,
|
|
39
43
|
scrollable: Bool = true,
|
|
40
44
|
onContentLayout: ((CGRect) -> Void)? = nil,
|
|
@@ -48,6 +52,8 @@ public struct Screen<Content: View>: View {
|
|
|
48
52
|
@ViewBuilder content: @escaping () -> Content
|
|
49
53
|
) {
|
|
50
54
|
self.backgroundColor = backgroundColor
|
|
55
|
+
self.headerTransparent = headerTransparent
|
|
56
|
+
self.tintColor = tintColor
|
|
51
57
|
self.isBack = isBack
|
|
52
58
|
self.headerType = headerType
|
|
53
59
|
self.verticalAlignment = verticalAlignment
|
|
@@ -71,23 +77,25 @@ public struct Screen<Content: View>: View {
|
|
|
71
77
|
|
|
72
78
|
public var body: some View {
|
|
73
79
|
GeometryReader { geometry in
|
|
74
|
-
let
|
|
75
|
-
let statusBarHeight = safeAreaInsets.top
|
|
80
|
+
let topInset = geometry.safeAreaInsets.top
|
|
76
81
|
let keyboardHeight: CGFloat = 0
|
|
77
82
|
let keyboardSize: CGFloat = useAvoidKeyboard ? max(keyboardHeight, 0) : 0
|
|
83
|
+
let height = geometry.size.height
|
|
84
|
+
let bottomInset = geometry.safeAreaInsets.bottom
|
|
85
|
+
let screenHeight = height + topInset + bottomInset
|
|
78
86
|
|
|
79
87
|
ZStack {
|
|
80
88
|
(backgroundColor ?? Color.white).edgesIgnoringSafeArea(.all)
|
|
81
89
|
|
|
82
90
|
VStack(spacing: 0) {
|
|
83
|
-
ZStack {
|
|
84
|
-
if animatedHeader == nil {
|
|
85
|
-
HeaderBackground(headerType: headerType, scrollState: scrollOffset)
|
|
86
|
-
} else {
|
|
87
|
-
Color.white.opacity(Double(min(scrollOffset / 114, 1)))
|
|
88
|
-
.overlay(HeaderBackground(headerType: headerType, scrollState: scrollOffset))
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
+
ZStack(alignment: .top) {
|
|
92
|
+
// if animatedHeader == nil {
|
|
93
|
+
// HeaderBackground(headerType: headerType, scrollState: scrollOffset)
|
|
94
|
+
// } else {
|
|
95
|
+
// Color.white.opacity(Double(min(scrollOffset / 114, 1)))
|
|
96
|
+
// .overlay(HeaderBackground(headerType: headerType, scrollState: scrollOffset))
|
|
97
|
+
//
|
|
98
|
+
// }
|
|
91
99
|
|
|
92
100
|
Header(
|
|
93
101
|
headerType: headerType,
|
|
@@ -98,14 +106,19 @@ public struct Screen<Content: View>: View {
|
|
|
98
106
|
opacity: min(scrollOffset / 114, 1),
|
|
99
107
|
animatedHeader: animatedHeader,
|
|
100
108
|
scrollState: scrollOffset,
|
|
101
|
-
inputSearchProps: inputSearchProps
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
inputSearchProps: inputSearchProps,
|
|
110
|
+
tintColor: tintColor
|
|
111
|
+
)
|
|
112
|
+
.background(HeaderBackground(headerType: headerType, scrollState: scrollOffset, isTransparent: headerTransparent).edgesIgnoringSafeArea(.top))
|
|
113
|
+
.offset(y: topInset)
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
.offset(y: -topInset)
|
|
104
117
|
|
|
105
118
|
|
|
106
119
|
VStack(alignment: horizontalAlignment, spacing: 0) {
|
|
107
120
|
if animatedHeader != nil {
|
|
108
|
-
Spacer().frame(height:
|
|
121
|
+
Spacer().frame(height: topInset + 52 + layoutOffset)
|
|
109
122
|
}
|
|
110
123
|
|
|
111
124
|
if scrollable {
|
|
@@ -20,7 +20,7 @@ public enum PopupButtonType {
|
|
|
20
20
|
public struct PopupDisplay: View {
|
|
21
21
|
// MARK: Lifecycle
|
|
22
22
|
|
|
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 = {}) {
|
|
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
24
|
self._isPresented = isPresented
|
|
25
25
|
self.title = title
|
|
26
26
|
self.description = description
|
|
@@ -32,7 +32,12 @@ public struct PopupDisplay: View {
|
|
|
32
32
|
self.onClose = onClose
|
|
33
33
|
self.closeButtonTitle = closeButtonTitle
|
|
34
34
|
self.actionButtonTitle = actionButtonTitle
|
|
35
|
+
self.errorCode = errorCode
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
var placeholder: AnyView?
|
|
39
|
+
|
|
40
|
+
@State var error: Bool = false
|
|
36
41
|
|
|
37
42
|
// MARK: Public
|
|
38
43
|
|
|
@@ -62,7 +67,7 @@ public struct PopupDisplay: View {
|
|
|
62
67
|
}
|
|
63
68
|
.scaledToFill()
|
|
64
69
|
.frame(maxWidth: .infinity)
|
|
65
|
-
.clipShape(RoundedCorner(radius:
|
|
70
|
+
.clipShape(RoundedCorner(radius: 15, corners: [.topLeft, .topRight]))
|
|
66
71
|
.aspectRatio(2, contentMode: .fit)
|
|
67
72
|
}
|
|
68
73
|
VStack(alignment: .leading) {
|
|
@@ -79,10 +84,18 @@ public struct PopupDisplay: View {
|
|
|
79
84
|
.font(.paragraph)
|
|
80
85
|
.opacity(0.6)
|
|
81
86
|
.multilineTextAlignment(.leading)
|
|
82
|
-
.padding(.bottom,
|
|
87
|
+
.padding(.bottom, 8)
|
|
88
|
+
|
|
89
|
+
if(!errorCode.isEmpty) {
|
|
90
|
+
Text(errorCode)
|
|
91
|
+
.foregroundColor(Colors.black12)
|
|
92
|
+
.font(.description_xs_regular)
|
|
93
|
+
.lineLimit(1)
|
|
94
|
+
}
|
|
83
95
|
}
|
|
84
96
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
85
97
|
.padding(.horizontal, 24)
|
|
98
|
+
.padding(.bottom, 24)
|
|
86
99
|
|
|
87
100
|
if buttonDirection == .row {
|
|
88
101
|
if buttonType == .text {
|
|
@@ -120,6 +133,7 @@ public struct PopupDisplay: View {
|
|
|
120
133
|
var onClose: () -> Void
|
|
121
134
|
var actionButtonTitle: String
|
|
122
135
|
var closeButtonTitle: String
|
|
136
|
+
var errorCode: String
|
|
123
137
|
|
|
124
138
|
var RowTextButtons: some View {
|
|
125
139
|
HStack {
|
|
@@ -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 onRequestClose: (((() -> Void)?) -> Void)? = nil
|
|
14
8
|
|
|
15
|
-
|
|
9
|
+
|
|
10
|
+
public init(
|
|
11
|
+
imageUrl: String,
|
|
12
|
+
onIconClose: (() -> Void)? = nil,
|
|
13
|
+
onRequestClose: (((() -> Void)?) -> Void)? = nil
|
|
16
14
|
|
|
15
|
+
) {
|
|
16
|
+
self.imageUrl = imageUrl
|
|
17
|
+
self.onIconClose = onIconClose
|
|
18
|
+
self.onRequestClose = onRequestClose
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
public var body: some View {
|
|
18
|
-
VStack(spacing:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}.clipped()
|
|
22
|
+
VStack(spacing: 8) {
|
|
23
|
+
WebImage(url: URL(string: imageUrl)!)
|
|
24
|
+
.resizable()
|
|
25
|
+
.placeholder {
|
|
26
|
+
Color.gray
|
|
27
|
+
.aspectRatio(0.72, contentMode: .fit)
|
|
28
|
+
.frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
|
|
29
|
+
.clipped()
|
|
30
|
+
}
|
|
31
|
+
.aspectRatio(0.72, contentMode: .fit)
|
|
32
|
+
.frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
|
|
33
|
+
.clipped()
|
|
34
|
+
|
|
35
|
+
buildCloseIcon()
|
|
33
36
|
}
|
|
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)
|
|
37
|
+
.accessibility(identifier: "popup_promotion")
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
@ViewBuilder
|
|
41
|
+
private func buildCloseIcon() -> some View {
|
|
42
|
+
HStack {
|
|
43
|
+
Spacer()
|
|
44
|
+
SwiftUI.Button(action: {
|
|
45
|
+
onAction(callback: onIconClose)
|
|
46
|
+
}) {
|
|
47
|
+
ZStack {
|
|
48
|
+
Circle()
|
|
49
|
+
.strokeBorder(Colors.black01, lineWidth: 2)
|
|
50
|
+
.background(Circle().fill(Colors.black17))
|
|
51
|
+
.frame(width: 20, height: 20)
|
|
52
|
+
|
|
53
|
+
Icon(source: "navigation_close", size: 14, color: Colors.black01)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
.padding(8)
|
|
57
|
+
Spacer()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private func onAction(callback: (() -> Void)?) {
|
|
62
|
+
if let onRequestClose = onRequestClose {
|
|
63
|
+
onRequestClose(callback)
|
|
64
|
+
} else {
|
|
65
|
+
callback?()
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
39
69
|
|
|
40
|
-
// MARK: Internal
|
|
41
70
|
|
|
42
|
-
@Binding var isPresented: Bool
|
|
43
|
-
var onPressAction: () -> Void
|
|
44
|
-
var onClose: () -> Void
|
|
45
|
-
var buttonTitle: String
|
|
46
|
-
var url: String
|
|
47
71
|
|
|
48
|
-
func onPressClose(){
|
|
49
|
-
isPresented = false
|
|
50
|
-
onClose()
|
|
51
|
-
}
|
|
52
|
-
}
|
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
|