Repository navigation
Conversation
Nothing references the new-post URL parameter keys, the tab bar button class name, the icon inset helper or the empty viewDidLayoutSubviews override. Nothing sets the tab bar controller as a transitioning delegate, so its presentation controller method never runs. Also drop imports the file no longer uses.
WPTabBarController replaced whole tabs when the account or app UI type changed: sign-in rebuilt all four, logout rebuilt the Reader tab, and switching to the Notifications poster rebuilt that tab. Each rebuild threw away the tab bar item and its configuration, and a tab released without being reinstalled left a stale screen on display. Create each tab's navigation controller once and replace only its first screen. Every WordPress.com account change now gives the Reader tab a new presenter and first screen, including the same account signing in again, which used to leave the tab without a presenter.
Collaborator
Generated by 🚫 Danger |
This was referenced Oct 29, 2026
Base automatically changed from
jkmassel/wptabbarcontroller-dead-code
to
trunk
October 30, 2026 00:18
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.
WPTabBarControllernow builds each tab once. When the account or the app UI type changes, it replaces the tab's first screen and keeps the tab. Stacked on #26300.Why
Before this change, a tab was thrown away and rebuilt whenever its first screen had to change:
reloadTabs)defaultAccountDidChange:)setShouldUseStaticNotifications:)Each rebuild created a new navigation controller, which also meant a new tab bar item. Two problems came from that:
updateNotificationBadgeVisibilityagain after each rebuild, and why the Me avatar subscription had to live in a lazy getter.Changes
WPTabBarController.m: build the Reader, Notifications and Me navigation controllers once, ininit. Two new methods replace only a tab's first screen:showFirstReaderScreenInNavigationController:andshowFirstNotificationsScreenInNavigationController:. The lazy getters andtabViewControllersare gone.reloadTabsno longer resets the Reader, since the account change already has. This is the fix for Reader menu and Reader links stop working on iPhone after signing in to WordPress.com again #26228.ReaderPresenter.swift:prepareForTabBarPresentation(in:)fills the tab's existing navigation controller instead of returning a new one.WPTabBarController.h:readerNavigationControllerandnotificationsNavigationControllerare nownonnull. They could never returnnil.Test plan
RootViewCoordinatorTests:Executed 28 tests, with 12 failures. The poster-switch test passes on both. It guards the selected tab, which the old code also kept.WordPressTest/RootViewCoordinatorTestsandWordPressTest/NotificationsViewControllerTestspass:Executed 41 tests, with 0 failures.Simulator checks, all on iOS 27.0, signed in to a local self-hosted site and/or WordPress.com. A temporary debug hook logged the tab bar's address and its four tab addresses at every step. In every row below they stayed the same.
iPhone 18 Pro
WPTabBarController(staticScreens: false)):/read/searchlink opens Reader Search.StaticScreensTabBarWrapper, both posters): both tabs show the Moved-to-Jetpack poster with no Reader presenter. A re-posted account change keeps both posters and the selected tab. Logout goes to the sign-in screen.staticScreensWithReader(live Reader, Notifications poster): Saved opens from the menu. After a re-posted account change Likes opens from the menu, and awpdebug:///read/searchlink opens Reader Search. Notifications stays on the poster.iPad Pro 13-inch (M5), using the compact tab bar inside
SplitViewRootPresenter:staticScreensWithReader(appUITypeDidChange→shouldUseStaticNotifications):readerInWordPressAppflag isn't cached during the first session, so that session runs asstaticScreens. There, sign-in replaces the whole split-view presenter, and the compact tab bar keeps the live tabs. This is existing behaviour; it doesn't go through the code this PR changes./read/searchlinkNot tried: a physical device. Every path above ran on simulators only.
Related issues