-
Notifications
You must be signed in to change notification settings - Fork 226
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
Add watch settings screen with metered data warning #860
Conversation
// Listen for results from streaming confirmation screen | ||
navController.currentBackStackEntry?.savedStateHandle | ||
?.getStateFlow<StreamingConfirmationScreen.Result?>(StreamingConfirmationScreen.resultKey, null) | ||
?.collectAsStateWithLifecycle()?.value?.let { streamingConfirmationResult -> | ||
val viewModel = hiltViewModel<NowPlayingViewModel>() | ||
LaunchedEffect(streamingConfirmationResult) { | ||
viewModel.onStreamingConfirmationResult(streamingConfirmationResult) | ||
// Clear result once consumed | ||
navController.currentBackStackEntry?.savedStateHandle | ||
?.remove<StreamingConfirmationScreen.Result?>(StreamingConfirmationScreen.resultKey) | ||
} | ||
} |
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.
I don't love the boilerplate this requires to get a result from the stream warning screen via the savedStateHandle. This seemed like the best solution though since I can't use a shared view model due to the fact that I need different behavior depending on whether the stream warning is showing from the now playing screen or the episode details screen (now playing plays the currently queued episode, epsidoe details queues and plays the currently viewed episode).
navController.previousBackStackEntry?.savedStateHandle?.set( | ||
StreamingConfirmationScreen.resultKey, | ||
result | ||
) |
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.
This is passing the result of what the user selected back to the previous 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.
Description
Add settings screen for watch app and implements a setting to give a warning before streaming an episode.
Testing Instructions
Screenshots or Screencast
Checklist
modules/services/localization/src/main/res/values/strings.xml
I have tested any UI changes...