Skip to content

Attach auxiliary windows to the window scene#25636

Open
crazytonyli wants to merge 5 commits into
trunkfrom
task/scene-api-aux-windows
Open

Attach auxiliary windows to the window scene#25636
crazytonyli wants to merge 5 commits into
trunkfrom
task/scene-api-aux-windows

Conversation

@crazytonyli

@crazytonyli crazytonyli commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Note

I recommend reviewing this PR commit by commit. The first commit is swift-format only.

Description

This is the first of a series of PRs preparing the app for adopting the UIScene life cycle. A UIWindow created without a window scene displays fine under the current app-delegate life cycle, but silently never displays once the app declares a scene manifest.

This PR attaches the auxiliary windows to the scene, which behaves the same today and keeps them working after the switch:

  1. WindowManager's overlaying window and CompliancePopoverCoordinator's window are now created from the active scene. When no scene is available, WindowManager fails loudly with an assertion, and CompliancePopoverCoordinator.presentIfNeeded reports the popover as not shown so the presentation can be retried, instead of faking success.
  2. UIApplication.mainWindow is consolidated into WordPressShared: it now falls back to the app delegate's window (which covers the unit test host, where no scene ever connects), the duplicate helper in the unit test bundle is deleted, and JetpackStats uses the shared helper instead of its private copy.

The frame-based fallback produced a window that never displays under the scene
life cycle, silently hiding the exact bug class this branch fixes elsewhere.
Replace it with an assertion and an early return.
The popover's host window was created without a window scene, which displays
today but silently never would under the UIScene life cycle, while
presentIfNeeded still reported success. Window creation now goes through an
injectable factory that requires a connected scene; bailing out when no scene
exists leaves the stored window nil so the caller sees the popover as not
shown and the popup can be retried. The unit test host never connects a
scene, so the tests inject a plain window through the factory.
The unit test bundle shadowed the @objc mainWindow category with a duplicate,
relying on undefined duplicate-category resolution order. The production
helper now falls back to the app delegate's window, which covers both the
moments before the scene's window becomes key and the scene-less unit test
host, so the test shadow is deleted. JetpackStats' private mainWindow copy is
deleted in favor of the shared helper, with WordPressShared added to its
dependencies.
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ Modules/Package.swift was changed without updating its corresponding Package.resolved.

If the change includes adding, removing, or editing a dependency please resolve the Swift packages as appropriate to your project setup (e.g. in Xcode or by running swift package resolve).

If the change to the Package.swift did not modify dependencies, ignoring this warning should be safe, but we recommend double checking and running the package resolution just in case.
.

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number32517
VersionPR #25636
Bundle IDorg.wordpress.alpha
Commit060b1e8
Installation URL7pptease1i7p8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number32517
VersionPR #25636
Bundle IDcom.jetpack.alpha
Commit060b1e8
Installation URL4scdedomo83l8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@crazytonyli crazytonyli requested a review from jkmassel June 11, 2026 03:03
@crazytonyli crazytonyli added this to the 27.0 milestone Jun 11, 2026
@crazytonyli crazytonyli marked this pull request as ready for review June 11, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants