@momo-kits/native-kits 0.114.2-beta.1 → 0.114.2-beta.3
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/build.gradle.kts +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +28 -30
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +29 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +4 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +4 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/dateTimePicker/DateTimePicker.kt +178 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/dateTimePicker/DateTimePickerExample.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/dateTimePicker/DateTimePickerTypes.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/dateTimePicker/DateTimePickerUtils.kt +226 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/dateTimePicker/WheelPicker.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +84 -124
- package/ios/Application/ApplicationEnvironment.swift +17 -9
- package/ios/Application/HeaderRight.swift +29 -30
- package/ios/Template/TrustBanner/TrustBanner.swift +75 -144
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -4,8 +4,8 @@ import androidx.compose.runtime.Composable
|
|
|
4
4
|
import androidx.compose.runtime.Immutable
|
|
5
5
|
import androidx.compose.ui.text.TextStyle
|
|
6
6
|
import androidx.compose.ui.text.font.FontFamily
|
|
7
|
-
import androidx.compose.ui.text.font.FontStyle
|
|
8
7
|
import androidx.compose.ui.text.font.FontWeight
|
|
8
|
+
import androidx.compose.ui.text.style.TextDecoration
|
|
9
9
|
import androidx.compose.ui.unit.sp
|
|
10
10
|
import org.jetbrains.compose.resources.Font
|
|
11
11
|
import org.jetbrains.compose.resources.FontResource
|
|
@@ -75,183 +75,143 @@ fun getFontFamily(fontFamily: String, fontWeight: FontWeight? = FontWeight.Norma
|
|
|
75
75
|
|
|
76
76
|
@Immutable
|
|
77
77
|
class AppTypography internal constructor(
|
|
78
|
-
val
|
|
79
|
-
val
|
|
80
|
-
val
|
|
81
|
-
val
|
|
82
|
-
val
|
|
83
|
-
val
|
|
84
|
-
val
|
|
85
|
-
val
|
|
86
|
-
val
|
|
87
|
-
val
|
|
88
|
-
val
|
|
89
|
-
val
|
|
90
|
-
val
|
|
91
|
-
val
|
|
92
|
-
val
|
|
93
|
-
val
|
|
94
|
-
val
|
|
95
|
-
val
|
|
96
|
-
val labelXs: TextStyle,
|
|
97
|
-
val labelS: TextStyle,
|
|
98
|
-
val actionDefault: TextStyle,
|
|
99
|
-
val actionXxs: TextStyle,
|
|
100
|
-
val actionXs: TextStyle,
|
|
101
|
-
val actionS: TextStyle,
|
|
78
|
+
val headlineDefaultBold: TextStyle,
|
|
79
|
+
val headerMBold: TextStyle,
|
|
80
|
+
val headerDefaultBold: TextStyle,
|
|
81
|
+
val headerSSemibold: TextStyle,
|
|
82
|
+
val headerXsSemibold: TextStyle,
|
|
83
|
+
val bodyDefaultRegular: TextStyle,
|
|
84
|
+
val bodyDefaultRegularStrikethrough: TextStyle,
|
|
85
|
+
val descriptionDefaultRegular: TextStyle,
|
|
86
|
+
val descriptionDefaultRegularStrikethrough: TextStyle,
|
|
87
|
+
val descriptionXsRegular: TextStyle,
|
|
88
|
+
val descriptionXsRegularStrikethrough: TextStyle,
|
|
89
|
+
val labelDefaultMedium: TextStyle,
|
|
90
|
+
val labelSMedium: TextStyle,
|
|
91
|
+
val labelXsMedium: TextStyle,
|
|
92
|
+
val actionDefaultBold: TextStyle,
|
|
93
|
+
val actionSBold: TextStyle,
|
|
94
|
+
val actionXsBold: TextStyle,
|
|
95
|
+
val actionXxsBold: TextStyle,
|
|
102
96
|
) {
|
|
103
97
|
constructor(
|
|
104
98
|
default: TextStyle = TextStyle(
|
|
105
|
-
fontSize =
|
|
106
|
-
lineHeight =
|
|
99
|
+
fontSize = 14.sp,
|
|
100
|
+
lineHeight = 20.sp,
|
|
107
101
|
fontWeight = FontWeight.Normal
|
|
108
102
|
),
|
|
109
|
-
|
|
110
|
-
fontSize = 28.sp,
|
|
111
|
-
lineHeight = 34.sp,
|
|
112
|
-
fontWeight = FontWeight.SemiBold
|
|
113
|
-
),
|
|
114
|
-
headlineS: TextStyle = TextStyle(
|
|
103
|
+
headlineDefaultBold: TextStyle = TextStyle(
|
|
115
104
|
fontSize = 24.sp,
|
|
116
|
-
lineHeight =
|
|
117
|
-
fontWeight = FontWeight.
|
|
118
|
-
),
|
|
119
|
-
headlineL: TextStyle = TextStyle(
|
|
120
|
-
fontSize = 32.sp,
|
|
121
|
-
lineHeight = 36.sp,
|
|
122
|
-
fontWeight = FontWeight.SemiBold
|
|
123
|
-
),
|
|
124
|
-
headlineXl: TextStyle = TextStyle(
|
|
125
|
-
fontSize = 36.sp,
|
|
126
|
-
lineHeight = 44.sp,
|
|
127
|
-
fontWeight = FontWeight.SemiBold
|
|
105
|
+
lineHeight = 34.sp,
|
|
106
|
+
fontWeight = FontWeight.Bold
|
|
128
107
|
),
|
|
129
|
-
|
|
130
|
-
fontSize =
|
|
131
|
-
lineHeight =
|
|
108
|
+
headerMBold: TextStyle = TextStyle(
|
|
109
|
+
fontSize = 18.sp,
|
|
110
|
+
lineHeight = 26.sp,
|
|
132
111
|
fontWeight = FontWeight.Bold
|
|
133
112
|
),
|
|
134
|
-
|
|
113
|
+
headerDefaultBold: TextStyle = TextStyle(
|
|
135
114
|
fontSize = 16.sp,
|
|
136
115
|
lineHeight = 22.sp,
|
|
137
116
|
fontWeight = FontWeight.Bold
|
|
138
117
|
),
|
|
139
|
-
|
|
140
|
-
fontSize =
|
|
141
|
-
lineHeight =
|
|
142
|
-
fontWeight = FontWeight.Bold
|
|
143
|
-
),
|
|
144
|
-
headerDefault: TextStyle = TextStyle(
|
|
145
|
-
fontSize = 15.sp,
|
|
146
|
-
lineHeight = 22.sp,
|
|
118
|
+
headerSSemibold: TextStyle = TextStyle(
|
|
119
|
+
fontSize = 14.sp,
|
|
120
|
+
lineHeight = 20.sp,
|
|
147
121
|
fontWeight = FontWeight.SemiBold
|
|
148
122
|
),
|
|
149
|
-
|
|
123
|
+
headerXsSemibold: TextStyle = TextStyle(
|
|
150
124
|
fontSize = 12.sp,
|
|
151
|
-
lineHeight =
|
|
125
|
+
lineHeight = 18.sp,
|
|
152
126
|
fontWeight = FontWeight.SemiBold
|
|
153
127
|
),
|
|
154
|
-
|
|
128
|
+
bodyDefaultRegular: TextStyle = TextStyle(
|
|
155
129
|
fontSize = 14.sp,
|
|
156
130
|
lineHeight = 20.sp,
|
|
157
|
-
fontWeight = FontWeight.SemiBold
|
|
158
|
-
),
|
|
159
|
-
paragraphDefault: TextStyle = TextStyle(
|
|
160
|
-
fontSize = 15.sp,
|
|
161
|
-
lineHeight = 22.sp,
|
|
162
131
|
fontWeight = FontWeight.Normal
|
|
163
132
|
),
|
|
164
|
-
|
|
165
|
-
fontSize = 15.sp,
|
|
166
|
-
lineHeight = 22.sp,
|
|
167
|
-
fontWeight = FontWeight.Bold
|
|
168
|
-
),
|
|
169
|
-
paragraphItalic: TextStyle = TextStyle(
|
|
170
|
-
fontSize = 15.sp,
|
|
171
|
-
lineHeight = 22.sp,
|
|
172
|
-
fontWeight = FontWeight.Normal,
|
|
173
|
-
fontStyle = FontStyle.Italic
|
|
174
|
-
),
|
|
175
|
-
descriptionDefault: TextStyle = TextStyle(
|
|
133
|
+
bodyDefaultRegularStrikethrough: TextStyle = TextStyle(
|
|
176
134
|
fontSize = 14.sp,
|
|
177
135
|
lineHeight = 20.sp,
|
|
136
|
+
fontWeight = FontWeight.Normal,
|
|
137
|
+
textDecoration = TextDecoration.LineThrough
|
|
138
|
+
),
|
|
139
|
+
descriptionDefaultRegular: TextStyle = TextStyle(
|
|
140
|
+
fontSize = 12.sp,
|
|
141
|
+
lineHeight = 18.sp,
|
|
178
142
|
fontWeight = FontWeight.Normal
|
|
179
143
|
),
|
|
180
|
-
|
|
144
|
+
descriptionDefaultRegularStrikethrough: TextStyle = TextStyle(
|
|
145
|
+
fontSize = 12.sp,
|
|
146
|
+
lineHeight = 18.sp,
|
|
147
|
+
fontWeight = FontWeight.Normal,
|
|
148
|
+
textDecoration = TextDecoration.LineThrough
|
|
149
|
+
),
|
|
150
|
+
descriptionXsRegular: TextStyle = TextStyle(
|
|
181
151
|
fontSize = 10.sp,
|
|
182
152
|
lineHeight = 14.sp,
|
|
183
153
|
fontWeight = FontWeight.Normal
|
|
184
154
|
),
|
|
185
|
-
|
|
186
|
-
fontSize =
|
|
187
|
-
lineHeight =
|
|
155
|
+
descriptionXsRegularStrikethrough: TextStyle = TextStyle(
|
|
156
|
+
fontSize = 10.sp,
|
|
157
|
+
lineHeight = 14.sp,
|
|
188
158
|
fontWeight = FontWeight.Normal,
|
|
159
|
+
textDecoration = TextDecoration.LineThrough
|
|
189
160
|
),
|
|
190
|
-
|
|
161
|
+
labelDefaultMedium: TextStyle = TextStyle(
|
|
191
162
|
fontSize = 14.sp,
|
|
192
163
|
lineHeight = 20.sp,
|
|
193
164
|
fontWeight = FontWeight.Medium
|
|
194
165
|
),
|
|
195
|
-
|
|
196
|
-
fontSize =
|
|
197
|
-
lineHeight =
|
|
166
|
+
labelSMedium: TextStyle = TextStyle(
|
|
167
|
+
fontSize = 12.sp,
|
|
168
|
+
lineHeight = 18.sp,
|
|
198
169
|
fontWeight = FontWeight.Medium
|
|
199
170
|
),
|
|
200
|
-
|
|
171
|
+
labelXsMedium: TextStyle = TextStyle(
|
|
201
172
|
fontSize = 10.sp,
|
|
202
173
|
lineHeight = 14.sp,
|
|
203
174
|
fontWeight = FontWeight.Medium
|
|
204
175
|
),
|
|
205
|
-
|
|
206
|
-
fontSize = 12.sp,
|
|
207
|
-
lineHeight = 16.sp,
|
|
208
|
-
fontWeight = FontWeight.Medium
|
|
209
|
-
),
|
|
210
|
-
actionDefault: TextStyle = TextStyle(
|
|
176
|
+
actionDefaultBold: TextStyle = TextStyle(
|
|
211
177
|
fontSize = 16.sp,
|
|
212
178
|
lineHeight = 22.sp,
|
|
213
179
|
fontWeight = FontWeight.Bold
|
|
214
180
|
),
|
|
215
|
-
|
|
216
|
-
fontSize =
|
|
217
|
-
lineHeight =
|
|
181
|
+
actionSBold: TextStyle = TextStyle(
|
|
182
|
+
fontSize = 14.sp,
|
|
183
|
+
lineHeight = 20.sp,
|
|
218
184
|
fontWeight = FontWeight.Bold
|
|
219
185
|
),
|
|
220
|
-
|
|
186
|
+
actionXsBold: TextStyle = TextStyle(
|
|
221
187
|
fontSize = 12.sp,
|
|
222
|
-
lineHeight =
|
|
188
|
+
lineHeight = 18.sp,
|
|
223
189
|
fontWeight = FontWeight.Bold
|
|
224
190
|
),
|
|
225
|
-
|
|
226
|
-
fontSize =
|
|
227
|
-
lineHeight =
|
|
191
|
+
actionXxsBold: TextStyle = TextStyle(
|
|
192
|
+
fontSize = 10.sp,
|
|
193
|
+
lineHeight = 14.sp,
|
|
228
194
|
fontWeight = FontWeight.Bold
|
|
229
195
|
),
|
|
230
196
|
) : this(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
labelXs = labelXs,
|
|
250
|
-
labelS = labelS,
|
|
251
|
-
actionDefault = actionDefault,
|
|
252
|
-
actionXxs = actionXxs,
|
|
253
|
-
actionXs = actionXs,
|
|
254
|
-
actionS = actionS
|
|
197
|
+
headlineDefaultBold = headlineDefaultBold,
|
|
198
|
+
headerMBold = headerMBold,
|
|
199
|
+
headerDefaultBold = headerDefaultBold,
|
|
200
|
+
headerSSemibold = headerSSemibold,
|
|
201
|
+
headerXsSemibold = headerXsSemibold,
|
|
202
|
+
bodyDefaultRegular = bodyDefaultRegular,
|
|
203
|
+
bodyDefaultRegularStrikethrough = bodyDefaultRegularStrikethrough,
|
|
204
|
+
descriptionDefaultRegular = descriptionDefaultRegular,
|
|
205
|
+
descriptionDefaultRegularStrikethrough = descriptionDefaultRegularStrikethrough,
|
|
206
|
+
descriptionXsRegular = descriptionXsRegular,
|
|
207
|
+
descriptionXsRegularStrikethrough = descriptionXsRegularStrikethrough,
|
|
208
|
+
labelDefaultMedium = labelDefaultMedium,
|
|
209
|
+
labelSMedium = labelSMedium,
|
|
210
|
+
labelXsMedium = labelXsMedium,
|
|
211
|
+
actionDefaultBold = actionDefaultBold,
|
|
212
|
+
actionSBold = actionSBold,
|
|
213
|
+
actionXsBold = actionXsBold,
|
|
214
|
+
actionXxsBold = actionXxsBold
|
|
255
215
|
)
|
|
256
216
|
}
|
|
257
217
|
|
|
@@ -13,12 +13,12 @@ public class MiniAppContext {
|
|
|
13
13
|
public var appName: Any? = nil
|
|
14
14
|
public var appIcon: String = ""
|
|
15
15
|
public var description: Any? = nil
|
|
16
|
-
public var support: Any
|
|
17
|
-
public var toolkitConfig: Any
|
|
18
|
-
public var providerId: String = ""
|
|
19
|
-
public var permissions: Any
|
|
20
|
-
|
|
21
|
-
public init(appId: String, appCode: String, appName: Any? = nil, appIcon: String, description: Any? = nil, support: Any
|
|
16
|
+
public var support: [String: Any] = [:]
|
|
17
|
+
public var toolkitConfig: [String: Any] = [:]
|
|
18
|
+
public var providerId: String = "momo"
|
|
19
|
+
public var permissions: [[String: Any]] = []
|
|
20
|
+
|
|
21
|
+
public init(appId: String, appCode: String, appName: Any? = nil, appIcon: String, description: Any? = nil, support: [String: Any] = [:], toolkitConfig: [String: Any] = [:], providerId: String = "momo", permissions: [[String: Any]] = []) {
|
|
22
22
|
self.appId = appId
|
|
23
23
|
self.appCode = appCode
|
|
24
24
|
self.appName = appName
|
|
@@ -31,12 +31,20 @@ public class MiniAppContext {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
public class KitConfig {
|
|
35
|
+
public var trustBanner: TrustBannerData? = nil
|
|
36
|
+
public var headerBar: String? = nil
|
|
37
|
+
public var headerGradient: String? = nil
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
public class ApplicationEnvironment: ObservableObject {
|
|
35
41
|
let applicationContext: MiniAppContext?
|
|
36
|
-
let composeApi: KitComposeApi
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
let composeApi: KitComposeApi?
|
|
43
|
+
let config: KitConfig?
|
|
44
|
+
|
|
45
|
+
public init(applicationContext: MiniAppContext? = nil, composeApi: KitComposeApi? = nil, config: KitConfig? = nil) {
|
|
39
46
|
self.applicationContext = applicationContext
|
|
40
47
|
self.composeApi = composeApi
|
|
48
|
+
self.config = config
|
|
41
49
|
}
|
|
42
50
|
}
|
|
@@ -6,7 +6,7 @@ public struct HeaderRightData {
|
|
|
6
6
|
var useMore: Bool
|
|
7
7
|
var tools: [ToolGroup]
|
|
8
8
|
var toolCallback: ((String) -> Void)?
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
public init(
|
|
11
11
|
useShortcut: Bool = false,
|
|
12
12
|
useMore: Bool = false,
|
|
@@ -25,7 +25,7 @@ public struct Tool {
|
|
|
25
25
|
var icon: String
|
|
26
26
|
var showBadge: Bool
|
|
27
27
|
var name: [String: String]
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
public init(
|
|
30
30
|
key: String,
|
|
31
31
|
icon: String,
|
|
@@ -37,7 +37,7 @@ public struct Tool {
|
|
|
37
37
|
self.showBadge = showBadge
|
|
38
38
|
self.name = name
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
func toMap() -> [String: Any] {
|
|
42
42
|
return [
|
|
43
43
|
"key": key,
|
|
@@ -51,7 +51,7 @@ public struct Tool {
|
|
|
51
51
|
public struct ToolGroup {
|
|
52
52
|
var title: [String: String]
|
|
53
53
|
var items: [Tool]
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
public init(
|
|
56
56
|
title: [String: String] = [:],
|
|
57
57
|
items: [Tool]
|
|
@@ -59,7 +59,7 @@ public struct ToolGroup {
|
|
|
59
59
|
self.title = title
|
|
60
60
|
self.items = items
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
func toMap() -> [String: Any] {
|
|
64
64
|
return [
|
|
65
65
|
"title": title,
|
|
@@ -79,7 +79,7 @@ public struct HeaderRight: View {
|
|
|
79
79
|
self.headerRight = headerRight
|
|
80
80
|
}
|
|
81
81
|
var headerRight: HeaderRightData?
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
public var body: some View {
|
|
84
84
|
HStack(alignment: .center) {
|
|
85
85
|
ToolkitHeaderRight(headerRight: headerRight)
|
|
@@ -92,17 +92,17 @@ struct ToolkitHeaderRight: View {
|
|
|
92
92
|
@State private var isFavorite: Bool = false
|
|
93
93
|
@State private var isLoading: Bool = false
|
|
94
94
|
@EnvironmentObject private var environment: ApplicationEnvironment
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
// MARK: - Actions
|
|
97
97
|
private func onPressShortcut() {
|
|
98
|
-
environment.composeApi
|
|
98
|
+
environment.composeApi?.request(
|
|
99
99
|
funcName: "onToolAction",
|
|
100
100
|
params: ["item": ["key": "onFavorite"]]
|
|
101
101
|
) { _ in
|
|
102
102
|
isFavorite.toggle()
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
private func onPressHelpCenter() {
|
|
107
107
|
let context = environment.applicationContext
|
|
108
108
|
let paramMap: [String: Any] = [
|
|
@@ -112,20 +112,19 @@ struct ToolkitHeaderRight: View {
|
|
|
112
112
|
"icon": context?.appIcon,
|
|
113
113
|
"description": context?.description
|
|
114
114
|
]
|
|
115
|
-
environment.composeApi
|
|
115
|
+
environment.composeApi?.request(
|
|
116
116
|
funcName: "showHelpCenter",
|
|
117
117
|
params: paramMap
|
|
118
118
|
) { _ in }
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
private func onPressClose() {
|
|
122
|
-
environment.composeApi
|
|
122
|
+
environment.composeApi?.request(
|
|
123
123
|
funcName: "dismiss",
|
|
124
124
|
params: ""
|
|
125
125
|
) { _ in }
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
|
|
129
128
|
private func onPressMore() {
|
|
130
129
|
let context = environment.applicationContext
|
|
131
130
|
let params: [String: Any] = [
|
|
@@ -136,13 +135,13 @@ struct ToolkitHeaderRight: View {
|
|
|
136
135
|
"name": context?.appName,
|
|
137
136
|
"icon": context?.appIcon,
|
|
138
137
|
"description": context?.description,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
"support": context?.support,
|
|
139
|
+
"toolkitConfig": context?.toolkitConfig,
|
|
140
|
+
"providerId": context?.providerId,
|
|
141
|
+
"permissions": context?.permissions
|
|
143
142
|
]
|
|
144
143
|
]
|
|
145
|
-
environment.composeApi
|
|
144
|
+
environment.composeApi?.request(
|
|
146
145
|
funcName: "showTools",
|
|
147
146
|
params: params
|
|
148
147
|
) { response in
|
|
@@ -157,12 +156,12 @@ struct ToolkitHeaderRight: View {
|
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
|
-
|
|
159
|
+
|
|
161
160
|
private func getNavigationButtonConfig() -> NavigationButtonConfig {
|
|
162
161
|
let totalTools = headerRight?.tools.reduce(0) { $0 + $1.items.count } ?? 0
|
|
163
162
|
var icon = isFavorite ? "pin_star_checked" : "pin_star"
|
|
164
163
|
var onClickHandler: () -> Void = onPressShortcut
|
|
165
|
-
|
|
164
|
+
|
|
166
165
|
if totalTools > 1 || headerRight?.useMore == true {
|
|
167
166
|
icon = "navigation_more_icon"
|
|
168
167
|
onClickHandler = onPressMore
|
|
@@ -172,16 +171,16 @@ struct ToolkitHeaderRight: View {
|
|
|
172
171
|
headerRight?.toolCallback?(singleTool.key)
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
|
-
|
|
174
|
+
|
|
176
175
|
return NavigationButtonConfig(icon: icon, onPress: onClickHandler)
|
|
177
176
|
}
|
|
178
|
-
|
|
177
|
+
|
|
179
178
|
var body: some View {
|
|
180
179
|
let navButtonConfig = getNavigationButtonConfig()
|
|
181
180
|
let showBadge = headerRight?.tools.contains { group in
|
|
182
181
|
group.items.contains { $0.showBadge }
|
|
183
182
|
} ?? false
|
|
184
|
-
|
|
183
|
+
|
|
185
184
|
HStack(alignment: .center) {
|
|
186
185
|
if headerRight?.useShortcut == true {
|
|
187
186
|
NavigationButton(
|
|
@@ -191,18 +190,18 @@ struct ToolkitHeaderRight: View {
|
|
|
191
190
|
onClick: navButtonConfig.onPress
|
|
192
191
|
)
|
|
193
192
|
}
|
|
194
|
-
|
|
193
|
+
|
|
195
194
|
HStack(alignment: .center, spacing: 0) {
|
|
196
195
|
Icon(source: "help_center", size: 20)
|
|
197
196
|
.padding(4)
|
|
198
197
|
.onTapGesture {
|
|
199
198
|
onPressHelpCenter()
|
|
200
199
|
}
|
|
201
|
-
|
|
200
|
+
|
|
202
201
|
Rectangle()
|
|
203
202
|
.fill(Colors.black20)
|
|
204
203
|
.frame(width: 0.5, height: 12)
|
|
205
|
-
|
|
204
|
+
|
|
206
205
|
Icon(source: "16_navigation_close_circle", size: 20, color: Colors.black17)
|
|
207
206
|
.padding(4)
|
|
208
207
|
.onTapGesture {
|
|
@@ -226,7 +225,7 @@ struct NavigationButton: View {
|
|
|
226
225
|
var icon: String
|
|
227
226
|
var showBadge: Bool
|
|
228
227
|
var onClick: () -> Void
|
|
229
|
-
|
|
228
|
+
|
|
230
229
|
var body: some View {
|
|
231
230
|
ZStack {
|
|
232
231
|
Circle()
|
|
@@ -235,9 +234,9 @@ struct NavigationButton: View {
|
|
|
235
234
|
Circle()
|
|
236
235
|
.stroke(Color.black.opacity(0.2), lineWidth: 0.2)
|
|
237
236
|
)
|
|
238
|
-
|
|
237
|
+
|
|
239
238
|
Icon(source: icon, size: 16)
|
|
240
|
-
|
|
239
|
+
|
|
241
240
|
if showBadge {
|
|
242
241
|
BadgeDot(size: .small)
|
|
243
242
|
.offset(x: -2, y: -2)
|