ReviewOS

also looking at this

craft-native/craft

iOS: the audio recording pair — ratchet 33 → 31

#98
Merged glennmichael123 wants to merge feat/ios-audio-recording into main
9 files +744 -3
packages/ios/fixtures/zig-slice/build-and-run.shmodified+19-1
Changes to packages/ios/fixtures/zig-slice/build-and-run.sh
@@ -64,7 +64,7 @@ swiftc -target "$TRIPLE" -sdk "$SDK" \
6464 "$ROOT/packages/zig/zig-out/lib/$LIB" \
6565 -framework UIKit -framework WebKit -framework Foundation -framework Security \
6666 -framework Vision -framework LocalAuthentication -framework PDFKit \
67 -framework WatchConnectivity -framework CoreBluetooth \
67 -framework WatchConnectivity -framework CoreBluetooth -framework AVFoundation \
6868 -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker "$OUT/sim.entitlements" \
6969 -o "$APP/CraftSlice"
7070
@@ -92,6 +92,13 @@ echo "==> installing and launching"
9292xcrun simctl uninstall "$UDID" "$BUNDLE_ID" 2>/dev/null || true
9393xcrun simctl install "$UDID" "$APP"
9494
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.
100xcrun simctl privacy "$UDID" grant microphone "$BUNDLE_ID" 2>/dev/null || true
101
95102LOG="$OUT/console.log"
96103xcrun simctl launch --console-pty "$UDID" "$BUNDLE_ID" > "$LOG" 2>&1 &
97104LAUNCH_PID=$!
@@ -332,4 +339,15 @@ C58="$(count 58)"
332339[ "$C58" -ge 1 ] || { echo "FAIL: stopBluetoothScan did not resolve"; exit 1; }
333340echo "ok: stopping with nothing running still answers true (i=58 seen ${C58}x)"
334341
342C62="$(count 62)"
343[ "$C62" -ge 1 ] || { echo "FAIL: startAudioRecording never started the recorder"; exit 1; }
344echo "ok: microphone granted and AVAudioRecorder running (i=62 seen ${C62}x)"
345
346C64="$(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; }
351echo "ok: recording came back as a decodable M4A data URL (i=64 seen ${C64}x)"
352
335353echo "PASS"