From 4119f2f5ffa5f736523aa059bd0eb6548d5dc3b1 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Mon, 28 Aug 2023 22:16:10 +0900 Subject: [PATCH] =?UTF-8?q?[feature/login=5Fterm]=20=EC=95=BD=EA=B4=80?= =?UTF-8?q?=EB=8F=99=EC=9D=98=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/login/CertificationScreen.kt | 12 ++-- .../presentation/ui/login/LoginActivity.kt | 7 +++ .../presentation/ui/login/TermScreen.kt | 57 +++++++++++++++++++ presentation/src/main/res/values/strings.xml | 3 + 4 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 presentation/src/main/java/com/meongmoryteam/presentation/ui/login/TermScreen.kt diff --git a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/CertificationScreen.kt b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/CertificationScreen.kt index c5cf88f..e4b581a 100644 --- a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/CertificationScreen.kt +++ b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/CertificationScreen.kt @@ -27,7 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel -import androidx.navigation.NavHostController +import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController import com.meongmoryteam.presentation.R import com.meongmoryteam.presentation.base.TextButtonComponent @@ -38,9 +38,11 @@ import com.meongmoryteam.presentation.ui.theme.LightGrey import com.meongmoryteam.presentation.ui.theme.NotoSansKR import com.meongmoryteam.presentation.ui.theme.Orange import com.meongmoryteam.presentation.ui.theme.Typography +import kotlinx.coroutines.flow.collectLatest @Composable fun CertificationScreen( + navController: NavController, loginViewModel: LoginViewModel = hiltViewModel(), navigateToTermScreen: () -> Unit, ) { @@ -80,10 +82,10 @@ fun CertificationScreen( } LaunchedEffect(key1 = loginViewModel.effect) { - loginViewModel.effect.collect { effect -> + loginViewModel.effect.collectLatest { effect -> when (effect) { is LoginContract.LoginEffect.MoveToTerm -> { - navigateToTermScreen() + navController.navigate(LoginNaviRoute.TermScreen.route) } is LoginContract.LoginEffect.FailCertification -> { /* @@ -216,7 +218,9 @@ fun LoginPhoneTextField( @Preview @Composable fun LoginScreenPreview() { - CertificationScreen() { + CertificationScreen( + navController = rememberNavController(), + ) { } } \ No newline at end of file diff --git a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt index 872fc03..3b0c91a 100644 --- a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt +++ b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/LoginActivity.kt @@ -55,8 +55,15 @@ fun LoginNavigation( ) { composable(route = LoginNaviRoute.CertificationScreen.route) { CertificationScreen( + navController = navController, navigateToTermScreen = { navController.navigate(LoginNaviRoute.TermScreen.route) } ) } + composable(route = LoginNaviRoute.TermScreen.route) { + TermScreen( + navigateToPreviousScreen = { }, + navigateToNicknameScreen = { } + ) + } } } \ No newline at end of file diff --git a/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/TermScreen.kt b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/TermScreen.kt new file mode 100644 index 0000000..4aaa7a6 --- /dev/null +++ b/presentation/src/main/java/com/meongmoryteam/presentation/ui/login/TermScreen.kt @@ -0,0 +1,57 @@ +package com.meongmoryteam.presentation.ui.login + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.meongmoryteam.presentation.R + +@Composable +fun TermScreen( + navigateToPreviousScreen: () -> Unit, + navigateToNicknameScreen: () -> Unit +) { + Column( + modifier = Modifier + .fillMaxSize() + .background(Color.White) + ) { + TermTitle() + TermContent() + } +} + +@Composable +fun TermTitle() { + Icon( + modifier = Modifier.padding(12.dp), + painter = painterResource(R.drawable.ic_left_btn), + contentDescription = stringResource(R.string.term_back_button), + ) + Text( + modifier = Modifier + .fillMaxWidth(), + textAlign = TextAlign.Center, + text = stringResource(R.string.term_title), + ) +} + +@Preview +@Composable +fun TermContent() { + TermScreen( + navigateToPreviousScreen = {}, + navigateToNicknameScreen = {} + ) +} \ No newline at end of file diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index b2d5d21..6919bec 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -112,6 +112,9 @@ 인증 요청 다음 + 약관동의 닫기 버튼 + 약관동의 + 네트워크 에러가 발생하였습니다. \ No newline at end of file