From f7e2245dc70bbb8de0ba32a33a5a0a37eabb338a Mon Sep 17 00:00:00 2001 From: ricky_0_k Date: Sun, 30 Apr 2023 20:35:37 +0900 Subject: [PATCH] =?UTF-8?q?bug:=20Screen=20=EC=97=90=EC=84=9C=EB=8A=94=20F?= =?UTF-8?q?inishActivity=20emit=20=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=8C?= =?UTF-8?q?=20&=20FinishActivity=20emit=20=EC=9D=80=20ViewModel=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=A7=8C=20=EC=A7=84=ED=96=89=20(#439)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/create/problem/screen/ExamInformationScreen.kt | 5 ++++- .../ui/create/problem/viewmodel/CreateProblemViewModel.kt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/screen/ExamInformationScreen.kt b/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/screen/ExamInformationScreen.kt index 0b0be16eb..521f68e1c 100644 --- a/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/screen/ExamInformationScreen.kt +++ b/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/screen/ExamInformationScreen.kt @@ -7,6 +7,7 @@ package team.duckie.app.android.feature.ui.create.problem.screen +import android.app.Activity import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.layout.Arrangement @@ -32,6 +33,7 @@ import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.layout.Layout import androidx.compose.ui.layout.layoutId +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction @@ -79,6 +81,7 @@ internal fun ExamInformationScreen( viewModel: CreateProblemViewModel = activityViewModel(), modifier: Modifier, ) { + val activity = LocalContext.current as Activity val state = viewModel.collectAsState().value.examInformation val coroutineScope = rememberCoroutineScope() val focusManager = LocalFocusManager.current @@ -270,7 +273,7 @@ internal fun ExamInformationScreen( rightButtonText = stringResource(id = R.string.ok), rightButtonOnClick = { createProblemExitDialogVisible = false - viewModel.finishCreateProblem() + activity.finish() }, onDismissRequest = { createProblemExitDialogVisible = false }, ) diff --git a/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/viewmodel/CreateProblemViewModel.kt b/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/viewmodel/CreateProblemViewModel.kt index 61fa186d4..9c09a5c8e 100644 --- a/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/viewmodel/CreateProblemViewModel.kt +++ b/feature-ui-create-problem/src/main/kotlin/team/duckie/app/android/feature/ui/create/problem/viewmodel/CreateProblemViewModel.kt @@ -276,7 +276,7 @@ internal class CreateProblemViewModel @Inject constructor( } /** 문제 만들기 화면을 종료한다. */ - internal fun finishCreateProblem() = intent { + private fun finishCreateProblem() = intent { postSideEffect(CreateProblemSideEffect.FinishActivity) }