@craft-native/ios 0.0.161 → 0.0.162
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/README.md +6 -0
- package/dist/cli.js +2 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
- package/templates/CraftNativeScreen.swift +4 -0
package/README.md
CHANGED
|
@@ -185,6 +185,7 @@ Edit `craft.config.json` in your iOS project:
|
|
|
185
185
|
"enableHealthKit": false,
|
|
186
186
|
"enableAppleMusic": false,
|
|
187
187
|
"enableHeartRate": false,
|
|
188
|
+
"enableBackgroundAudio": false,
|
|
188
189
|
"enableScreenCapture": true,
|
|
189
190
|
"iosVersion": "15.0",
|
|
190
191
|
"teamId": ""
|
|
@@ -195,6 +196,11 @@ The app name is shown as written (`"HQ.training"` is fine); the Xcode
|
|
|
195
196
|
project, target and Swift types use a PascalCase identifier made from it
|
|
196
197
|
(`HQTraining`). A key left out of the file keeps its default.
|
|
197
198
|
|
|
199
|
+
`enableBackgroundAudio` adds the `audio` background mode, so a soundscape or a
|
|
200
|
+
meditation's ambience (Web Audio, on the playback session) keeps playing with
|
|
201
|
+
the screen locked; a sleep timer then fades it out on the audio clock. Turn it
|
|
202
|
+
on only for an app that plays sound people listen to: App Review checks.
|
|
203
|
+
|
|
198
204
|
Purpose strings in your own words, by Info.plist key (each replaces Craft's
|
|
199
205
|
generic sentence; the keys for frameworks the shell links are always written,
|
|
200
206
|
since App Store Connect checks the binary):
|
package/dist/cli.js
CHANGED
|
@@ -361,6 +361,8 @@ function renderBackgroundModes(config) {
|
|
|
361
361
|
modes.add("remote-notification");
|
|
362
362
|
if (config.enableHeartRate)
|
|
363
363
|
modes.add("bluetooth-central");
|
|
364
|
+
if (config.enableBackgroundAudio)
|
|
365
|
+
modes.add("audio");
|
|
364
366
|
if (!modes.size)
|
|
365
367
|
return "";
|
|
366
368
|
return ` <key>UIBackgroundModes</key>
|
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,15 @@ export interface CraftConfig {
|
|
|
79
79
|
* time the page scans or connects.
|
|
80
80
|
*/
|
|
81
81
|
enableHeartRate?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Keep playing sound with the screen locked or the app in the background:
|
|
84
|
+
* a sleep soundscape, a meditation timer's ambience. Adds the `audio`
|
|
85
|
+
* background mode. iOS keeps the app running only while it plays, and App
|
|
86
|
+
* Review expects audible content, so turn it on only for an app that plays
|
|
87
|
+
* some (Web Audio on native screens and in the web view, which use the
|
|
88
|
+
* playback session).
|
|
89
|
+
*/
|
|
90
|
+
enableBackgroundAudio?: boolean;
|
|
82
91
|
/**
|
|
83
92
|
* Purpose strings in the app's own words, by Info.plist key
|
|
84
93
|
* (`{ NSAppleMusicUsageDescription: 'Shows the song playing during a workout.' }`).
|
package/dist/index.js
CHANGED
|
@@ -490,6 +490,8 @@ function renderBackgroundModes(config) {
|
|
|
490
490
|
modes.add("remote-notification");
|
|
491
491
|
if (config.enableHeartRate)
|
|
492
492
|
modes.add("bluetooth-central");
|
|
493
|
+
if (config.enableBackgroundAudio)
|
|
494
|
+
modes.add("audio");
|
|
493
495
|
if (!modes.size)
|
|
494
496
|
return "";
|
|
495
497
|
return ` <key>UIBackgroundModes</key>
|
package/package.json
CHANGED
|
@@ -263,6 +263,7 @@ private func craftNativeAlignContentCode(_ value: String) -> UInt32 {
|
|
|
263
263
|
case "space-between": return 3
|
|
264
264
|
case "space-around": return 4
|
|
265
265
|
case "stretch": return 5
|
|
266
|
+
case "space-evenly": return 6
|
|
266
267
|
default: return 0
|
|
267
268
|
}
|
|
268
269
|
}
|
|
@@ -1203,6 +1204,9 @@ private class CraftNativeFlowView: UIStackView {
|
|
|
1203
1204
|
case "space-around":
|
|
1204
1205
|
crossBetween = free / CGFloat(lineCrosses.count) + crossGap
|
|
1205
1206
|
crossLeading = free / CGFloat(lineCrosses.count * 2)
|
|
1207
|
+
case "space-evenly":
|
|
1208
|
+
crossBetween = free / CGFloat(lineCrosses.count + 1) + crossGap
|
|
1209
|
+
crossLeading = free / CGFloat(lineCrosses.count + 1)
|
|
1206
1210
|
case "stretch":
|
|
1207
1211
|
let extra = free / CGFloat(lineCrosses.count)
|
|
1208
1212
|
lineCrosses = lineCrosses.map { $0 + extra }
|