Conversation
Summary of ChangesHello @dturner, 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 undertakes a significant refactoring of the JetNews application's navigation architecture. It transitions the app to use the experimental Nav3 library, which brings a new paradigm for handling navigation state and screen composition. This migration also includes a robust deep linking mechanism, allowing external links to directly access specific content within the application, improving user experience and external integration. Highlights
🧠 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. Changelog
Activity
Using Gemini Code AssistThe 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
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 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request migrates the app's navigation from Navigation-Compose to the new Nav3 library, including updates to deep linking. The changes are extensive, touching dependency management, AndroidManifest, and core navigation logic. While the migration is well-underway, I've identified a critical issue in the new deep link handling that could cause crashes, a high-severity issue with inconsistent navigation logic for top-level destinations, and a medium-severity suggestion to clean up unused dependencies. Addressing these points will improve the robustness and correctness of the new navigation implementation.
| data.queryParametersMap.forEach { query -> | ||
| val queryName = query.key | ||
| val queryValue = query.value | ||
| val queryStringParser = pattern.queryValueParsers[queryName] ?: error("Could not get parser for query with name: $queryName") | ||
| if (queryValue == null){ | ||
| error("Query value: $queryValue was null") | ||
| } else { | ||
| val queryParsedValue = queryStringParser.invoke(queryValue) | ||
| args[queryName] = queryParsedValue | ||
| } | ||
| } |
There was a problem hiding this comment.
The current implementation for matching query parameters will cause the app to crash if the incoming deep link URI contains any query parameters not explicitly defined in the DeepLinkPattern (e.g., analytics parameters like utm_source). This is because it iterates over all parameters from the incoming URI and calls error() for any unknown ones.
The logic should be inverted: iterate over the expected parameters defined in pattern.queryValueParsers and attempt to find their values in the incoming URI. This makes the matching more robust by ignoring extraneous parameters.
pattern.queryValueParsers.forEach { (queryName, parser) ->
data.getQueryParameter(queryName)?.let { queryValue ->
val queryParsedValue = parser.invoke(queryValue)
args[queryName] = queryParsedValue
}
}| fun toInterests() { | ||
| if (state.currentKey == InterestsKey) return | ||
| state.currentKeys.add(InterestsKey) | ||
| } |
There was a problem hiding this comment.
The navigation logic for toInterests is inconsistent with toHome. While toHome clears the navigation stack to switch to the home tab (which is typical for top-level destinations in a drawer or bottom bar), toInterests simply pushes the destination onto the current stack.
This creates an inconsistent user experience and back stack management. For a top-level destination like 'Interests', the behavior should be similar to 'Home', replacing the stack to perform a tab switch.
fun toInterests() {
if (state.currentKey == InterestsKey) return
state.currentKeys.clear()
state.currentKeys.add(InterestsKey)
state.backStacks[InterestsKey::class.toString()]?.apply {
if (isEmpty()) {
add(InterestsKey)
}
}
}| implementation(libs.androidx.lifecycle.viewModelCompose) | ||
| implementation(libs.androidx.lifecycle.runtime.compose) | ||
| implementation(libs.androidx.lifecycle.viewmodel.navigation3) | ||
| implementation(libs.androidx.navigation.compose) |
There was a problem hiding this comment.
With the migration to Nav3, it appears the navigation-compose library is no longer used. The previous usages like NavHost, rememberNavController, and currentBackStackEntryAsState have been replaced with Nav3 equivalents. It's good practice to remove unused dependencies to keep the project clean and reduce the app size.
No description provided.