Skip to content

Replace Nav2 with Nav3: Part 1#594

Draft
Iannnr wants to merge 15 commits intoimashnake0:mainfrom
Iannnr:IR/nav3-framework
Draft

Replace Nav2 with Nav3: Part 1#594
Iannnr wants to merge 15 commits intoimashnake0:mainfrom
Iannnr:IR/nav3-framework

Conversation

@Iannnr
Copy link
Copy Markdown
Collaborator

@Iannnr Iannnr commented Mar 3, 2026

Summary of changes:

  • Each screen is now internal & provided by hilt (can also be done with koin so still KMP compliant-ish for now)
  • NavigationBarPaths was naughty and had too many responsibilities
  • All navigation is now provided by the Navigator class, similar to the nav3 class, but it's just a wrapper around a statelist
  • Deep links currently broken because they have to be parsed manually in nav3
  • the nav stack is now flattened, so removed a lot of logic with destinations, nested graphs, etc

Tested changes:

  1. Navigation bar reappears after a non-root screen is popped
  2. Nested screens, like Media, Search result, Settings etc, can be navigated to
  3. Shared Transition still applies to MediaPage
  4. Forward & Backwards navigation is animated
  5. Bottom sheets still show
  6. Tested Profile logout & login so deep links are good enough

Iannnr added 3 commits March 3, 2026 23:38
* Each screen is now internal & provided by hilt (can also be done with koin so still KMP compliant-ish for now)
* NavigationBarPaths was naughty and had too many responsibilities
* All navigation is now provided by the Navigator class, similar to the nav3 class, but it's just a wrapper around a statelist
* Deep links currently broken because they have to be parsed manually in nav3
* the nav stack is now flattened, so removed a lot of logic with destinations, nested graphs, etc
# Conflicts:
#	anime/src/main/kotlin/com/imashnake/animite/anime/AnimeViewModel.kt
#	app/src/main/kotlin/com/imashnake/animite/features/MainActivity.kt
#	manga/src/main/kotlin/com/imashnake/animite/manga/MangaViewModel.kt
#	media/src/main/kotlin/com/imashnake/animite/media/MediaPage.kt
#	navigation/build.gradle.kts
#	navigation/src/main/kotlin/com/imashnake/animite/navigation/NavigationBar.kt
#	navigation/src/main/kotlin/com/imashnake/animite/navigation/NavigationBarPaths.kt
#	navigation/src/main/kotlin/com/imashnake/animite/navigation/NavigationRail.kt
#	settings/src/main/kotlin/com/imashnake/animite/settings/SettingsPage.kt
Comment thread app/src/main/kotlin/com/imashnake/animite/features/MainActivity.kt
Comment thread app/build.gradle.kts Outdated
Comment thread app/src/main/kotlin/com/imashnake/animite/ApplicationModule.kt Outdated
}

@Composable
private fun getTopRightRadius(): Int {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

definitely wasn't AI

Comment thread navigation/src/main/kotlin/com/imashnake/animite/navigation/AnimatedAnimeIcon.kt Outdated
Comment thread navigation/build.gradle.kts Outdated
Comment thread profile/build.gradle.kts Outdated
Comment thread social/build.gradle.kts Outdated
Comment thread settings/build.gradle.kts Outdated
@Iannnr Iannnr marked this pull request as ready for review March 4, 2026 01:46
Comment thread app/src/main/kotlin/com/imashnake/animite/features/MainActivity.kt
mediaType = mediaType.rawValue,
title = title,
)
val route = MediaPage(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

decided that we should rename these to _Route classes, maybe another day

Comment thread app/src/main/kotlin/com/imashnake/animite/features/MainActivity.kt
sharedTransitionScope: SharedTransitionScope,
animatedVisibilityScope: AnimatedVisibilityScope,
viewModel: MediaPageViewModel,
deviceScreenCornerRadius: Int = getTopRightRadius(),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

don't think this needs to be passed as param anymore?

val selected = remember(destination, currentBackStackEntry) {
currentBackStackEntry?.let { destination.matchesDestination(it) } == true
}
val isSelected = backStack.contains(destination.route)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Given these are root paths, and when we navigate to a root path we clear the stack, this is simple enough

Comment thread navigation/build.gradle.kts
Comment thread settings/src/main/kotlin/com/imashnake/animite/settings/SettingsPage.kt Outdated
@Iannnr Iannnr requested review from boswelja and imashnake0 and removed request for boswelja March 6, 2026 22:16
Comment thread navigation/build.gradle.kts
@Iannnr Iannnr requested a review from boswelja March 6, 2026 22:39
@boswelja boswelja marked this pull request as draft March 8, 2026 02:22
Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

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

detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

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