ReviewOS

also looking at this

craft-native/craft

iOS: the health query pair — ratchet 31 → 29

#99
Merged glennmichael123 wants to merge feat/ios-health into main
8 files +922 -4
packages/ios/fixtures/zig-slice/page.mmodified+19-1
Changes to packages/ios/fixtures/zig-slice/page.m
@@ -52,7 +52,7 @@ const char craft_slice_page[] =
5252 "var sentPdfOpen = false, sentPdfClose = false;\n"
5353 "var sentDownload = false, sentWatch = false, sentSettings = false;\n"
5454 "var sentBtStart = false, sentBtStop = false;\n"
55 "var sentRecStart = false, sentRecStop = false;\n"
55 "var sentRecStart = false, sentRecStop = false, sentHealth = false;\n"
5656 "window.__craftBridgeError = function (ctx) {\n"
5757 " // The message crossed Zig's escaping with a backslash, quote, and\n"
5858 " // newline intact; anything mangled and this equality fails, i=7 never\n"
@@ -83,6 +83,10 @@ const char craft_slice_page[] =
8383 " // usage description is present, so this is the radio's own state and\n"
8484 " // not a missing class or a missing plist key. Swift answers all five\n"
8585 " // unusable states with one string; this one names which.\n"
86 " if (!sentHealth && ctx && ctx.error === true && ctx.id === 107) {\n"
87 " sentHealth = true;\n"
88 " bridge.postMessage({t:'mobile', a:'getDeviceInfo', i:66});\n"
89 " }\n"
8690 " if (!sentBtStart && ctx && ctx.error === true && ctx.id === 103\n"
8791 " && ctx.code === 'PLATFORM_NOT_SUPPORTED') {\n"
8892 " sentBtStart = true;\n"
@@ -187,6 +191,15 @@ const char craft_slice_page[] =
187191 " // Nothing but a real download-and-move produces it.\n"
188192 " // The recorder is running. Give it a moment of audio before stopping,\n"
189193 " // or the encoder writes a container with no samples in it.\n"
194 " // Answering at all is the property: the spec's arm has no else, so an\n"
195 " // unauthorised HealthKit left the promise pending. When it does answer\n"
196 " // with data, unit 'count' proves the HKUnit round-tripped out through\n"
197 " // unitFromString and back through unitString.\n"
198 " if (!sentHealth && action === 'getHealthData' && payload\n"
199 " && typeof payload.value === 'number' && payload.unit === 'count') {\n"
200 " sentHealth = true;\n"
201 " bridge.postMessage({t:'mobile', a:'getDeviceInfo', i:66});\n"
202 " }\n"
190203 " if (!sentRecStart && action === 'startAudioRecording' && payload === true) {\n"
191204 " sentRecStart = true;\n"
192205 " bridge.postMessage({t:'mobile', a:'getDeviceInfo', i:62});\n"
@@ -359,6 +372,11 @@ const char craft_slice_page[] =
359372 " // asserts. The stop goes out once the start has been answered.\n"
360373 " bridge.postMessage({t:'mobile', a:'startBluetoothScan', i:103});\n"
361374 " bridge.postMessage({t:'mobile', a:'startAudioRecording', i:105});\n"
375 " // getHealthData only. requestHealthAuthorization presents a system\n"
376 " // sheet and simctl has no HealthKit privacy service, so it cannot be\n"
377 " // answered without a person — the same wall scheduleNotification hits.\n"
378 " bridge.postMessage({t:'mobile', a:'getHealthData',\n"
379 " d: JSON.stringify({type:'steps'}), i:107});\n"
362380 " // A Tier-0 action migrated in this phase, served by Zig directly.\n"
363381 " bridge.postMessage({t:'mobile', a:'getAppState', i:88});\n"
364382 " // And one the shim answers by rejecting, to prove the error route.\n"