ReviewOS

also looking at this

craft-native/craft

feat(ios): AR moves to Zig — ratchet 18 -> 13

#126
Merged glennmichael123 wants to merge feat/ios-ar into main
5 files +1480 -10
packages/zig/src/ios_config.zigmodified+13-3
Changes to packages/zig/src/ios_config.zig
@@ -454,6 +454,14 @@ pub fn gateFor(action: []const u8) ?Feature {
454454 // and adding one here would strand a track on disk with no action able
455455 // to reach it.
456456 .{ "startLocationRecording", .geolocation },
457 // All five AR actions carry the same `config.enableAR` guard in the
458 // spec (`CraftApp.swift:1210-1249`), unlike the recorder where only
459 // the start is gated.
460 .{ "startAR", .ar },
461 .{ "stopAR", .ar },
462 .{ "placeARObject", .ar },
463 .{ "removeARObject", .ar },
464 .{ "getARPlanes", .ar },
457465 };
458466 inline for (table) |entry| {
459467 if (std.mem.eql(u8, action, entry[0])) return entry[1];
@@ -637,10 +645,12 @@ test "gateFor answers for a served action and stays quiet for the rest" {
637645 try testing.expectEqual(Feature.camera, gateFor("pickImage").?);
638646 try testing.expectEqual(Feature.secure_storage, gateFor("secureSet").?);
639647
640 // `openURL` is served and ungated in the spec; `startAR` is gated but not
641 // served here, so the shim's own gate applies and this must not answer.
648 // `openURL` is served and ungated in the spec, so this must not answer for
649 // it. `startAR` used to be here for the opposite reason — gated but still on
650 // the shim — and now that Zig serves it, the gate has to come from here.
642651 try testing.expect(gateFor("openURL") == null);
643 try testing.expect(gateFor("startAR") == null);
652 try testing.expectEqual(Feature.ar, gateFor("startAR").?);
653 try testing.expectEqual(Feature.ar, gateFor("getARPlanes").?);
644654 try testing.expect(gateFor("") == null);
645655}
646656