@momo-kits/native-kits 0.163.2-beta.1-debug → 0.163.2-beta.2-debug
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
CHANGED
package/compose/compose.podspec
CHANGED
package/gradle.properties
CHANGED
|
@@ -184,6 +184,22 @@ struct ToolkitHeaderRight: View {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
// Load the current favorite state on appear so the star reflects reality; without this the button
|
|
188
|
+
// always renders "not favorited" until the user taps it. Mirrors the Compose LaunchedEffect.
|
|
189
|
+
private func loadFavoriteState() {
|
|
190
|
+
let context = environment.applicationContext
|
|
191
|
+
environment.composeApi?.request(
|
|
192
|
+
funcName: "isFavoriteApp",
|
|
193
|
+
params: ["code": context?.appCode]
|
|
194
|
+
) { response in
|
|
195
|
+
guard let data = response.data(using: .utf8),
|
|
196
|
+
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else {
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
isFavorite = (json["response"] as? Bool) ?? false
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
187
203
|
private func getNavigationButtonConfig() -> NavigationButtonConfig {
|
|
188
204
|
let totalTools = headerRight?.tools.reduce(0) { $0 + $1.items.count } ?? 0
|
|
189
205
|
var icon = isFavorite ? "pin_star_checked" : "pin_star"
|
|
@@ -247,6 +263,9 @@ struct ToolkitHeaderRight: View {
|
|
|
247
263
|
)
|
|
248
264
|
.padding(.leading, Spacing.S)
|
|
249
265
|
}
|
|
266
|
+
.onAppear {
|
|
267
|
+
loadFavoriteState()
|
|
268
|
+
}
|
|
250
269
|
}
|
|
251
270
|
}
|
|
252
271
|
|
package/ios/native-kits.podspec
CHANGED