ReviewOS

also looking at this

craft-native/craft

feat(ios): signInWithApple, and scanQRCode's real reason — ratchet 25 → 23

#122
Merged glennmichael123 wants to merge feat/ios-sign-in-with-apple into main
6 files +591 -5
9 days ago

Four actions had no recorded reason at all (#121 took the first). This settles three more, and the two outcomes are deliberately different.

scanQRCode turned out to have a real blocker

VisionKit's Objective-C headers carry DocumentCamera and nothing else — DataScannerViewController is Swift-only — and its delegate takes a RecognizedItem, a Swift enum with associated values that objc_msgSend cannot destructure. Same class of wall as ActivityKit.

Checked against the iphonesimulator SDK rather than assumed, and recorded in #119's deferral table, which fails the build if it ever stops being true. That is the point of the table: a reason nothing verifies is how the last one rotted.

signInWithApple is migrated

The same check that ruled scanQRCode out ruled this one in — ASAuthorizationController.h:38 declares presentationAnchorForAuthorizationController:, so every class and selector is reachable.

It needed something new: the first delegate method in this migration that returns an object. ios_delegate.enc had only void and BOOL encodings, so object_one_object ("@@:@") joins them. An encoding's first character is its return type, and declaring this one v@:@ would not be a compile error — the runtime would read a window pointer out of a function declared to return nothing.

Two behaviours carried across deliberately

  • email and fullName arrive only on the first authorization for an app; every later sign-in omits them. The keys are omitted rather than emptied, because a page distinguishing "Apple withheld it" from "" is reading a real difference.
  • name is givenName and familyName joined by a space, skipping whichever is absent and omitted entirely when both are — including the part of the spec's join that avoids a stray space. Pinned by a test over all three shapes.

One divergence

The spec rejects every failure with the same localized string, so a page cannot tell a dismissed sheet from a real error. ASAuthorizationError.canceled (1001) answers CANCELLED, matching every other presented surface here.

registerPush is the last one, and is left unrecorded

Its device token arrives at didRegisterForRemoteNotificationsWithDeviceToken on the Swift app delegate, which posts an NSNotification the Coordinator observes. Zig can observe that notification, but cannot install an app-delegate method on a class SwiftUI owns — so serving it means depending on Swift to keep posting. That is a coupling to weigh, not a wall, and dressing it up as a blocker would be exactly the kind of note this work has spent its time correcting.

Verification

Cold zig build test: 150/150 steps, 2501/2513 passed, 0 failed. zig fmt --check clean. build-ios-all -Doptimize=ReleaseSafe builds all three archives.

6 changed files on the files tab, with 0 review threads.

Sign in to comment on this pull request.