Skip to content

Migrate Jetnews to Navigation 3#1675

Draft
bsagmoe wants to merge 1 commit intomainfrom
bsagmoe/jetnews-nav3
Draft

Migrate Jetnews to Navigation 3#1675
bsagmoe wants to merge 1 commit intomainfrom
bsagmoe/jetnews-nav3

Conversation

@bsagmoe
Copy link
Contributor

@bsagmoe bsagmoe commented Mar 20, 2026

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents a significant architectural overhaul, migrating the Jetnews application to the experimental Navigation 3 library. This transition fundamentally redefines how the application handles screen transitions, back stacks, and deep linking, moving towards a more robust and type-safe navigation paradigm. The changes also enhance the app's adaptability across various screen sizes, particularly for list-detail patterns, and introduce a more structured approach to managing individual screen states.

Highlights

  • Core Navigation 3 Migration: The application's navigation system has been entirely refactored to utilize the experimental Navigation 3 library, replacing the previous Compose Navigation setup. This introduces a new architecture for managing navigation state and UI.
  • Deep Linking Implementation: A custom deep linking solution has been integrated, leveraging Kotlin Serialization to parse incoming URIs directly into NavKey objects. This enables direct and type-safe navigation to specific content within the app.
  • Adaptive UI Handling: The application now dynamically adapts its UI based on WindowSizeClass, particularly enhancing the display of list-detail views on expanded screens for a more responsive user experience.
  • Modularized Navigation Components: New NavKey objects and entry providers have been introduced for different screens (Home, Interests, Post), promoting a more modular, type-safe, and maintainable navigation graph.
  • Post-Specific ViewModel: A dedicated PostViewModel and PostRoute have been created to manage the state and interactions for individual article screens, including scroll position persistence and favorite status, decoupling it from the main Home ViewModel.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully migrates the Jetnews app to Navigation 3, which is a significant and well-executed undertaking. The changes introduce a type-safe navigation system using NavKey, a custom deep link handling mechanism, and a responsive list-detail layout for large screens using a custom SceneStrategy. The refactoring greatly simplifies the ViewModels by offloading navigation state management to the navigation library. The overall architecture is much cleaner and more robust. I have a few minor suggestions for improvement, mainly related to code style and removing debug logs.

*/
private val regexPatternFillIn = Regex("\\{(.+?)\\}")

// TODO make these lazy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As this TODO suggests, you can make pathSegments and queryValueParsers lazy to defer their initialization until first access. This is a good performance optimization, especially if DeepLinkPattern objects are created frequently but not always used for matching. You can achieve this using the by lazy { ... } delegate.

val pathSegments: List<PathSegment> = buildList {
uriPattern.pathSegments.forEach { segment ->
// first, check if it is a path arg
var result = regexPatternFillIn.find(segment)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The result variable is not reassigned, so it can be declared with val for immutability.

Suggested change
var result = regexPatternFillIn.find(segment)
val result = regexPatternFillIn.find(segment)

Comment on lines +48 to +53
LaunchedEffect(initialBackStack) {
Log.d("MainActivity", "initialBackStack: $initialBackStack")
}

NewIntentEffect { newIntent ->
Log.d("MainActivity", "NewIntentEffect:newIntent: $newIntent")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These Log.d calls appear to be for debugging purposes. It would be good to remove them before this PR is merged to keep the production code clean.

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.

1 participant