-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/template 194 navigation3 #196
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
base: develop
Are you sure you want to change the base?
Changes from all commits
2c47f7a
e05e859
ebcc340
d348d64
ca7423e
5570d0b
6a97947
cf56233
2922cee
76642d8
ea64991
7ee9c41
14fd165
1bf686e
8ad14af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package nl.q42.template.navigation | ||
|
|
||
| import androidx.navigation3.runtime.EntryProviderScope | ||
| import androidx.navigation3.runtime.NavKey | ||
| import nl.q42.template.home.main.presentation.HomeViewModel | ||
| import nl.q42.template.home.main.ui.HomeScreen | ||
| import nl.q42.template.home.second.presentation.HomeSecondViewModel | ||
| import nl.q42.template.home.second.ui.HomeSecondScreen | ||
| import nl.q42.template.navigation.viewmodel.InitNavigator | ||
| import nl.q42.template.navigation.viewmodel.Navigator | ||
| import org.koin.androidx.compose.koinViewModel | ||
| import org.koin.core.parameter.parametersOf | ||
|
|
||
| internal fun EntryProviderScope<NavKey>.homeEntry(navigator: Navigator) { | ||
| entry<Destination.Home> { key -> | ||
| val viewModel: HomeViewModel = koinViewModel { parametersOf(key) } | ||
| InitNavigator(navigator = navigator, routeNavigator = viewModel) | ||
| HomeScreen(viewModel = viewModel) | ||
| } | ||
| entry<Destination.HomeSecond> { key -> | ||
| val viewModel: HomeSecondViewModel = koinViewModel { parametersOf(key) } | ||
| InitNavigator(navigator = navigator, routeNavigator = viewModel) | ||
| HomeSecondScreen(viewModel = viewModel) | ||
| } | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,18 +1,18 @@ | ||||||
| package nl.q42.template.navigation | ||||||
|
|
||||||
| import androidx.navigation.NavGraphBuilder | ||||||
| import androidx.navigation.NavHostController | ||||||
| import androidx.navigation.compose.composable | ||||||
| import androidx.navigation3.runtime.EntryProviderScope | ||||||
| import androidx.navigation3.runtime.NavKey | ||||||
| import nl.q42.template.navigation.viewmodel.InitNavigator | ||||||
| import nl.q42.template.navigation.viewmodel.Navigator | ||||||
| import nl.q42.template.onboarding.start.presentation.OnboardingStartViewModel | ||||||
| import nl.q42.template.onboarding.start.ui.OnboardingStartScreen | ||||||
| import org.koin.androidx.compose.koinViewModel | ||||||
| import org.koin.core.parameter.parametersOf | ||||||
|
|
||||||
| internal fun NavGraphBuilder.onboardingDestinations(navController: NavHostController) { | ||||||
| composable<Destination.Onboarding> { | ||||||
|
|
||||||
| val viewModel: OnboardingStartViewModel = koinViewModel() | ||||||
| InitNavigator(navController = navController, viewModel) | ||||||
| internal fun EntryProviderScope<NavKey>.onboardingEntry(navigator: Navigator) { | ||||||
| entry<Destination.Onboarding> { key -> | ||||||
| val viewModel: OnboardingStartViewModel = koinViewModel { parametersOf(key) } | ||||||
|
||||||
| val viewModel: OnboardingStartViewModel = koinViewModel { parametersOf(key) } | |
| val viewModel: OnboardingStartViewModel = koinViewModel() |
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
@Providedannotation is being used to mark theparamsparameter, butHomeViewModeldoes not accept aDestination.Homeparameter and will fail when Koin tries to inject it withparametersOf(key). This inconsistency betweenHomeSecondViewModel(which has aparamsparameter) andHomeViewModel(which doesn't) needs to be resolved. Either remove theparametersOf(key)call in HomeEntry.kt for HomeViewModel, or add a@Provided params: Destination.Homeparameter to HomeViewModel if the destination data is needed.