-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Jetsurvey] Changed to use Navigation Compose #1059
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
This comment was marked as resolved.
This comment was marked as resolved.
ace160e
to
c77fb01
Compare
This eliminates all fragments in favor of navigating at the composable level. I also updated the screen-level composables to take in explicit lambdas rather than event handlers to follow best practices. One notable change here is that there is no longer a fragment from which to launch the camera. Instead, the PhotoQuestion uses rememberLauncherForActivityResult and selfies are now stored in the app's cache directory, which means no file permission is required.
c77fb01
to
d557d6a
Compare
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.
How satisfying was it to remove all those Fragments?? 😛
I just had one comment about scoping the ViewModel within individual screens so that the NavHost doesn't need to concern itself with that logic.
val welcomeViewModel: WelcomeViewModel = viewModel(factory = WelcomeViewModelFactory()) | ||
WelcomeScreen( | ||
onSignInSignUp = { email -> | ||
welcomeViewModel.handleContinue( |
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.
Should this logic should be handled within WelcomeScreen
and JetsurveyNavHost
? This way, JetsurveyNavHost
is only concerned with navigation events (i.e. once sign in/up completes and ViewModels would only be scoped within individual screens. Same comment for other screens.
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.
That makes sense. I'll create a route composable for each route that has the logic for getting the view model and any setup needed for the individual screen.
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
This eliminates all fragments in favor of navigating at the composable
level. I also updated the screen-level composables to take in explicit
lambdas rather than event handlers to follow best practices.
One notable change here is that there is no longer a fragment from which
to launch the camera. Instead, the PhotoQuestion uses
rememberLauncherForActivityResult and selfies are now stored in the
app's cache directory, which means no file permission is required.
Fixes #1038