@momo-kits/native-kits 0.117.1-beta.1 → 0.117.1-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/ios/Popup/PopupDisplay.swift +17 -26
- package/ios/Popup/PopupPromotion.swift +13 -18
- package/package.json +1 -1
|
@@ -34,17 +34,13 @@ public struct PopupDisplay: View {
|
|
|
34
34
|
self.actionButtonTitle = actionButtonTitle
|
|
35
35
|
self.errorCode = errorCode
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
var placeholder: AnyView?
|
|
39
|
-
|
|
40
|
-
@State var error: Bool = false
|
|
41
37
|
|
|
42
38
|
// MARK: Public
|
|
43
39
|
|
|
44
40
|
public var body: some View {
|
|
45
41
|
VStack(spacing: 12) {
|
|
46
42
|
ZStack(alignment: .topTrailing) {
|
|
47
|
-
SwiftUI.Button(action:
|
|
43
|
+
SwiftUI.Button(action: onClose) {
|
|
48
44
|
Image(systemName: "xmark.circle.fill")
|
|
49
45
|
.resizable()
|
|
50
46
|
.frame(width: 22, height: 22)
|
|
@@ -56,20 +52,20 @@ public struct PopupDisplay: View {
|
|
|
56
52
|
.zIndex(1)
|
|
57
53
|
.accessibility(identifier: "ic_popup_close")
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
VStack {
|
|
56
|
+
if(!url.isEmpty) {
|
|
57
|
+
WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
58
|
+
.resizable()
|
|
59
|
+
.placeholder {
|
|
60
|
+
Rectangle()
|
|
61
|
+
.fill(Color.gray.opacity(0.3))
|
|
62
|
+
.frame(maxWidth: .infinity, maxHeight: 184)
|
|
63
|
+
}
|
|
64
|
+
.scaledToFill()
|
|
65
|
+
.frame(maxWidth: .infinity)
|
|
66
|
+
.clipShape(RoundedCorner(radius: 15, corners: [.topLeft, .topRight]))
|
|
67
|
+
.aspectRatio(2, contentMode: .fit)
|
|
68
|
+
}
|
|
73
69
|
VStack(alignment: .leading) {
|
|
74
70
|
Text(title)
|
|
75
71
|
.foregroundColor(.black)
|
|
@@ -85,7 +81,7 @@ public struct PopupDisplay: View {
|
|
|
85
81
|
.opacity(0.6)
|
|
86
82
|
.multilineTextAlignment(.leading)
|
|
87
83
|
.padding(.bottom, 8)
|
|
88
|
-
|
|
84
|
+
|
|
89
85
|
if(!errorCode.isEmpty) {
|
|
90
86
|
Text(errorCode)
|
|
91
87
|
.foregroundColor(Colors.black12)
|
|
@@ -134,7 +130,7 @@ public struct PopupDisplay: View {
|
|
|
134
130
|
var actionButtonTitle: String
|
|
135
131
|
var closeButtonTitle: String
|
|
136
132
|
var errorCode: String
|
|
137
|
-
|
|
133
|
+
|
|
138
134
|
var RowTextButtons: some View {
|
|
139
135
|
HStack {
|
|
140
136
|
SwiftUI.Button(action: onPressCloseButton) {
|
|
@@ -195,9 +191,4 @@ public struct PopupDisplay: View {
|
|
|
195
191
|
.padding(.bottom, 24)
|
|
196
192
|
}
|
|
197
193
|
|
|
198
|
-
|
|
199
|
-
func onPressClose(){
|
|
200
|
-
isPresented = false
|
|
201
|
-
onClose()
|
|
202
|
-
}
|
|
203
194
|
}
|
|
@@ -4,20 +4,19 @@ import SDWebImageSwiftUI
|
|
|
4
4
|
public struct PopupPromotion: View {
|
|
5
5
|
var imageUrl: String
|
|
6
6
|
var onIconClose: (() -> Void)?
|
|
7
|
-
var
|
|
7
|
+
var onAction: (() -> Void)?
|
|
8
|
+
|
|
8
9
|
|
|
9
|
-
|
|
10
10
|
public init(
|
|
11
11
|
imageUrl: String,
|
|
12
12
|
onIconClose: (() -> Void)? = nil,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
onAction: (() -> Void)? = nil
|
|
15
14
|
) {
|
|
16
15
|
self.imageUrl = imageUrl
|
|
17
16
|
self.onIconClose = onIconClose
|
|
18
|
-
self.
|
|
17
|
+
self.onAction = onAction
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
|
|
21
20
|
public var body: some View {
|
|
22
21
|
VStack(spacing: 8) {
|
|
23
22
|
WebImage(url: URL(string: imageUrl)!)
|
|
@@ -31,25 +30,28 @@ public struct PopupPromotion: View {
|
|
|
31
30
|
.aspectRatio(0.72, contentMode: .fit)
|
|
32
31
|
.frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
|
|
33
32
|
.clipped()
|
|
34
|
-
|
|
33
|
+
.onTapGesture {
|
|
34
|
+
onAction?()
|
|
35
|
+
}
|
|
36
|
+
|
|
35
37
|
buildCloseIcon()
|
|
36
38
|
}
|
|
37
39
|
.accessibility(identifier: "popup_promotion")
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
|
|
40
42
|
@ViewBuilder
|
|
41
43
|
private func buildCloseIcon() -> some View {
|
|
42
44
|
HStack {
|
|
43
45
|
Spacer()
|
|
44
46
|
SwiftUI.Button(action: {
|
|
45
|
-
|
|
47
|
+
onIconClose?()
|
|
46
48
|
}) {
|
|
47
49
|
ZStack {
|
|
48
50
|
Circle()
|
|
49
51
|
.strokeBorder(Colors.black01, lineWidth: 2)
|
|
50
52
|
.background(Circle().fill(Colors.black17))
|
|
51
53
|
.frame(width: 20, height: 20)
|
|
52
|
-
|
|
54
|
+
|
|
53
55
|
Icon(source: "navigation_close", size: 14, color: Colors.black01)
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -57,14 +59,7 @@ public struct PopupPromotion: View {
|
|
|
57
59
|
Spacer()
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
private func onAction(callback: (() -> Void)?) {
|
|
62
|
-
if let onRequestClose = onRequestClose {
|
|
63
|
-
onRequestClose(callback)
|
|
64
|
-
} else {
|
|
65
|
-
callback?()
|
|
66
|
-
}
|
|
67
|
-
}
|
|
62
|
+
|
|
68
63
|
}
|
|
69
64
|
|
|
70
65
|
|