From d768d42c946853050209e3d998b6c8d6e827670a Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 25 Aug 2024 15:39:38 +0900 Subject: [PATCH] =?UTF-8?q?[feature]=20=EC=84=A4=EC=A0=95=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EB=92=A4=EB=A1=9C=EA=B0=80=EA=B8=B0=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt | 1 + .../java/pokitmons/pokit/settings/setting/SettingHeader.kt | 6 ++++-- .../java/pokitmons/pokit/settings/setting/SettingsScreen.kt | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt b/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt index 63fa6064..eec5f8d4 100644 --- a/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt +++ b/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt @@ -156,6 +156,7 @@ fun RootNavHost( val viewModel: SettingViewModel = hiltViewModel() SettingsScreen( settingViewModel = viewModel, + onBackPressed = navHostController::popBackStack, onNavigateToEditNickname = { navHostController.navigate(EditNickname.route) }, onNavigateToLogin = { navHostController.navigate(Login.route) { diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt index 66cfe8a7..53a0e259 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt @@ -19,7 +19,9 @@ import pokitmons.pokit.core.ui.R.drawable as DrawableResource import pokitmons.pokit.settings.R.string as StringResource @Composable -fun SettingHeader() { +fun SettingHeader( + onBackPressed: () -> Unit, +) { Box( modifier = Modifier .fillMaxWidth() @@ -31,7 +33,7 @@ fun SettingHeader() { contentDescription = null, modifier = Modifier .align(Alignment.CenterStart) - .noRippleClickable { } + .noRippleClickable { onBackPressed() } .size(24.dp) ) diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt index ce330b9e..a5db85da 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt @@ -25,6 +25,7 @@ fun SettingsScreen( settingViewModel: SettingViewModel, onNavigateToEditNickname: () -> Unit, onNavigateToLogin: () -> Unit, + onBackPressed: () -> Unit, ) { val context = LocalContext.current @@ -38,7 +39,7 @@ fun SettingsScreen( } Column(modifier = Modifier.fillMaxWidth()) { - SettingHeader() + SettingHeader(onBackPressed) Spacer(modifier = Modifier.height(16.dp)) Column(modifier = Modifier.fillMaxWidth()) { SettingItem(title = stringResource(StringResource.nickname_settings)) {