Skip to content

Show the test mode sheet on the window the user can see - #540

Open
yusuftor wants to merge 2 commits into
developfrom
fix/test-mode-sheet-active-window
Open

yusuftor wants to merge 2 commits into
developfrom
fix/test-mode-sheet-active-window

Conversation

@yusuftor

@yusuftor yusuftor commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

The test mode sheet was presented from connectedScenes.first and that scene's windows.first. connectedScenes is a set, so .first can be a background, CarPlay or external-display scene. windows.first can be another SDK's overlay window that isn't on screen. When that happens the sheet either isn't shown at all or is shown somewhere the user can't see it.

This switches to UIApplication.activeWindow, the lookup paywalls already use. It prefers the foreground active scene and its key window.

Why now

Natural Camera (app 1128) changed its bundle ID on the dashboard, which put production users into test mode. 81 sheet opens were logged on Oct 6–7, but only 6 were ever closed. That case is the "something is already on screen" problem, which #534 already fixed on develop by presenting from the topmost screen and falling back to the saved choices. This PR closes the other way the sheet can silently fail to show.

Testing

Not unit tested. The change picks a window from the live UIApplication scenes, which the test target can't set up. It reuses the existing activeWindow helper, which paywall presentation already depends on. The SDK builds for the iPhone 17 Pro simulator (iOS 26.5).

Checklist

  • All unit tests pass.
  • All UI tests pass.
  • Demo project builds and runs on iOS.
  • Demo project builds and runs on Mac Catalyst.
  • Demo project builds and runs on visionOS.
  • I added/updated tests or detailed why my change isn't tested.
  • I added an entry to the CHANGELOG.md for any breaking changes, enhancements, or bug fixes.
  • I have run swiftlint in the main directory and fixed any issues.
  • I have updated the SDK documentation as well as the online docs.
  • I have reviewed the contributing guide

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

The PR appears safe to merge.

Summary

The test mode sheet now uses UIApplication.activeWindow instead of the first connected scene and its first window.

  • Reuses the window lookup already used for paywall presentation.
  • Prefers a foreground scene and its key window.
  • Adds a customer-facing fix entry to CHANGELOG.md.

No actionable issues were found. yusuftor explicitly acknowledged the missing unit test and explained why this change relies on the existing helper.

Reviews (1) · Last reviewed commit: "Show the test mode sheet on the window t..." · Reviewed by Greptile

The sheet was presented from the first connected scene and its first
window. Scenes come from a set, so that could be a background or
external-display scene, or another SDK's overlay window. Use the same
active window lookup that paywalls already use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maple-review-bot

maple-review-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 8/10 · likely safe to merge
The single-line change reuses the existing paywall window helper, but foreground scene selection has no automated regression coverage.
quality 100/100 · no findings · tests missing · risk medium

The test mode sheet now selects its presenter through the existing foreground/key-window helper instead of arbitrary scene and window ordering. No introduced defects were found; the scene-selection change has no automated regression test.

What was checked
  • Verified activeWindow prefers foreground-active, then foreground-inactive scenes, with key-window selection.
  • Confirmed presentTestModeModal retains its main-actor isolation, nil guard, and existing presentation flow.

f110fe3 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the switch of the test mode sheet's presenter lookup to the shared activeWindow helper, plus its changelog entry.

  • Presenter lookup: presentTestModeModal now gets its root from UIApplication.sharedApplication?.activeWindow instead of connectedScenes.first / windows.first. That means it picks the foreground active scene's key window, the same way topMostViewController and GetPresenter already do. TestModeModal.topPresenter(from:) still climbs from that root, and the finish() fallback from #534 still covers a presentation that UIKit refuses.
  • Changelog: Added one Fixes bullet to the staged release section. It doesn't bump the version.

Pullfrog  | View workflow run | Using claude-opus-5.5 | 𝕏

@maple-review-bot

maple-review-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 8/10 · likely safe to merge
The change reuses the paywall window selector without altering modal handling, but foreground-window selection has no regression test.
quality 100/100 · no findings · tests missing · risk medium

The test mode sheet now selects its presenter through the existing activeWindow helper, preferring a foreground scene and its key window. No new defects were found; the change is safe to merge.

What was checked
  • activeWindow prioritizes foreground-active, foreground-inactive, then fallback windows.
  • The selected root controller feeds the existing modal and analytics flow unchanged.
  • Files listed since the previous review are develop-merge changes, absent from the base-to-head diff.

6282a77 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

This branch has not been deployed

No deployments
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