-
-
Notifications
You must be signed in to change notification settings - Fork 771
[feat] Navigation3 integration #2302
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for AndroidX Navigation 3 integration in Koin, along with a bug fix for the getAll() function when working with scope archetypes. The changes introduce a new module for Navigation 3 integration and fix an issue where getAll() wasn't properly checking scope archetypes.
- Added new
koin-compose-navigation3module with Navigation 3 integration APIs - Fixed
getAll()to properly resolve instances from scope archetypes - Added comprehensive documentation for Navigation 3 integration
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/settings.gradle.kts | Added koin-compose-navigation3 module to the build |
| projects/gradle/libs.versions.toml | Added Navigation 3 dependency version and library reference |
| projects/gradle.properties | Updated Koin version and added androidComposeMinSDK property |
| projects/core/koin-core/src/commonTest/kotlin/org/koin/core/GetAllTest.kt | Added tests for getAll() functionality with scopes |
| projects/core/koin-core/src/commonMain/kotlin/org/koin/core/scope/Scope.kt | Fixed getAll() to set scopeArchetype in resolution context |
| projects/core/koin-core/src/commonMain/kotlin/org/koin/core/registry/InstanceRegistry.kt | Fixed getAll() filter to check scope archetype |
| projects/core/koin-core/build.gradle.kts | Added JVM toolchain configuration |
| projects/compose/koin-compose-navigation3/src/commonMain/kotlin/org/koin/dsl/navigation3/ModuleExt.kt | New DSL functions for declaring navigation entries |
| projects/compose/koin-compose-navigation3/src/commonMain/kotlin/org/koin/compose/navigation3/EntryProviderInstaller.kt | Type alias for navigation entry installation |
| projects/compose/koin-compose-navigation3/src/commonMain/kotlin/org/koin/compose/navigation3/EntryProvider.kt | EntryProvider implementation and koinEntryProvider composable |
| projects/compose/koin-compose-navigation3/src/androidMain/kotlin/org/koin/androidx/compose/navigation3/ComponentCallbacksExt.kt | Android-specific ComponentCallbacks extensions |
| projects/compose/koin-compose-navigation3/build.gradle.kts | Build configuration for the new module |
| projects/bom/koin-bom/build.gradle.kts | Added navigation3 module to BOM |
| projects/android/koin-android/src/test/java/org/koin/core/scope/ActivityScopeArchetypeTest.kt | Added test for getAll() with activity scope archetypes |
| docs/reference/koin-compose/navigation3.md | Comprehensive documentation for Navigation 3 integration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #Android | ||
| android.useAndroidX=true | ||
| androidMinSDK=21 | ||
| androidComposeMinSDK=23 |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new property androidComposeMinSDK is defined but never used in the codebase. The koin-compose-navigation3 module at line 62 of projects/compose/koin-compose-navigation3/build.gradle.kts uses androidMinSDK instead of androidComposeMinSDK. Either use this property in the appropriate build files or remove it.
| androidComposeMinSDK=23 |
|
|
||
| data class MyScope(val name : String) | ||
|
|
||
| //TODO GetAll sur scope archetype - fail? |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment contains French text 'sur' which should be 'on' in English. Consider changing to '//TODO GetAll on scope archetype - fail?' for consistency with the codebase language.
| //TODO GetAll sur scope archetype - fail? | |
| //TODO GetAll on scope archetype - fail? |
| val activityScope = activity.scope | ||
|
|
||
| val entries = activityScope.getAll<Entry>() | ||
| assertEquals(3,entries.size) |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing space after comma in function arguments. Should be assertEquals(3, entries.size) for consistency with Kotlin code style.
| assertEquals(3,entries.size) | |
| assertEquals(3, entries.size) |
| * @return An [EntryProvider] that combines all registered navigation entries | ||
| * | ||
| * @see entryProvider for lazy initialization | ||
| * @See ComponentCallbacks |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation tag @See should be lowercase @see to match KDoc conventions and be consistent with line 40.
| * @See ComponentCallbacks | |
| * @see ComponentCallbacks |
| }.koin | ||
|
|
||
| val entries = koin.getAll<Entry>() | ||
| assertEquals(3,entries.size) |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing space after comma in function arguments. Should be assertEquals(3, entries.size) for consistency with Kotlin code style.
| assertEquals(3,entries.size) | |
| assertEquals(3, entries.size) |
| }.koin | ||
| val scope = koin.createScope<MyScope>() | ||
| val entries = scope.getAll<Entry>() | ||
| assertEquals(3,entries.size) |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing space after comma in function arguments. Should be assertEquals(3, entries.size) for consistency with Kotlin code style.
| assertEquals(3,entries.size) | |
| assertEquals(3, entries.size) |
| assertEquals(3,entries.size) | ||
| assertEquals((1..3).map { Entry("entry_$it") },entries) |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Missing space after comma in function arguments. Should be assertEquals((1..3).map { Entry(\"entry_$it\") }, entries) for consistency with Kotlin code style.
| assertEquals(3,entries.size) | |
| assertEquals((1..3).map { Entry("entry_$it") },entries) | |
| assertEquals(3, entries.size) | |
| assertEquals((1..3).map { Entry("entry_$it") }, entries) |
pedrofsn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add Navigation 3 Integration for Koin Compose
Overview
Adds support for AndroidX Navigation 3 with type-safe navigation integration for Koin Compose (multiplatform).
What's New
koin-compose-navigation3- Multiplatform Navigation 3 integration@KoinExperimentalAPI- Navigation 3 is currently in betaKey Features
module { navigation<HomeRoute> { route -> HomeScreen(viewModel = koinViewModel()) } }Documentation
documentation in /docs/reference/koin-compose/navigation3.md
Platform Support
Android • JVM • JS • WASM • iOS • macOS
Dependencies Used
Dependencies used:
Fix #2286