Attach auxiliary windows to the window scene#25636
Open
crazytonyli wants to merge 5 commits into
Open
Conversation
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.
Collaborator
Generated by 🚫 Danger |
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32517 | |
| Version | PR #25636 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 060b1e8 | |
| Installation URL | 7pptease1i7p8 |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32517 | |
| Version | PR #25636 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 060b1e8 | |
| Installation URL | 4scdedomo83l8 |
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.


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
UIWindowcreated 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:
WindowManager's overlaying window andCompliancePopoverCoordinator's window are now created from the active scene. When no scene is available,WindowManagerfails loudly with an assertion, andCompliancePopoverCoordinator.presentIfNeededreports the popover as not shown so the presentation can be retried, instead of faking success.UIApplication.mainWindowis 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.