Repository navigation
Conversation
JetpackFeaturesRemovalCoordinator.isReaderInWordPressAppEnabled was read once per launch, before the launch fetch finished. A fresh install has no cached value, and the flag can target an account, so a WordPress.com account's first session in the WordPress app ran as staticScreens even after the fetch returned the flag. It took a relaunch to get the live Reader. After each fetch, RootViewCoordinator reads the flag again. When it changed, it updates the flag and the app UI type together, so Notifications lists created afterwards get the matching scope. The iPad split view applies the type in place; the other presenters are rebuilt through reloadUIIfNeeded. The account-change observer is now registered whatever the flag's launch value, and acts only while the flag is on, so a launch with the flag off keeps its UI type until the next reload, as before.
After a logout, presentedAppUIType still holds the old type, so a fetch that changed the Reader flag reloaded the UI and WindowManager.showUI replaced the sign-in flow. The next showAppUI uses the new type anyway.
Collaborator
Generated by 🚫 Danger |
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.
Fixes the WordPress app ignoring a fetched
readerInWordPressAppflag until the next launch. A WordPress.com account's first session on a fresh install got the posters instead of the live Reader, and needed a relaunch to get it. Stacked on #26302.Root Cause
JetpackFeaturesRemovalCoordinator.isReaderInWordPressAppEnabledwas astatic varread once per launch, before the launch fetch had finished.On the simulator, the log showed this order on a fresh install:
falsetrue(the flag targets the account)RootViewCoordinatoralso only watched for account changes if the flag was on at launch. So a flag that arrived later never took effect in that session.The value was frozen on purpose: it also decides the scope of the Notifications lists, and reading it live could leave a list and the root UI disagreeing. This PR keeps that guarantee by changing the flag and the UI type at the same moment.
Changes
WordPressAppDelegate.updateFeatureFlagspostsRemoteFeatureFlagStore.didUpdateNotificationon the main queue after each fetch. It only posts a notification: the first fetch can finish before any scene connects, so it must not touch the UI. An earlier version of this branch calledRootViewCoordinator.shareddirectly and crashed at launch withwindowManager accessed before any scene connected.RootViewCoordinator.remoteFeatureFlagsDidUpdate()reads the flag again. If it changed, it updatesisReaderInWordPressAppEnabledand the app UI type together.reloadUIIfNeeded, but only while an app UI is on screen. When the sign-in UI is up, the nextshowAppUI()already uses the new type. Without that check, a fetch after a logout replaced the sign-in flow; a test covers this.testSignInKeepsLaunchUITypeUntilReloadWhenFlagIsOff).Test plan
RootViewCoordinatorTests:Executed 37 tests, with 3 failures. The other new tests can't run on Keep the iPad Reader and Notifications behind the Jetpack features removal #26302's code, becauseremoteFeatureFlagsDidUpdate()doesn't exist there.RootViewCoordinatorTests,NotificationsViewControllerTestsandMovedToJetpackViewModelTestspass:Executed 53 tests, with 0 failures, andTest run with 2 tests in 1 suite passed.RootViewCoordinatorTestsalone also passes after the sign-in check was added:Executed 35 tests, with 0 failures.Not tried: a physical device, and a real server-side change to the flag in the middle of a session (simulated with the override instead).
Related issues