Repository navigation
A sheet's dismissal answers on iOS are kept in a trace file the app can share - #13
Merged
Merged
Conversation
…an share A sheet that refuses its swipe down and a tap behind it after the app comes back from the background was reported on phones and could not be reproduced on iOS 27.0 simulators. ModalHost now writes each decision with the terms it read to app:/cache/exact-sheet-trace.log and to the unified log (exact-sheet): the presentation and its isModalInPresentation, every change updatePermissions makes to it, UIKit's presentationControllerShouldDismiss (a line only when what it read changes, since UIKit asks every frame of a drag), a refused attempt, the dismissal, closeTop, a navigation sync deferred while a sheet is up, and each sheet's state at every lifecycle edge and one turn after it. The file opens each launch with the system version and build, and keeps its last 200 to 400 KB. An app shares it with share(files=[...]) and the fs.read grant.
… forgets its observers, and keeps no locations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On iPhones, a sheet sometimes refuses its swipe down and a tap behind it after the app comes back from the background; its close button still works. It shows on an iPhone 17 Pro (iOS 27) and an iPhone 12 Pro (iOS 18.7) in builds from this fork's
main, and I couldn't reproduce it on iOS 27.0 simulators. This PR records each dismissal decision on the phone so the next report says which check refused.Solution
Diagnostic only: it writes a line on every sheet decision in Release builds. Remove it, or put it behind a flag, once the cause is found.
ModalHostrefuses in two places:isModalInPresentation, written at the end of each navigation sync, andpresentationControllerShouldDismiss, which UIKit asks only while that flag is false.SheetTrace(SheetTraceIOS.swift) writes each decision toapp:/cache/exact-sheet-trace.logand to the unified log underexact-sheet, with the flag and every termrefusesDismissalreads. An app shares the file withshare(files=[...])and thefs.readgrant.updatePermissionsmakes,shouldDismiss,didAttemptToDismiss, will/did dismiss,closeTop, a sync deferred while a sheet is up, and each sheet's state at every lifecycle edge.shouldDismissbuilds its line, which reads the runtime, only when the answer, the flag, the route or the selected route changes, since UIKit asks every frame of a drag.Side finding: a sync that holds a push inside a sheet (
liftHeld) flips the flagfalse -> truefor about 30 ms, until the next sync. A swipe's first touch produces a batch whose sync clears it, so it's probably not the phone bug.Test plan
bun host/apple/build.mjs --test --ios --only ModalStackIOSTestson an iOS 27.0 iPhone 17 Pro simulator: all pass, including the newtestTheSheetTraceRecordsEachDismissalAnswerAndWhatItRead. It answers UIKit'sshouldDismissbefore and after a push inside a sheet, then reads both lines back from the file.