-
Notifications
You must be signed in to change notification settings - Fork 154
🛸 Update Navigation to v3 #1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Navigation-related dependencies updates to use the alpha versions for v3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request represents a major architectural migration from androidx.navigation (v2.9.1) to androidx.navigation3 (v1.0.0-alpha06), modernizing the navigation system with new APIs and patterns. The refactor introduces a custom NavBackStack controller for type-safe navigation state management, replaces NavHost with NavDisplay, and updates all navigation graph definitions to use the new EntryProviderScope and entry APIs.
Key changes:
- Introduced
NavBackStackclass to replaceNavHostController, providing direct control over navigation state, back stack management, and top app bar visibility - Migrated all feature navigation graphs to use
entryAPI withEntryProviderScope, replacingcomposableanddialogAPIs - Updated transition definitions from separate
EnterTransition/ExitTransitionto combinedContentTransformtype usingtogetherWith
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle/libs.versions.toml | Updated navigation library versions to navigation3 v1.0.0-alpha06 and adaptive navigation to v1.3.0-alpha01 |
| libraries/designsystem/src/commonMain/kotlin/com/escodro/designsystem/animation/Transitions.kt | Changed transition types from EnterTransition/ExitTransition to ContentTransform using togetherWith operator |
| libraries/appstate/src/commonMain/kotlin/com/escodro/appstate/AlkaaAppState.kt | Replaced NavHostController with NavBackStack, removed flow-based state management |
| libraries/appstate/build.gradle.kts | Updated dependency from compose.navigation to compose.navigation.ui |
| features/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/provider/NavGraph.kt | Changed interface to use EntryProviderScope instead of NavGraphBuilder |
| features/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/destination/Destination.kt | Changed TopLevelDestinations and TopAppBarVisibleDestinations from List to Set |
| features/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/controller/NavBackStack.kt | New class implementing custom navigation back stack with top-level stack management and app bar visibility control |
| features/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/extension/NavHostControllerExtension.kt | Removed obsolete extension functions for NavHostController |
| features/navigation-api/build.gradle.kts | Updated to navigation3 dependencies (navigation.ui and navigation.adaptive) |
| features/navigation/src/commonMain/kotlin/com/escodro/navigation/provider/NavGraphProvider.kt | Changed to use entryProvider and NavEntry from navigation3 |
| features/navigation/src/commonMain/kotlin/com/escodro/navigation/compose/Navigation.kt | Replaced NavHost with NavDisplay, updated navigation logic to use NavBackStack methods |
| features/navigation/build.gradle.kts | Updated to use compose.navigation.ui dependency |
| features/home/src/commonMain/kotlin/com/escodro/home/presentation/HomeScreen.kt | Removed lifecycle-based state collection, now directly accesses NavBackStack properties |
| features/task/src/commonMain/kotlin/com/escodro/task/navigation/TaskNavGraph.kt | Migrated to entry API with EntryProviderScope, updated transition specs and dialog strategy |
| features/search/src/commonMain/kotlin/com/escodro/search/navigation/SearchNavGraph.kt | Migrated to entry API with EntryProviderScope |
| features/preference/src/commonMain/kotlin/com/escodro/preference/navigation/PreferenceNavGraph.kt | Migrated to entry API with transition specs using NavDisplay metadata |
| features/category/src/commonMain/kotlin/com/escodro/category/navigation/CategoryNavGraph.kt | Migrated to entry API with DialogSceneStrategy for bottom sheet |
Comments suppressed due to low confidence (1)
libraries/designsystem/src/commonMain/kotlin/com/escodro/designsystem/animation/Transitions.kt:39
- The variable is named
SlideOutHorizontallyTransition(suggesting exit/slide-out behavior), but the documentation states it "slides from the right to the left" which describes enter behavior. With the newContentTransformtype that combines both enter and exit transitions, the name and documentation are now misleading. Consider renaming to something likeHorizontalContentTransitionor updating the documentation to clarify that this ContentTransform usesEnterTransition.Nonewith a slide-out animation.
/**
* Transition used to slide out horizontally the content. The content will slide from the right to
* the left and fade out.
*/
val SlideOutHorizontallyTransition: ContentTransform =
EnterTransition.None togetherWith fadeOut() + slideOutHorizontally(
targetOffsetX = { it },
animationSpec = tween(
durationMillis = 300,
easing = LinearEasing,
),
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
libraries/designsystem/src/commonMain/kotlin/com/escodro/designsystem/animation/Transitions.kt
Show resolved
Hide resolved
libraries/appstate/src/commonMain/kotlin/com/escodro/appstate/AlkaaAppState.kt
Outdated
Show resolved
Hide resolved
...es/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/controller/NavBackStack.kt
Show resolved
Hide resolved
...es/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/controller/NavBackStack.kt
Show resolved
Hide resolved
...es/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/destination/Destination.kt
Outdated
Show resolved
Hide resolved
...es/navigation-api/src/commonMain/kotlin/com/escodro/navigationapi/controller/NavBackStack.kt
Outdated
Show resolved
Hide resolved
33538c0 to
d47b708
Compare
The code was updated to use the new APIs while keeping the existing event-based navigation structure
d47b708 to
18c6794
Compare
This pull request introduces a major refactor of the navigation system to adopt the new
androidx.navigation3APIs, replacing the previousandroidx.navigationimplementation. The changes include a new customNavBackStackcontroller, updates to navigation graph definitions, and migration of navigation-related UI and logic across features. The update improves navigation state management, composability, and paves the way for modern navigation patterns.Key changes include:
Navigation Infrastructure Overhaul
NavBackStackclass to manage navigation state and back stack, replacing reliance onNavHostControllerand related extensions. This provides direct, type-safe control over navigation flow and top app bar visibility.NavGraph,NavGraphProvider) to useEntryProviderScopeandentryProviderfromandroidx.navigation3, enabling more declarative and composable navigation graph definitions. [1] [2]Feature Navigation Graphs Migration
CategoryNavGraph,PreferenceNavGraph) to use the newentryAPI andEntryProviderScope, replacing the oldcomposableanddialogAPIs. Dialogs and transitions now use the newDialogSceneStrategyandNavDisplay.transitionSpecmechanisms. [1] [2] [3] [4]Home and Navigation UI Updates
HomeScreenand navigation composables to utilize the newNavBackStackfor state, removing previous flows and lifecycle-based state management. The navigation UI now leveragesNavDisplayinstead ofNavHost. [1] [2] [3] [4] [5] [6]API and Dependency Adjustments
androidx.navigation3libraries in Gradle build scripts and feature modules. [1] [2]TopLevelDestinationsandTopAppBarVisibleDestinationsfromListtoSetfor more efficient lookups and to align with new navigation patterns. [1] [2]Cleanup and Removal
These changes modernize the navigation architecture, improve maintainability, and set the foundation for further navigation enhancements.