Skip to content
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

Use one nav host #111

Closed
wants to merge 9 commits into from
Closed

Use one nav host #111

wants to merge 9 commits into from

Conversation

ashnohe
Copy link
Contributor

@ashnohe ashnohe commented Dec 9, 2024

No description provided.

ashnohe and others added 9 commits December 9, 2024 12:50
* Deduplicate lifecycle runtime compose

* kotlin 2.0 and compose gradle plugin

* update test & other versions

* Call navigate instead of recomposing HavHost

Previously, the app had a NavHost but didn't actually call navigate.
NavHost's startDestination was read from external state (the currently
selected nav item), which led to some undesirable behaviors.
- NavHost itself was recomposed when selecting a nav item.
- Pressing back always exited the app because you were always at the
  start destination.

Now the NavHost has a stable startDestination, and nav item state is
driven by the NavHostController's current destination. Selecting a nav
item calls navigate, and the user always goes back through the
startDestination before exiting the app.

* Use type-safe navigation

* Make a package for navigation routes

* Migrate to type safe routes for main navhost

* Push Scaffold down to each top-level destination

* Extract nav suite scaffold to another composable

* Move ChatList, move and rename HomeViewModel

* Move Settings to its own package

* Remove Home and put its destinations in Main NavHost

* Remove Home composable and rename file

* Add NavigationSuiteScaffold around NavHost

* Change navigation layout type based on current destination
# Conflicts:
#	app/src/main/java/com/google/android/samples/socialite/ui/home/Settings.kt
#	gradle/libs.versions.toml
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* update to target SDK 35 and dependencies

* revert media dependency
* Deduplicate lifecycle runtime compose

* kotlin 2.0 and compose gradle plugin

* update test & other versions

* Call navigate instead of recomposing HavHost

Previously, the app had a NavHost but didn't actually call navigate.
NavHost's startDestination was read from external state (the currently
selected nav item), which led to some undesirable behaviors.
- NavHost itself was recomposed when selecting a nav item.
- Pressing back always exited the app because you were always at the
  start destination.

Now the NavHost has a stable startDestination, and nav item state is
driven by the NavHostController's current destination. Selecting a nav
item calls navigate, and the user always goes back through the
startDestination before exiting the app.

* Use type-safe navigation

* Make a package for navigation routes

* Migrate to type safe routes for main navhost

* Push Scaffold down to each top-level destination

* Extract nav suite scaffold to another composable

* Move ChatList, move and rename HomeViewModel

* Move Settings to its own package

* Remove Home and put its destinations in Main NavHost

* Remove Home composable and rename file

* Add NavigationSuiteScaffold around NavHost

* Change navigation layout type based on current destination
@ashnohe ashnohe closed this Dec 11, 2024
@ashnohe ashnohe deleted the one_nav_host branch December 11, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants