Repository navigation
Adopt the UIScene life cycle - #25643
Merged
Merged
Conversation
Collaborator
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32689 | |
| Version | PR #25643 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | d144c0a | |
| Installation URL | 2mh14r538jsp8 |
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32689 | |
| Version | PR #25643 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | d144c0a | |
| Installation URL | 3jv3iq36nb8k0 |
crazytonyli
force-pushed
the
task/scene-api-handler-extraction
branch
from
June 12, 2026 00:57
a682e3d to
e578add
Compare
crazytonyli
force-pushed
the
task/scene-api-adoption
branch
from
June 12, 2026 00:57
407de0d to
55292c3
Compare
crazytonyli
force-pushed
the
task/scene-api-handler-extraction
branch
from
June 12, 2026 01:13
e578add to
5e27133
Compare
crazytonyli
force-pushed
the
task/scene-api-adoption
branch
3 times, most recently
from
June 14, 2026 21:34
2053576 to
72d621e
Compare
crazytonyli
force-pushed
the
task/scene-api-handler-extraction
branch
from
June 14, 2026 21:34
5e27133 to
3392e80
Compare
crazytonyli
changed the base branch from
task/scene-api-handler-extraction
to
trunk
June 14, 2026 21:36
crazytonyli
marked this pull request as ready for review
June 15, 2026 02:22
The app opts into the scene life cycle via application(_:configurationForConnecting:options:), which names WordPressSceneDelegate as the scene delegate in one place for all three app targets instead of three copies of a UIApplicationSceneManifest; the scene delegate creates the scene-attached window and forwards every scene callback into the AppDelegate's shared handlers. Window creation moves from willFinishLaunching to the scene-connect phase, and launch-time URL, user-activity, and shortcut payloads arrive through UIScene.ConnectionOptions, routed through the same methods that handle them at runtime, so the launchOptions plumbing is dead and removed. UITestConfigurator splits into a process part that stays in willFinishLaunching (UI-test flags must be parsed before the launch sequence reads them) and a window part applied when the window is created. The unit test host's TestingAppDelegate doesn't implement the scene opt-in, so tests keep the legacy life cycle.
AppAppearance.overrideAppearance() and the Home Screen quick action creation both reach the app's window indirectly (the override style target and the 3D Touch trait check). Under the scene life cycle the window does not exist until the scene connects, so these no-opped when left in willFinishLaunching and runStartupSequence. Move them into showInitialUI alongside the other window-dependent launch steps.
…nnect The system can disconnect the app's scene in the background and reconnect it later in the same process. showInitialUI previously re-ran the full UI bootstrap on every connect: it created a fresh window while the window manager stayed bound to the old one (leaving the new key window empty), re-registered the Apple ID revocation observer, and replaced the authenticator and notice presenter. The bootstrap now runs exactly once; later connects reattach the existing window to the new scene. The window manager's missing-window fatalError is also downgraded to an assertion with a recovery path, since background launches make it reachable for any unguarded UI path.
Under the scene life cycle, background launches (silent push, background URL session wake) run with no UI and no authenticator: both are set up at the first scene connect now. The support-notification handler built UI through the root view coordinator, and the account-changed handler showed sign-in UI and touched WordPressAuthenticator.shared, which fatalErrors before configureWordPressAuthenticator runs. These paths now skip the UI and observer work when the UI has not been built. The guards key on hasConfiguredInitialUI rather than window presence, because the windowManager emergency fallback can create a window while no scene has ever connected.
sceneWillEnterForeground also fires right after the initial scene connect during a cold launch, unlike the legacy applicationWillEnterForeground, which re-ran the Jetpack migration eligibility check and emitted its analytics event twice per launch; the window phase already runs that check via windowManager.showUI(). The feature flag and remote config refresh is not skipped though: for a background-launched process, the launch-time refresh may be hours stale by the time the user first opens the app, and an extra refresh right after a cold launch is harmless.
A notification-tap cold launch reaches handleNotification while the application state is still .background under the scene life cycle: the scene has connected, but the foreground transition hasn't completed. The inactive handler rejected that state, so the background handler swallowed the tap with a silent sync and the app opened without navigating to the tapped notification. The inactive handler now accepts taps in the background state, matching the existing workaround in the authentication notification handler.
crazytonyli
force-pushed
the
task/scene-api-adoption
branch
from
June 15, 2026 05:42
72d621e to
299066b
Compare
jkmassel
reviewed
Jun 15, 2026
Comment on lines
+20
to
+22
| guard let windowScene = scene as? UIWindowScene else { | ||
| return | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| guard let windowScene = scene as? UIWindowScene else { | |
| return | |
| } | |
| guard let windowScene = scene as? UIWindowScene, | |
| session.role == .windowApplication | |
| else { | |
| return | |
| } |
There's a fun bug here where AirPlay mirroring can break the window (validated on-device). This fix avoids that, though we might want to revisit it later for better multi-screen support.
Contributor
Author
There was a problem hiding this comment.
Good catch! I have addressed the issue in a slightly different way in d338794.
configurationForConnecting attached WordPressSceneDelegate to every connecting scene, so an external-display scene (AirPlay mirroring or a wired display) ran showInitialUI and reattached the app's single window to that non-interactive scene, blanking the device's screen. The delegate is now attached only to the windowApplication scene, and the Info.plists re-declare UIApplicationSupportsMultipleScenes as false, which was lost when the scene manifest was replaced with code-based configuration.
Contributor
|
Filed #25664 to track the |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 17, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 17, 2026
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.
Description
This PR unblocks compiling on Xcode 27. Adopting UIScene lifecycle is required by Xcode 27.
https://developer.apple.com/documentation/technotes/tn3187-migrating-to-the-uikit-scene-based-life-cycle
The main goal here is to adopt the "new" APIs without crashing or regressing the app. The separation between the UI and the app process is still not very clean, but that can be tightened in future PRs.
application(_:configurationForConnecting:options:)namingWordPressSceneDelegate, instead of aUIApplicationSceneManifestin each of the three target Info.plists. This keeps the delegate class name in one place, and the unit test host'sTestingAppDelegate(which doesn't implement it) stays on the legacy life cycle.willFinishLaunchingto the first scene connect (showInitialUI). A scene can disconnect and reconnect within one process, so the UI is built once and the existing window is reattached on later connects.hasConfiguredInitialUIrather than on window presence.handleNotificationin the.backgroundstate, so the inactive handler accepts taps there too, matching the existing workaround in the authentication handler.Testing instructions
The launch and notification paths carry the regression risk: