ReviewOS

also looking at this

craft-native/craft

fix(native): interaction, audio, document and checkpoint gaps stranded after #401

#415
Merged glennmichael123 wants to merge codex/issues-388-400-344 into main
19 files +987 -50

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

docs/guides/native-stx.mdmodified+2-1
Changes to docs/guides/native-stx.md
@@ -1390,7 +1390,8 @@ the previous confirmed checkpoint remains available after a failed or
13901390interrupted replacement. If a screen closes while a checkpoint is still being
13911391written, its promise rejects instead of hanging; the host's later worker
13921392completion cannot publish a second result for that request. iOS also reports a
1393failed result when its writer completes after the screen runtime is disposed.
1393failed result when its writer completes after the screen runtime is disposed or
1394has already been deallocated.
13941395
13951396The `media` capability (iOS) keeps video and audio on the phone for offline,
13961397in Application Support rather than the temporary directory, left out of
packages/ios/src/index.test.tsmodified+1-1
Changes to packages/ios/src/index.test.ts
@@ -543,7 +543,7 @@ describe('Craft iOS builder', () => {
543543 expect(native).toContain('pendingCapabilityDeadlines.values.forEach { $0.cancel() }')
544544 expect(native).toContain('CraftNativeScriptThread.run { timers.pending.values.forEach { $0.cancel() } }')
545545 expect(native).toContain('pendingCapabilityRequests.forEach { CraftNativeActions.cancel(requestToken: $0) }')
546 expect(native).toContain('self?.runtimeDisposed == true ? false : ok')
546 expect(native).toContain('self?.runtimeDisposed != false ? false : ok')
547547 expect(native).toContain('never as a successful write into a dead runtime')
548548 expect(native).toContain('lifecycleObservers.forEach(NotificationCenter.default.removeObserver)')
549549 expect(native).not.toContain('WKWebView')
packages/ios/templates/CraftNativeScreen.swiftmodified+2-2
Changes to packages/ios/templates/CraftNativeScreen.swift
@@ -6412,7 +6412,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
64126412 // A writer can finish after UIKit has disposed this
64136413 // screen. Resolve the pending promise as a cancellation,
64146414 // never as a successful write into a dead runtime.
6415 done.call(withArguments: [self?.runtimeDisposed == true ? false : ok])
6415 done.call(withArguments: [self?.runtimeDisposed != false ? false : ok])
64166416 }
64176417 }
64186418 }
@@ -6420,7 +6420,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
64206420 let names = (keep.isUndefined || keep.isNull ? [] : (keep.toArray() ?? [])).compactMap { $0 as? String }
64216421 CraftSnapshots.clear(keeping: Set(names)) { [weak self] ok in
64226422 CraftNativeScriptThread.run {
6423 done.call(withArguments: [self?.runtimeDisposed == true ? false : ok])
6423 done.call(withArguments: [self?.runtimeDisposed != false ? false : ok])
64246424 }
64256425 }
64266426 }