@momo-kits/native-kits 0.114.2-beta.21 → 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 = scrollState == 0 ? Color.clear : Colors.black01
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(Rectangle()
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,12 +149,14 @@ 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 tintIconColor = Colors.black17
142
- let backgroundButton = Colors.black01.opacity(0.6)
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)
143
160
 
144
161
  if headerType != .none {
145
162
  VStack(spacing: 0) {
@@ -148,11 +165,11 @@ public struct Header: View {
148
165
  if let goBack = goBack {
149
166
  SwiftUI.Button(action: goBack) {
150
167
  Circle()
151
- .stroke(Color.black.opacity(0.2), lineWidth: 0.2)
168
+ .stroke(borderColor, lineWidth: 0.2)
152
169
  .background(Circle().fill(backgroundButton))
153
170
  .frame(width: 28, height: 28)
154
171
  .overlay(
155
- Icon(source: "arrow-back", size: 20, color: Colors.black17)
172
+ Icon(source: "arrow-back", size: 20, color: tintColor)
156
173
  )
157
174
  }
158
175
 
@@ -197,7 +214,7 @@ public struct Header: View {
197
214
  } else {
198
215
  Text(title)
199
216
  .font(Font.system(size: 17).weight(.bold)) .lineSpacing(22)
200
- .foregroundColor(tintIconColor)
217
+ .foregroundColor(Colors.black17)
201
218
  .frame(maxWidth: titlePosition == .center ? UIScreen.main.bounds.width - 252 : nil)
202
219
  .frame(maxWidth: titlePosition == .center ? .infinity : UIScreen.main.bounds.width - 172, alignment: titlePosition == .center ? .center : .leading)
203
220
  .lineLimit(1)
@@ -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,6 +31,8 @@ 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,
@@ -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
@@ -100,9 +106,10 @@ public struct Screen<Content: View>: View {
100
106
  opacity: min(scrollOffset / 114, 1),
101
107
  animatedHeader: animatedHeader,
102
108
  scrollState: scrollOffset,
103
- inputSearchProps: inputSearchProps
109
+ inputSearchProps: inputSearchProps,
110
+ tintColor: tintColor
104
111
  )
105
- .background(HeaderBackground(headerType: headerType, scrollState: scrollOffset).edgesIgnoringSafeArea(.top))
112
+ .background(HeaderBackground(headerType: headerType, scrollState: scrollOffset, isTransparent: headerTransparent).edgesIgnoringSafeArea(.top))
106
113
  .offset(y: topInset)
107
114
 
108
115
  }
@@ -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
 
@@ -79,10 +84,18 @@ public struct PopupDisplay: View {
79
84
  .font(.paragraph)
80
85
  .opacity(0.6)
81
86
  .multilineTextAlignment(.leading)
82
- .padding(.bottom, 20)
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
- // MARK: Lifecycle
6
-
7
- public init(isPresented: Binding<Bool>, url: String = "", buttonTitle: String = "", onPressAction: @escaping () -> Void = {}, onClose: @escaping () -> Void = {}) {
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
- // MARK: Public
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: 12) {
19
- ZStack(alignment: .bottom) {
20
- WebImage(url: URL(string: url), isAnimating: .constant(true))
21
- .resizable()
22
- .placeholder {
23
- Circle().foregroundColor(.gray)
24
- }
25
- .scaledToFill()
26
- .frame(maxWidth: .infinity, maxHeight: .infinity)
27
- .cornerRadius(8)
28
-
29
- Button(title: buttonTitle, action: onPressAction)
30
- .padding(.horizontal, 24)
31
- .padding(.bottom, 24)
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
- .frame(maxWidth: .infinity, maxHeight: 400)
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
- #Wed Aug 21 14:20:12 ICT 2024
8
- sdk.dir=/Users/huynhdung/Library/Android/sdk
7
+ #Thu Jan 09 10:43:10 ICT 2025
8
+ sdk.dir=/Users/sophia/Library/Android/sdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.114.2-beta.21",
3
+ "version": "0.114.2-beta.22",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},