Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds an Expo iOS config plugin for UIKit scene lifecycle support, including SceneDelegate generation, AppDelegate migration, Info.plist configuration, Xcode source linking, and validation tests. Pairing deep-link handling now uses a shared helper that prefers scene-aware linking URLs and falls back to legacy initial URLs across the app’s pairing routes. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
mobile/src/transport/pairing.test.ts (1)
46-66: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a test for the
getInitialURLrejection path.The
.catch(() => null)branch ingetInitialPairingCodeis a deliberate error-handling path that is not covered by tests. If someone removes the.catch(), the test suite wouldn't detect the regression. Adding a test that verifies the function returnsnullwhengetInitialURLrejects closes this gap.♻️ Suggested test addition
it('falls back to the legacy initial URL when the scene registry is empty', async () => { expect( await getInitialPairingCode({ getLinkingURL: () => null, getInitialURL: async () => 'orca://pair?code=legacy-code' }) ).toBe('legacy-code') }) + + it('returns null when the legacy initial URL rejects', async () => { + expect( + await getInitialPairingCode({ + getLinkingURL: () => null, + getInitialURL: async () => { + throw new Error('native module unavailable') + } + }) + ).toBeNull() + }) + + it('returns null when no URL is available from either source', async () => { + expect( + await getInitialPairingCode({ + getLinkingURL: () => null, + getInitialURL: async () => null + }) + ).toBeNull() + })mobile/plugins/ios-uikit-scene-lifecycle-transform.js (1)
125-150: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winFail-closed logic is sound; brittle exact-match risks unnecessary hard failures.
rewriteAppDelegate's intentional throw-on-ambiguity/throw-on-no-match design (validated by the test suite) is good, but theoldBootstraptemplate (Lines 135-141) is matched via a plainString.replacerequiring byte-for-byte equality (whitespace, indentation, line endings). Any drift in the Expo/Xcode-generatedAppDelegate.swift(e.g., a future Expo SDK patch reformatting the template, or a stray trailing space) will trip the "pattern not found" throw and hard-fail the entire iOS prebuild for every developer, even though the content is functionally unchanged.Consider normalizing whitespace/line endings before matching (or matching with a whitespace-tolerant regex) while preserving the fail-closed behavior for genuinely different content.
♻️ Example: normalize before matching
+function normalizeForMatch(str) { + return str.replace(/\r\n/g, '\n').replace(/[ \t]+\n/g, '\n') +} + function rewriteAppDelegate(contents) { if (contents.includes(MIGRATED_BOOTSTRAP_MARKER)) { if (hasAppDelegateOwnedBootstrap(contents)) { throw new Error( 'ios-uikit-scene-lifecycle: partial scene lifecycle migration detected; refuse ambiguous AppDelegate rewrite' ) } return contents } const oldBootstrap = `#if os(iOS) || os(tvOS) window = UIWindow(frame: UIScreen.main.bounds) factory.startReactNative( withModuleName: "main", in: window, launchOptions: launchOptions) `#endif`` const newBootstrap = ` // Why: ${MIGRATED_BOOTSTRAP_MARKER}` - const rewritten = contents.replace(oldBootstrap, newBootstrap) - if (rewritten === contents) { + const normalizedContents = normalizeForMatch(contents) + if (!normalizedContents.includes(oldBootstrap)) { throw new Error( 'ios-uikit-scene-lifecycle: AppDelegate bootstrap pattern not found; refuse silent no-op rewrite' ) } - return rewritten + return normalizedContents.replace(oldBootstrap, newBootstrap) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7799d7ee-2eb4-433b-ab46-aa55599639aa
📒 Files selected for processing (7)
mobile/app/_layout.tsxmobile/app/pair.tsxmobile/plugins/ios-uikit-scene-lifecycle-transform.jsmobile/plugins/ios-uikit-scene-lifecycle.jsmobile/src/config/ios-uikit-scene-lifecycle-transform.test.tsmobile/src/transport/pairing.test.tsmobile/src/transport/pairing.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- mobile/plugins/ios-uikit-scene-lifecycle.js
|
Addressed CodeRabbit: wrap |
|
@coderabbitai review |
✅ Action performedReview finished.
|
4468c6a to
1fb3aaf
Compare
|
Rebased onto current |
a18f441 to
3010d26
Compare
Guard synchronous Linking URL reads the same way as getInitialURL so a throwing Expo registry does not reject cold-start pair deep-links.
Ensure scene-registry failures still recover via getInitialURL.
3010d26 to
aace8a8
Compare
|
Closing as part of fork PR backlog cleanup. This branch is long-conflicted (DIRTY) against current |
Summary
Without this, the iOS app does not launch: Expo SDK 55 emits an AppDelegate-owned
UIWindow, which the iOS 27 SDK aborts at startup, andmobile/ships no scene manifest today — window ownership and launch options still live onAppDelegate.SceneDelegate.swiftfor current UIKit scene lifecycle requirementsSceneDelegate.swiftis actually in the application target's Sources build phase; propagate linking failures instead of deferring them to Xcode compile timeCheckable without Xcode: cold- and warm-launch custom-URL forwarding through the scene callbacks, covered by
mobile/src/config/ios-uikit-scene-lifecycle-transform.test.ts(scene URL and universal-link events) andmobile/src/transport/pairing.test.ts(the scene-aware URL registry, plus its fallback to the legacy initial URL).This is the iOS scene-lifecycle replacement extracted from #7949. It intentionally excludes host editing and device identity.
Refs #7949
Screenshots
No visual change.
Testing
oxlintnode --checkoxfmt --checkpnpm check:max-lines-ratchetgit diff --check origin/main...HEADNative verification needed from a maintainer
Not runnable in this environment, and still the final gate for a native project mutation: Expo prebuild, and an Xcode build on simulator or a physical iOS device. Electron/E2E/GUI does not apply — every changed file is under
mobile/.AI Review Report
The initial independent gate found two blockers: partial scene migrations could be silently accepted, and Xcode source-link failures were swallowed. Both were reproduced and fixed.
Final independent verdict: spec PASS / quality APPROVED. A previously migrated AppDelegate is accepted only when its marker and launch-options property are present and it no longer owns a UIWindow or starts React Native. The Xcode mutation now confirms the PBXFileReference → PBXBuildFile → application PBXSourcesBuildPhase chain for
SceneDelegate.swiftand throws otherwise.Security Audit
Compatibility
The plugin registers only iOS config mods. Android, desktop macOS/Linux/Windows, SSH, keyboard, filesystem, and Git-provider behavior are unchanged. The AppDelegate rewrite is scoped to the known Expo SDK 55 React Native template and explicitly rejects unknown partial states.
Notes
Validation used Node 26.5.0 while the repository declares Node 24.
ELI5
The mobile iOS app is updated for the modern scene lifecycle: window ownership and launch options move to SceneDelegate, and custom URL opens work for cold and warm launches. That matches current iOS requirements and keeps deep links reliable.