@momo-kits/native-kits 0.112.1-beta.14 → 0.112.1-beta.15
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/HeaderRight.kt +14 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +1 -1
- package/ios/Application/HeaderRight.swift +14 -4
- package/ios/Badge/BadgeDot.swift +1 -12
- package/package.json +1 -1
- package/ios/Application/Badge.swift +0 -1
|
@@ -27,6 +27,9 @@ import vn.momo.kits.components.BadgeDot
|
|
|
27
27
|
import vn.momo.kits.components.DotSize
|
|
28
28
|
import vn.momo.kits.components.Icon
|
|
29
29
|
import vn.momo.kits.const.Colors
|
|
30
|
+
import kotlinx.serialization.json.Json
|
|
31
|
+
import kotlinx.serialization.json.jsonObject
|
|
32
|
+
import kotlinx.serialization.json.jsonPrimitive
|
|
30
33
|
|
|
31
34
|
data class HeaderRightData(
|
|
32
35
|
val useShortcut: Boolean = false,
|
|
@@ -127,8 +130,16 @@ fun ToolkitHeaderRight(headerRight: HeaderRightData? = null) {
|
|
|
127
130
|
"description" to context?.description
|
|
128
131
|
)
|
|
129
132
|
)
|
|
130
|
-
) {
|
|
131
|
-
|
|
133
|
+
) { response ->
|
|
134
|
+
try {
|
|
135
|
+
val json = Json.parseToJsonElement(response).jsonObject
|
|
136
|
+
val toolResponse = json["response"]?.jsonPrimitive?.content
|
|
137
|
+
if (toolResponse != null) {
|
|
138
|
+
headerRight?.toolCallback?.invoke(toolResponse)
|
|
139
|
+
}
|
|
140
|
+
} catch (e: Exception) {
|
|
141
|
+
println("Error parsing response: $e")
|
|
142
|
+
}
|
|
132
143
|
}
|
|
133
144
|
}
|
|
134
145
|
|
|
@@ -238,7 +249,7 @@ fun NavigationButton(
|
|
|
238
249
|
)
|
|
239
250
|
}
|
|
240
251
|
|
|
241
|
-
if (showBadge
|
|
252
|
+
if (showBadge == true) {
|
|
242
253
|
BadgeDot(
|
|
243
254
|
size = DotSize.Small,
|
|
244
255
|
modifier = Modifier
|
|
@@ -68,7 +68,7 @@ val ApplicationContext = staticCompositionLocalOf<MiniAppContext?> {
|
|
|
68
68
|
fun ApplicationContainer(
|
|
69
69
|
theme: Theme = defaultTheme,
|
|
70
70
|
composeApi: ComposeApi? = null,
|
|
71
|
-
statusBarHeight: Dp
|
|
71
|
+
statusBarHeight: Dp? = null,
|
|
72
72
|
applicationContext: MiniAppContext? = null,
|
|
73
73
|
content: @Composable () -> Unit,
|
|
74
74
|
) {
|
|
@@ -29,8 +29,8 @@ public struct Tool {
|
|
|
29
29
|
public init(
|
|
30
30
|
key: String,
|
|
31
31
|
icon: String,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
name: [String: String] = [:],
|
|
33
|
+
showBadge: Bool = false
|
|
34
34
|
) {
|
|
35
35
|
self.key = key
|
|
36
36
|
self.icon = icon
|
|
@@ -140,7 +140,17 @@ struct ToolkitHeaderRight: View {
|
|
|
140
140
|
environment.composeApi.request(
|
|
141
141
|
funcName: "showTools",
|
|
142
142
|
params: params
|
|
143
|
-
) {
|
|
143
|
+
) { response in
|
|
144
|
+
do {
|
|
145
|
+
if let jsonData = response.data(using: .utf8),
|
|
146
|
+
let json = try JSONSerialization.jsonObject(with: jsonData) as? [String: Any],
|
|
147
|
+
let toolResponse = json["response"] as? String {
|
|
148
|
+
headerRight?.toolCallback?(toolResponse)
|
|
149
|
+
}
|
|
150
|
+
} catch {
|
|
151
|
+
print("Error parsing response:", error)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
144
154
|
}
|
|
145
155
|
|
|
146
156
|
private func getNavigationButtonConfig() -> NavigationButtonConfig {
|
|
@@ -188,7 +198,7 @@ struct ToolkitHeaderRight: View {
|
|
|
188
198
|
.fill(Colors.black20)
|
|
189
199
|
.frame(width: 0.5, height: 12)
|
|
190
200
|
|
|
191
|
-
Icon(source: "16_navigation_close_circle", size: 20)
|
|
201
|
+
Icon(source: "16_navigation_close_circle", size: 20, color: Colors.black17)
|
|
192
202
|
.padding(4)
|
|
193
203
|
.onTapGesture {
|
|
194
204
|
onPressClose()
|
package/ios/Badge/BadgeDot.swift
CHANGED
|
@@ -28,15 +28,4 @@ public struct BadgeDot: View {
|
|
|
28
28
|
.stroke(Colors.black01, lineWidth: 1)
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#if DEBUG
|
|
34
|
-
struct BadgeDot_Previews: PreviewProvider {
|
|
35
|
-
static var previews: some View {
|
|
36
|
-
VStack(spacing: 10) {
|
|
37
|
-
BadgeDot(size: .small)
|
|
38
|
-
BadgeDot(size: .large)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
#endif
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|