android / android/nowinandroid
Naming suggestion for {X}Screen to {X}Route
- Dominant language
- Kotlin
- Stars
- 21.8k
- Forks
- 4.6k
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 2
Description
I have a naming suggestion for navigation.
As I see, Nia is following this flow:
**NavHost > Feature Navigation graph/route > Feature Screen Composable**
Example:
**NiaNavHost > forYouScreen > ForYouRoute**
But I think it should be like this:
**NiaNavHost > forYouRoute > ForYouScreen**
We actually tell it to open the target **feature route**; not the **screen**.
The target screen will be shown by the route.
```kotlin
// Current
fun NavGraphBuilder.forYouScreen(onTopicClick: (String) -> Unit) {
composable(
route = forYouNavigationRoute,
deepLinks = listOf(
navDeepLink { uriPattern = DEEP_LINK_URI_PATTERN },
),
arguments = listOf(
navArgument(LINKED_NEWS_RESOURCE_ID) { type = NavType.StringType },
),
) {
ForYouRoute(onTopicClick)
}
}
```
```kotlin
// Should be
fun NavGraphBuilder.forYouRoute(onTopicClick: (String) -> Unit) {
composable(
route = forYouNavigationRoute,
deepLinks = listOf(
navDeepLink { uriPattern = DEEP_LINK_URI_PATTERN },
),
arguments = listOf(
navArgument(LINKED_NEWS_RESOURCE_ID) { type = NavType.StringType },
),
) {
ForYouScreen(onTopicClick)
}
}
```
https://github.com/android/nowinandroid/blob/b989d3a243d09e40fadaba1264ea20d7df89e362/feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt#L37C21-L37C33
Contributor guide
Research direction
Start with feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt at the linked function, then search the repository for similarly named navigation builders and route/screen pairs. Done means the agreed naming convention is applied consistently without changing navigation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100