also looking at this
iOS: the audio recording pair — ratchet 33 → 31
#98
9 files
+744
-3
| @@ -64,7 +64,7 @@ swiftc -target "$TRIPLE" -sdk "$SDK" \ | ||
| 64 | 64 | "$ROOT/packages/zig/zig-out/lib/$LIB" \ |
| 65 | 65 | -framework UIKit -framework WebKit -framework Foundation -framework Security \ |
| 66 | 66 | -framework Vision -framework LocalAuthentication -framework PDFKit \ |
| 67 | -framework WatchConnectivity -framework CoreBluetooth \ | |
| 67 | -framework WatchConnectivity -framework CoreBluetooth -framework AVFoundation \ | |
| 68 | 68 | -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker "$OUT/sim.entitlements" \ |
| 69 | 69 | -o "$APP/CraftSlice" |
| 70 | 70 | |
| @@ -92,6 +92,13 @@ echo "==> installing and launching" | ||
| 92 | 92 | xcrun simctl uninstall "$UDID" "$BUNDLE_ID" 2>/dev/null || true |
| 93 | 93 | xcrun simctl install "$UDID" "$APP" |
| 94 | 94 | |
| 95 | # Pre-grant the microphone. Unlike notifications — which simctl has no service | |
| 96 | # for — audio recording *can* be authorised without a human, which is the whole | |
| 97 | # reason this pair is verifiable end to end and scheduleNotification is not. | |
| 98 | # Granted before launch, because simctl terminates a running app on a | |
| 99 | # permission change. | |
| 100 | xcrun simctl privacy "$UDID" grant microphone "$BUNDLE_ID" 2>/dev/null || true | |
| 101 | ||
| 95 | 102 | LOG="$OUT/console.log" |
| 96 | 103 | xcrun simctl launch --console-pty "$UDID" "$BUNDLE_ID" > "$LOG" 2>&1 & |
| 97 | 104 | LAUNCH_PID=$! |
| @@ -332,4 +339,15 @@ C58="$(count 58)" | ||
| 332 | 339 | [ "$C58" -ge 1 ] || { echo "FAIL: stopBluetoothScan did not resolve"; exit 1; } |
| 333 | 340 | echo "ok: stopping with nothing running still answers true (i=58 seen ${C58}x)" |
| 334 | 341 | |
| 342 | C62="$(count 62)" | |
| 343 | [ "$C62" -ge 1 ] || { echo "FAIL: startAudioRecording never started the recorder"; exit 1; } | |
| 344 | echo "ok: microphone granted and AVAudioRecorder running (i=62 seen ${C62}x)" | |
| 345 | ||
| 346 | C64="$(count 64)" | |
| 347 | # The reply base64-decodes to a file whose bytes 4..8 are 'ftyp' — the ISO base | |
| 348 | # media signature every M4A carries. AVAudioRecorder wrote those bytes from a | |
| 349 | # live capture; nothing short of the whole path produces them. | |
| 350 | [ "$C64" -ge 1 ] || { echo "FAIL: stopAudioRecording did not return a real M4A"; exit 1; } | |
| 351 | echo "ok: recording came back as a decodable M4A data URL (i=64 seen ${C64}x)" | |
| 352 | ||
| 335 | 353 | echo "PASS" |