fix: cover the delayed Screen Broadcasting alert's full appearance window - #26
Merged
Merged
Conversation
…ndow The post-stop sweep waited only 2s for the alert to appear, but SpringBoard publishes it much later: ~5s after the stop on iOS 26, and ~10s (up to ~12s) on iOS 18 hardware - so the sweep regularly ended before the alert existed, and the leftover modal made the next broadcast/start fail to bring the runner to the foreground. The start dance could not recover either, because its own dismissal only ran after foregrounding had already succeeded. - Raise the appearance grace to 15s (plus a 5s dismissal budget) and drop the iOS 26 gate: the delayed alert is not an iOS 26-only behavior. - Extract the sweep into a shared helper and run it (with zero appearance grace, i.e. a single probe when no alert is up) before the foregrounding attempts in broadcast/start, and on broadcast/stop's nothing-to-stop path so a crashed broadcast's leftover alert is also cleared. - Retry the activation once when the fallback foregrounding timed out and the sweep confirmed an alert had been swallowing it. Verified on an iPhone SE (iOS 26.5): the sweep now observes the alert ~5.5s into the sweep, dismisses it, and back-to-back start/stop cycles run without the previous 408; an idempotent stop stays at a single probe (~0.4s). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
The post-stop sweep added in #24 waits only 2s for the "Screen Broadcasting" alert to appear, but SpringBoard publishes that alert well after the extension socket closes — measured ~5s after the stop on iOS 26.5, and ~10s (up to ~12s) observed on iOS 18 hardware. The sweep therefore regularly ended before the alert even existed. The leftover modal then blocks any app from foregrounding, so the next
broadcast/startfails with:The start dance could not recover on its own either: its stale-alert dismissal only runs inside the confirmation-sheet wait loop, which is only reached after foregrounding succeeded — and the alert is exactly what prevents foregrounding.
Changes
@available(iOS 26.0, *)gate — the delayed alert is not an iOS 26-only behavior.sweepBroadcastStoppedAlertWithDismissLabels:...) that keeps the existing semantics: wait out the appearance grace, then re-dispatch the dismissal tap until the alert is observed gone. With zero appearance grace it degrades to a single existence probe.broadcast/start: clear a stale alert before the foregrounding attempts (zero-grace sweep), and when the fallback activation times out, sweep once more — if an alert was found (it had landed mid-dance and swallowed the activation), retry the activation once.broadcast/stop: on the nothing-to-stop path, run a zero-grace sweep so a leftover alert from a broadcast that ended without a stop call (crash, runner relaunch) is also cleared, while the idempotent no-op stop stays a single probe.Verification (iPhone SE, iOS 26.5)
broadcast/stoplogsthe Screen Broadcasting alert appeared 5504ms into the sweep, dismisses it, and returns in ~6.4s with the screen clean; back-to-back start/stop cycles run without the 408; an idempotent stop returns in ~0.4s.🤖 Generated with Claude Code