craft-native 0.0.147 → 0.0.148
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/dist/cli.js
CHANGED
|
@@ -3303,7 +3303,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
|
|
|
3303
3303
|
`);
|
|
3304
3304
|
}
|
|
3305
3305
|
// package.json
|
|
3306
|
-
var version = "0.0.
|
|
3306
|
+
var version = "0.0.148";
|
|
3307
3307
|
|
|
3308
3308
|
// bin/cli.ts
|
|
3309
3309
|
var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -8438,7 +8438,7 @@ final class CraftZigRuntime: NSObject {
|
|
|
8438
8438
|
enum CraftWebServices {
|
|
8439
8439
|
private static var waiting: [String: (Result<Any, CraftNativeActionError>) -> Void] = [:]
|
|
8440
8440
|
/// Coordinator events a native screen hears too.
|
|
8441
|
-
static let forwardedEvents: Set<String> = ["craftLocationUpdate", "craftLocationError"]
|
|
8441
|
+
static let forwardedEvents: Set<String> = ["craftLocationUpdate", "craftLocationError", "craftMusicChange"]
|
|
8442
8442
|
static let event = Notification.Name("craftWebServicesEvent")
|
|
8443
8443
|
|
|
8444
8444
|
static var isAvailable: Bool { CraftSwiftShim.coordinator != nil }
|
|
@@ -59,6 +59,8 @@ enum CraftNativeActions {
|
|
|
59
59
|
// GPS and the route recording are the web view's coordinator's
|
|
60
60
|
// (CraftWebServices), so a native-only app, which has none, has none.
|
|
61
61
|
if config.enableGeolocation && config.renderer != "native" { values.append("geolocation") }
|
|
62
|
+
// The Music app's song and transport are the coordinator's too.
|
|
63
|
+
if config.enableAppleMusic && config.renderer != "native" { values.append("music") }
|
|
62
64
|
return values
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -270,6 +272,24 @@ enum CraftNativeActions {
|
|
|
270
272
|
}
|
|
271
273
|
CraftWebServices.perform(action: action, body: args.first as? [String: Any] ?? [:]) { complete(requestToken, $0, completion) }
|
|
272
274
|
return
|
|
275
|
+
case ("Music", _):
|
|
276
|
+
// The page's own Music app bridge (CraftMusic.swift), in the web
|
|
277
|
+
// view's coordinator: one observer, whose changes reach the page
|
|
278
|
+
// and every native screen as `craftMusicChange`.
|
|
279
|
+
guard config.enableAppleMusic else {
|
|
280
|
+
complete(requestToken, failure("CAPABILITY_DISABLED", "Apple Music is disabled"), completion)
|
|
281
|
+
return
|
|
282
|
+
}
|
|
283
|
+
let actions = [
|
|
284
|
+
"getAuthorizationStatus": "musicGetAuthorization", "requestAuthorization": "musicRequestAuthorization",
|
|
285
|
+
"getNowPlaying": "musicGetNowPlaying", "control": "musicControl", "observe": "musicObserve",
|
|
286
|
+
]
|
|
287
|
+
guard let action = actions[method] else {
|
|
288
|
+
complete(requestToken, failure("UNKNOWN_ACTION", "Unsupported Music method"), completion)
|
|
289
|
+
return
|
|
290
|
+
}
|
|
291
|
+
CraftWebServices.perform(action: action, body: args.first as? [String: Any] ?? [:]) { complete(requestToken, $0, completion) }
|
|
292
|
+
return
|
|
273
293
|
case ("Linking", "openURL"), ("Linking", "canOpenURL"):
|
|
274
294
|
// Another app or the system: `webcal:` subscriptions, `mailto:`,
|
|
275
295
|
// `tel:`, the App Store, this app's page in Settings
|