Skip to content
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

fix bug when navigating to preview from settings screen #28

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/src/main/java/com/google/jetpackcamera/ui/JcaApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ private fun JetpackCameraNavHost(
onNavigateToSettings = { navController.navigate(SettingsRoute) }
)
}
composable(SettingsRoute) { SettingsScreen(navController = navController) }
composable(SettingsRoute) {
SettingsScreen(onNavigateToPreview = { navController.navigate(PreviewRoute) }
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.google.jetpackcamera.settings.ui.DarkModeSetting
import com.google.jetpackcamera.settings.ui.DefaultCameraFacing
import com.google.jetpackcamera.settings.ui.FlashModeSetting
Expand All @@ -41,7 +40,7 @@ private const val TAG = "SettingsScreen"
@Composable
fun SettingsScreen(
viewModel: SettingsViewModel = hiltViewModel(),
navController: NavController) {
onNavigateToPreview: () -> Unit ) {
val settingsUiState by viewModel.settingsUiState.collectAsState()

Column(
Expand All @@ -50,9 +49,7 @@ fun SettingsScreen(
) {
SettingsPageHeader(
title = stringResource(id = R.string.settings_title),
navBack = {
navController.popBackStack()
}
navBack = onNavigateToPreview
)
SettingsList(uiState = settingsUiState, viewModel = viewModel)
}
Expand Down