Skip to content

fix: cover the delayed Screen Broadcasting alert's full appearance window - #26

Merged
Timo972 merged 1 commit into
masterfrom
timo/dro-2789-broadcast-alert-sweep-window
Aug 25, 2026
Merged

fix: cover the delayed Screen Broadcasting alert's full appearance window#26
Timo972 merged 1 commit into
masterfrom
timo/dro-2789-broadcast-alert-sweep-window

Conversation

@Timo972

@Timo972 Timo972 commented Aug 25, 2026

Copy link
Copy Markdown

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/start fails with:

408 The runner app could not be brought to the foreground to present the broadcast picker

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

  • Raise the appearance grace to 15s (plus a 5s dismissal budget on top) so it covers the slowest observed appearance with margin, and drop the @available(iOS 26.0, *) gate — the delayed alert is not an iOS 26-only behavior.
  • Extract the sweep into a shared helper (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)

  • Before: stop returned after 2.4s having seen no alert; the alert landed ~5s after the stop request; the next start 408'd until the alert was manually accepted.
  • After: broadcast/stop logs the 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.
  • Device and simulator test builds both succeed (the sweep paths are compiled out on simulator/tvOS as before).

🤖 Generated with Claude Code

…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>
@Timo972
Timo972 merged commit 801b0c0 into master Aug 25, 2026
9 of 42 checks passed
@Timo972
Timo972 deleted the timo/dro-2789-broadcast-alert-sweep-window branch August 25, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant