feat: migrate navigation to Navigation 3 [MOB-20] - #5187
Open
Garzas wants to merge 10 commits into
Open
Conversation
Garzas
requested review from
MohamadJaara,
ohassine,
saleniuk and
valerio-bettini
and removed request for
a team
August 18, 2026 05:50
Collaborator
New ADR(s) in this PR 📚: |
Contributor
Test Results2 586 tests 2 586 ✅ 1m 30s ⏱️ Results for commit a59a707. ♻️ This comment has been updated with latest results. |
4 tasks
…igration # Conflicts: # app/src/main/kotlin/com/wire/android/di/AppModule.kt # app/src/main/kotlin/com/wire/android/di/metro/WireMetroViewModelBindings.kt # app/src/main/kotlin/com/wire/android/ui/debug/DebugScreen.kt # app/stability/app-devDebug.stability
Contributor
|
APKs built during tests are available here. Scroll down to Artifacts! |
Contributor
|
APKs built during tests are available here. Scroll down to Artifacts! |
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.
https://wearezeta.atlassian.net/browse/MOB-20
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764The PR Description
Summary
This PR completes the Android navigation migration from Compose Destinations to Navigation 3.
It replaces generated destinations, navigation graphs and direct
NavHostControlleraccess with:WireNavigationControllermutation boundary;wireEntryproviders;WireActivity.Why
The previous navigation integration mixed several independent responsibilities:
In particular, existing screens could indirectly depend on transient
currentSessionvalues or parent/previousNavBackStackEntrylookups. During login, logout and account switching, this made navigation and ViewModel lifetime difficult to reason about.The new architecture does not guarantee that
currentSessionwill never temporarily becomenull. It guarantees that this temporary state cannot change the Metro graph, ViewModel owner or ViewModel of an existing navigation entry.Core identity model
For a route such as:
the responsibilities are separated as follows:
The final ViewModel is constructed from:
Metro graph identity and ViewModel ownership are deliberately independent.
Architecture
Typed routes
Generated destination classes and route-string classification are replaced by serializable feature-owned routes:
AuthenticationRouteandSessionRouteexplicitly determine which Metro graph is required.Single back-stack mutation boundary
All back-stack changes go through:
WireNavigationControllerNavigation decisions are represented as data:
Features no longer receive a mutable
NavHostController.Explicit ViewModel ownership
Navigation 3 provides an entry-specific
ViewModelStoreOwner. Wire additionally supports explicitly shared owners:Entry(entryId)— one concrete screen occurrence; default;Flow(flowId)— a multi-screen flow such as login or registration;Session(sessionId)— deliberately shared account-session state;Application— process-wide state.Making a shared owner available does not change the default owner. A ViewModel uses a shared owner only when requested explicitly.
Route-based Metro graph resolution
MetroWireEntryEnvironmentresolves the dependency graph from the typed route:The resolver does not use
currentSessionto select a graph for an existing route.The resulting
MetroViewModelFactoryis provided at the entry boundary, while Navigation 3 independently provides theViewModelStoreOwner.Explicit ViewModel arguments
Generated
SavedStateHandle.navArgs()usage is replaced by:and focused assisted factories:
SavedStateHandleremains valid for restorable UI state, but it is no longer the source of navigation identity.Session graph lifecycle
Session graphs now follow an explicit lifecycle:
An invalidating or removed graph cannot be silently recreated by a stale navigation entry.
Logout and account switching coordinate cleanup in a deterministic order:
Typed results
Generated
ResultRecipientandResultBackNavigatorAPIs are replaced by typed result contracts addressed to the requestingentryId.The result registry supports:
WireActivityas a platform hostWireActivityremains responsible for Android-specific integration:Navigation decisions, session policy, graph lifecycle and back-stack operations are delegated to focused, testable collaborators.
Main implementation areas
core/navigation-kmpcore/navigationWireNav3Host;core/diapp/navigation/runtimeFeature navigation files
wireEntryproviders;Migration scope
The branch migrates the complete production navigation surface, including:
The production contribution catalog currently assembles 19 entry installers and validates unique route/result registrations.
Legacy Compose Destinations navigation infrastructure and generated navigation wrappers are removed as part of the complete cutover.
KMP boundary
This PR contains
core/navigation-kmp, which holds the platform-independent contracts required by Navigation 3:WireRoute;WireNavigationCommand;WireNavigationController;WireViewModelOwner;It does not contain the later secret-project UI or feature KMP migrations. Those changes remain outside this branch.
Kalium/toolchain dependency
This branch points to the companion Kalium branch:
The Kalium change only aligns the Android build toolchain:
This alignment is required by the Navigation 3/Lifecycle 2.11 dependency chain. It does not contain a functional Kalium or KMP migration.
Required regression testing
The following flows should receive particular attention:
Authentication
Multi-account
Navigation
Lifecycle
currentSession == nulldoes not change the graph or owner of an existing entry.Review guide
A useful review order is:
WireRouteandWireViewModelOwner;WireNavigationControllerand back-stack reducer;wireEntryandWireNav3Host;WireViewModelStoreNavEntryDecorator;MetroWireEntryEnvironment;SessionGraphStoreViewModel;ConversationRoute;WireActivityproduction host;Risks and trade-offs
The additional code represents previously implicit behavior that is now explicit, testable and independently owned: route identity, stack operations, Metro graph selection, ViewModel lifetime, result delivery and session teardown.