From d7e4aa9719f406fbb678d2af4f22c6ccc2384250 Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Tue, 13 Feb 2024 13:19:29 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix/QA-48:=20=EC=B9=B4=EC=B9=B4=EC=98=A4?= =?UTF-8?q?=ED=86=A1=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=86=A0=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20->=20=EC=88=98=EC=88=98=20=EC=8A=A4=EB=82=B5?= =?UTF-8?q?=EB=B0=94,=20=EB=B8=8C=EB=9D=BC=EC=9A=B0=EC=A0=80=20=EB=AF=B8?= =?UTF-8?q?=20=EC=84=A4=EC=B9=98=20=EC=BC=80=EC=9D=B4=EC=8A=A4=20=EB=8C=80?= =?UTF-8?q?=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../loginsignup/login/LoginContract.kt | 18 ++++----- .../feature/loginsignup/login/LoginScreen.kt | 40 +++++++++++++++---- .../loginsignup/login/LoginViewModel.kt | 34 ++++++++-------- .../navigation/LoginSignupNavigation.kt | 5 ++- .../src/main/res/values/strings.xml | 4 ++ .../com/susu/feature/navigator/MainScreen.kt | 2 +- 6 files changed, 66 insertions(+), 37 deletions(-) diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginContract.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginContract.kt index 3eea0872..c22a5b99 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginContract.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginContract.kt @@ -3,14 +3,12 @@ package com.susu.feature.loginsignup.login import com.susu.core.ui.base.SideEffect import com.susu.core.ui.base.UiState -sealed interface LoginContract { - sealed class LoginEffect : SideEffect { - data object NavigateToReceived : LoginEffect() - data object NavigateToSignUp : LoginEffect() - data class ShowToast(val msg: String) : LoginEffect() - } - - data class LoginState( - val isLoading: Boolean = false, - ) : UiState +sealed interface LoginEffect : SideEffect { + data object NavigateToReceived : LoginEffect + data object NavigateToSignUp : LoginEffect + data class ShowSnackBar(val message: String) : LoginEffect } + +data class LoginState( + val isLoading: Boolean = false, +) : UiState diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginScreen.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginScreen.kt index f045fc2c..c9ab7d72 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginScreen.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginScreen.kt @@ -1,6 +1,5 @@ package com.susu.feature.loginsignup.login -import android.widget.Toast import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.tween @@ -24,7 +23,6 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -37,11 +35,16 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.kakao.sdk.common.model.AuthError +import com.kakao.sdk.common.model.AuthErrorCause +import com.kakao.sdk.common.model.ClientError +import com.kakao.sdk.common.model.ClientErrorCause import com.susu.core.designsystem.component.screen.LoadingScreen import com.susu.core.designsystem.theme.Gray10 import com.susu.core.designsystem.theme.Gray50 import com.susu.core.designsystem.theme.Orange60 import com.susu.core.designsystem.theme.SusuTheme +import com.susu.core.ui.SnackbarToken import com.susu.core.ui.SnsProviders import com.susu.core.ui.extension.susuClickable import com.susu.feature.loginsignup.R @@ -50,11 +53,12 @@ import com.susu.feature.loginsignup.social.KakaoLoginHelper @Composable fun LoginRoute( viewModel: LoginViewModel = hiltViewModel(), + onShowSnackBar: (SnackbarToken) -> Unit, navigateToReceived: () -> Unit, navigateToSignUp: () -> Unit, ) { val context = LocalContext.current - val uiState by viewModel.uiState.collectAsStateWithLifecycle() + val uiState = viewModel.uiState.collectAsStateWithLifecycle().value val transitionState = remember { MutableTransitionState(false).apply { targetState = true @@ -64,9 +68,9 @@ fun LoginRoute( LaunchedEffect(key1 = viewModel.sideEffect) { viewModel.sideEffect.collect { sideEffect -> when (sideEffect) { - is LoginContract.LoginEffect.ShowToast -> Toast.makeText(context, sideEffect.msg, Toast.LENGTH_SHORT).show() - LoginContract.LoginEffect.NavigateToReceived -> navigateToReceived() - LoginContract.LoginEffect.NavigateToSignUp -> navigateToSignUp() + is LoginEffect.ShowSnackBar -> onShowSnackBar(SnackbarToken(message = sideEffect.message)) + LoginEffect.NavigateToReceived -> navigateToReceived() + LoginEffect.NavigateToSignUp -> navigateToSignUp() } } } @@ -78,7 +82,27 @@ fun LoginRoute( KakaoLoginHelper.login( context = context, onSuccess = { viewModel.login(SnsProviders.Kakao, it) }, - onFailed = { viewModel.showToast(it) }, + onFailed = { + val message = when (it) { + is ClientError -> { + when (it.reason) { + ClientErrorCause.NotSupported -> context.getString(R.string.login_snackbar_kakaotalk_broswer_not_found) + ClientErrorCause.Cancelled -> context.getString(R.string.login_snackbar_login_cancelled) + else -> context.getString(R.string.login_snackbar_unknown_error) + } + } + + is AuthError -> { + when (it.reason) { + AuthErrorCause.ServerError -> context.getString(R.string.login_snackbar_kakao_server_error) + else -> context.getString(R.string.login_snackbar_unknown_error) + } + } + + else -> context.getString(R.string.login_snackbar_unknown_error) + } + viewModel.showSnackBar(message) + }, ) }, ) @@ -86,7 +110,7 @@ fun LoginRoute( @Composable fun LoginScreen( - uiState: LoginContract.LoginState = LoginContract.LoginState(), + uiState: LoginState = LoginState(), transitionState: MutableTransitionState = MutableTransitionState(true), onLoginClick: () -> Unit = {}, ) { diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginViewModel.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginViewModel.kt index 15551eff..c1e7f6e6 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginViewModel.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/login/LoginViewModel.kt @@ -1,6 +1,7 @@ package com.susu.feature.loginsignup.login import androidx.lifecycle.viewModelScope +import com.susu.core.model.exception.UnknownException import com.susu.core.ui.SnsProviders import com.susu.core.ui.base.BaseViewModel import com.susu.domain.usecase.loginsignup.CheckCanRegisterUseCase @@ -13,30 +14,31 @@ import javax.inject.Inject class LoginViewModel @Inject constructor( private val checkCanRegisterUseCase: CheckCanRegisterUseCase, private val loginUseCase: LoginUseCase, -) : BaseViewModel(LoginContract.LoginState()) { +) : BaseViewModel(LoginState()) { fun login(provider: SnsProviders, oauthAccessToken: String) { viewModelScope.launch { intent { copy(isLoading = true) } // 수수 서버에 가입되지 않은 회원이라면 -> 회원 정보 기입 후 수수 회원가입 - checkCanRegisterUseCase(provider = provider.path, oauthAccessToken = oauthAccessToken).onSuccess { canRegister -> - if (canRegister) { - postSideEffect(LoginContract.LoginEffect.NavigateToSignUp) - } else { - loginUseCase(provider = provider.path, oauthAccessToken = oauthAccessToken) - .onSuccess { - postSideEffect(LoginContract.LoginEffect.NavigateToReceived) - } - .onFailure { - postSideEffect(LoginContract.LoginEffect.ShowToast(it.message ?: "수수 로그인에 실패했어요")) - } + checkCanRegisterUseCase(provider = provider.path, oauthAccessToken = oauthAccessToken) + .onSuccess { canRegister -> + if (canRegister) { + postSideEffect(LoginEffect.NavigateToSignUp) + } else { + loginUseCase(provider = provider.path, oauthAccessToken = oauthAccessToken) + .onSuccess { + postSideEffect(LoginEffect.NavigateToReceived) + } + .onFailure { + postSideEffect(LoginEffect.ShowSnackBar(message = it.message ?: UnknownException().message)) + } + } + }.onFailure { + postSideEffect(LoginEffect.ShowSnackBar(message = it.message ?: UnknownException().message)) } - } intent { copy(isLoading = false) } } } - fun showToast(error: Throwable?) { - postSideEffect(LoginContract.LoginEffect.ShowToast(error?.message ?: "알 수 없는 에러가 발생했습니다.")) - } + fun showSnackBar(message: String) = postSideEffect(LoginEffect.ShowSnackBar(message = message)) } diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt index cfceb4d3..47659f2c 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt @@ -20,7 +20,7 @@ fun NavGraphBuilder.loginSignupNavGraph( navigateToLogin: () -> Unit, navigateToSignUp: () -> Unit, navigateToReceived: () -> Unit, - onShowToast: (SnackbarToken) -> Unit, + onShowSnackBar: (SnackbarToken) -> Unit, ) { composable(route = LoginSignupRoute.Parent.Vote.route) { VoteRoute( @@ -31,6 +31,7 @@ fun NavGraphBuilder.loginSignupNavGraph( LoginRoute( navigateToReceived = navigateToReceived, navigateToSignUp = navigateToSignUp, + onShowSnackBar = onShowSnackBar ) } composable(route = LoginSignupRoute.Parent.SignUp.route) { @@ -38,7 +39,7 @@ fun NavGraphBuilder.loginSignupNavGraph( padding = padding, navigateToReceived = navigateToReceived, navigateToLogin = navigateToLogin, - onShowToast = onShowToast, + onShowToast = onShowSnackBar, ) } } diff --git a/feature/loginsignup/src/main/res/values/strings.xml b/feature/loginsignup/src/main/res/values/strings.xml index 5ed3527d..a230c3c6 100644 --- a/feature/loginsignup/src/main/res/values/strings.xml +++ b/feature/loginsignup/src/main/res/values/strings.xml @@ -25,4 +25,8 @@ 동의하기 반가워요!\n이름을 알려주세요 아래 정보들을 알려주시면\n통계를 알려드릴 수 있어요 + 카카오톡 또는 브라우저를 설치해주세요 + 로그인을 취소했습니다 + 알 수 없는 에러가 발생했어요 + 카카오톡 서버에서 에러가 발생했어요 diff --git a/feature/navigator/src/main/java/com/susu/feature/navigator/MainScreen.kt b/feature/navigator/src/main/java/com/susu/feature/navigator/MainScreen.kt index 6d7edf89..22d7833a 100644 --- a/feature/navigator/src/main/java/com/susu/feature/navigator/MainScreen.kt +++ b/feature/navigator/src/main/java/com/susu/feature/navigator/MainScreen.kt @@ -79,7 +79,7 @@ internal fun MainScreen( navigateToReceived = navigator::navigateSent, navigateToLogin = navigator::navigateLogin, navigateToSignUp = navigator::navigateSignup, - onShowToast = viewModel::onShowSnackbar, + onShowSnackBar = viewModel::onShowSnackbar, padding = innerPadding, ) From a4e0bed9375677693641c21a26d80821de1e600a Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Tue, 13 Feb 2024 13:26:12 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20Toast=20->=20SnackBar=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD,=20ViewModel=20?= =?UTF-8?q?=ED=95=98=EB=93=9C=EC=BD=94=EB=94=A9=20=EB=AC=B8=EC=9E=90?= =?UTF-8?q?=EC=97=B4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../loginsignup/navigation/LoginSignupNavigation.kt | 4 ++-- .../feature/loginsignup/signup/SignUpContract.kt | 3 ++- .../susu/feature/loginsignup/signup/SignUpScreen.kt | 12 ++++++++++-- .../feature/loginsignup/signup/SignUpViewModel.kt | 5 +++-- feature/loginsignup/src/main/res/values/strings.xml | 1 + 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt index 47659f2c..16fd9ef2 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/navigation/LoginSignupNavigation.kt @@ -31,7 +31,7 @@ fun NavGraphBuilder.loginSignupNavGraph( LoginRoute( navigateToReceived = navigateToReceived, navigateToSignUp = navigateToSignUp, - onShowSnackBar = onShowSnackBar + onShowSnackBar = onShowSnackBar, ) } composable(route = LoginSignupRoute.Parent.SignUp.route) { @@ -39,7 +39,7 @@ fun NavGraphBuilder.loginSignupNavGraph( padding = padding, navigateToReceived = navigateToReceived, navigateToLogin = navigateToLogin, - onShowToast = onShowSnackBar, + onShowSnackbar = onShowSnackBar, ) } } diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt index d9ce2eab..e9b04832 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt @@ -9,7 +9,8 @@ import com.susu.feature.loginsignup.R sealed interface SignUpEffect : SideEffect { data object NavigateToLogin : SignUpEffect data object NavigateToReceived : SignUpEffect - data class ShowToast(val msg: String) : SignUpEffect + data class ShowSnackbar(val msg: String) : SignUpEffect + data object ShowKakaoErrorSnackbar : SignUpEffect } data class SignUpState( diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt index a9cc16d4..7c1004c1 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt @@ -25,6 +25,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.RectangleShape +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -42,6 +43,7 @@ import com.susu.core.designsystem.theme.SusuTheme import com.susu.core.ui.SnackbarToken import com.susu.core.ui.USER_BIRTH_RANGE import com.susu.core.ui.extension.collectWithLifecycle +import com.susu.feature.loginsignup.R import com.susu.feature.loginsignup.signup.content.AdditionalContent import com.susu.feature.loginsignup.signup.content.NameContent import com.susu.feature.loginsignup.signup.content.TermsContent @@ -54,8 +56,9 @@ fun SignUpRoute( termViewModel: TermViewModel = hiltViewModel(), navigateToReceived: () -> Unit, navigateToLogin: () -> Unit, - onShowToast: (SnackbarToken) -> Unit = {}, + onShowSnackbar: (SnackbarToken) -> Unit = {}, ) { + val context = LocalContext.current val uiState: SignUpState by viewModel.uiState.collectAsStateWithLifecycle() val termState: TermState by termViewModel.uiState.collectAsStateWithLifecycle() @@ -69,7 +72,12 @@ fun SignUpRoute( when (sideEffect) { SignUpEffect.NavigateToLogin -> navigateToLogin() SignUpEffect.NavigateToReceived -> navigateToReceived() - is SignUpEffect.ShowToast -> onShowToast(SnackbarToken(message = sideEffect.msg)) + is SignUpEffect.ShowSnackbar -> onShowSnackbar(SnackbarToken(message = sideEffect.msg)) + SignUpEffect.ShowKakaoErrorSnackbar -> onShowSnackbar( + SnackbarToken( + message = context.getString(R.string.signup_snackbar_kakao_login_error), + ), + ) } } diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt index ced62294..ef64c053 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt @@ -2,6 +2,7 @@ package com.susu.feature.loginsignup.signup import androidx.lifecycle.viewModelScope import com.susu.core.model.SignUpUser +import com.susu.core.model.exception.UnknownException import com.susu.core.ui.Gender import com.susu.core.ui.SnsProviders import com.susu.core.ui.USER_NAME_MAX_LENGTH @@ -92,10 +93,10 @@ class SignUpViewModel @Inject constructor( ).onSuccess { postSideEffect(SignUpEffect.NavigateToReceived) }.onFailure { - postSideEffect(SignUpEffect.ShowToast(it.message ?: "에러 발생")) + postSideEffect(SignUpEffect.ShowSnackbar(it.message ?: UnknownException().message)) } } else { - postSideEffect(SignUpEffect.ShowToast("카카오톡 로그인 에러 발생")) + postSideEffect(SignUpEffect.ShowKakaoErrorSnackbar) } intent { copy(isLoading = false) } } diff --git a/feature/loginsignup/src/main/res/values/strings.xml b/feature/loginsignup/src/main/res/values/strings.xml index a230c3c6..7931166a 100644 --- a/feature/loginsignup/src/main/res/values/strings.xml +++ b/feature/loginsignup/src/main/res/values/strings.xml @@ -29,4 +29,5 @@ 로그인을 취소했습니다 알 수 없는 에러가 발생했어요 카카오톡 서버에서 에러가 발생했어요 + 카카오톡 로그인 에러가 발생했어요 From 7a75d72a4fdeed2b7e51bea7a54554b5140aa95b Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Tue, 13 Feb 2024 13:32:35 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EB=82=A0=EC=A7=9C=20=EC=84=A0=ED=83=9D=20=EB=B0=94?= =?UTF-8?q?=ED=85=80=EC=8B=9C=ED=8A=B8=20=EC=83=81=ED=83=9C=EB=A5=BC=20Sig?= =?UTF-8?q?nUpState=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../susu/feature/loginsignup/signup/SignUpContract.kt | 1 + .../susu/feature/loginsignup/signup/SignUpScreen.kt | 10 +++------- .../susu/feature/loginsignup/signup/SignUpViewModel.kt | 3 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt index e9b04832..82ca6c9d 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpContract.kt @@ -21,6 +21,7 @@ data class SignUpState( val isNameValid: Boolean = true, val gender: Gender = Gender.NONE, val birth: Int = -1, + val showDatePicker: Boolean = false, ) : UiState enum class SignUpStep( diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt index 7c1004c1..8fed99d7 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt @@ -19,8 +19,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -62,8 +60,6 @@ fun SignUpRoute( val uiState: SignUpState by viewModel.uiState.collectAsStateWithLifecycle() val termState: TermState by termViewModel.uiState.collectAsStateWithLifecycle() - var showDatePicker by remember { mutableStateOf(false) } - BackHandler { viewModel.goPreviousStep() } @@ -159,7 +155,7 @@ fun SignUpRoute( selectedGender = uiState.gender, selectedYear = uiState.birth, onGenderSelect = viewModel::updateGender, - onYearClick = { showDatePicker = true }, + onYearClick = viewModel::showDatePicker, ) } @@ -177,14 +173,14 @@ fun SignUpRoute( } } - if (showDatePicker) { + if (uiState.showDatePicker) { SusuYearPickerBottomSheet( yearRange = USER_BIRTH_RANGE, reverseItemOrder = true, maximumContainerHeight = 322.dp, onDismissRequest = { viewModel.updateBirth(it) - showDatePicker = false + viewModel.hideDatePicker() }, ) } diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt index ef64c053..7e29ecc9 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpViewModel.kt @@ -19,6 +19,9 @@ class SignUpViewModel @Inject constructor( private val signUpUseCase: SignUpUseCase, ) : BaseViewModel(SignUpState()) { + fun showDatePicker() = intent { copy(showDatePicker = true) } + fun hideDatePicker() = intent { copy(showDatePicker = false) } + fun updateName(name: String) { val trimmedName = name.trim() if (trimmedName.length > USER_NAME_MAX_LENGTH) return From 830ad2771974504a085a9f367a47efba75830759 Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Tue, 13 Feb 2024 13:33:25 +0900 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20unused=20import=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/susu/feature/loginsignup/signup/SignUpScreen.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt index 8fed99d7..1698ead2 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt @@ -19,7 +19,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.RectangleShape