Skip to content

Commit

Permalink
fix bug that doesnt let you navigate back to preview from settings sc…
Browse files Browse the repository at this point in the history
…reen after using a quick setting that rebinds use cases
  • Loading branch information
Kimblebee committed Jul 27, 2023
1 parent 0b525e4 commit 9ab6afc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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

0 comments on commit 9ab6afc

Please sign in to comment.