From 6e94d9ddb2db0209ada92fe14b8c1348d400485d Mon Sep 17 00:00:00 2001 From: soopeach Date: Mon, 18 Sep 2023 15:32:20 +0900 Subject: [PATCH] =?UTF-8?q?[fix/sign=5Fup=5Fflow]:=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EB=90=9C=20=ED=9A=8C=EC=9B=90=20=EA=B0=80=EC=9E=85=20=ED=94=8C?= =?UTF-8?q?=EB=A1=9C=EC=9A=B0=20=EB=94=94=ED=85=8C=EC=9D=BC=ED=95=98?= =?UTF-8?q?=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/gdsc/domain/model/response/TokenResponse.kt | 4 +++- .../java/org/gdsc/presentation/login/LoginFragment.kt | 9 ++++++++- .../java/org/gdsc/presentation/login/LoginViewModel.kt | 3 +-- presentation/src/main/res/navigation/login_nav_graph.xml | 3 +++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/domain/src/main/java/org/gdsc/domain/model/response/TokenResponse.kt b/domain/src/main/java/org/gdsc/domain/model/response/TokenResponse.kt index 2bc17f34..f0839b9a 100644 --- a/domain/src/main/java/org/gdsc/domain/model/response/TokenResponse.kt +++ b/domain/src/main/java/org/gdsc/domain/model/response/TokenResponse.kt @@ -10,5 +10,7 @@ data class TokenResponse( enum class UserLoginAction(val value: String) { SIGN_UP("SIGN_UP"), - LOG_IN("LOG_IN") + LOG_IN("LOG_IN"), + NICKNAME_PROCESS("NICKNAME_PROCESS"), + PROFILE_IMAGE_PROCESS("PROFILE_IMAGE_PROCESS"), } \ No newline at end of file diff --git a/presentation/src/main/java/org/gdsc/presentation/login/LoginFragment.kt b/presentation/src/main/java/org/gdsc/presentation/login/LoginFragment.kt index b292d1b8..96e7f90f 100644 --- a/presentation/src/main/java/org/gdsc/presentation/login/LoginFragment.kt +++ b/presentation/src/main/java/org/gdsc/presentation/login/LoginFragment.kt @@ -105,12 +105,19 @@ class LoginFragment : Fragment() { credential.googleIdToken?.let { viewModel.postSignUpWithGoogleToken(it) { tokenResponse -> when (tokenResponse.userLoginAction) { - UserLoginAction.SIGN_UP.value -> { + UserLoginAction.SIGN_UP.value, + UserLoginAction.NICKNAME_PROCESS.value -> { val action = LoginFragmentDirections.actionLoginFragmentToSignUpNicknameFragment() findNavController().navigate(action) } + UserLoginAction.PROFILE_IMAGE_PROCESS.value -> { + val action = + LoginFragmentDirections.actionLoginFragmentToSignUpCompleteFragment() + findNavController().navigate(action) + } + UserLoginAction.LOG_IN.value -> { val intent = Intent(requireContext(), MainActivity::class.java) startActivity(intent) diff --git a/presentation/src/main/java/org/gdsc/presentation/login/LoginViewModel.kt b/presentation/src/main/java/org/gdsc/presentation/login/LoginViewModel.kt index bb688001..bec31799 100644 --- a/presentation/src/main/java/org/gdsc/presentation/login/LoginViewModel.kt +++ b/presentation/src/main/java/org/gdsc/presentation/login/LoginViewModel.kt @@ -75,7 +75,6 @@ class LoginViewModel @Inject constructor( fun requestSignUpWithImage(file: MultipartBody.Part, afterSuccessSignUp: () -> Unit) { viewModelScope.launch { postProfileImageUseCase(file) - postNicknameUseCase(nicknameState.value) afterSuccessSignUp() } } @@ -83,7 +82,6 @@ class LoginViewModel @Inject constructor( fun requestSignUpWithoutImage(afterSuccessSignUp: () -> Unit) { viewModelScope.launch { postDefaultProfileImageUseCase() - postNicknameUseCase(nicknameState.value) afterSuccessSignUp() } } @@ -95,6 +93,7 @@ class LoginViewModel @Inject constructor( viewModelScope.launch { checkDuplicatedNicknameUseCase(nicknameState.value).let { isNotDuplicated -> if (isNotDuplicated) { + postNicknameUseCase(nicknameState.value) onNicknameIsNotDuplicated() } else { onNicknameIsDuplicated() diff --git a/presentation/src/main/res/navigation/login_nav_graph.xml b/presentation/src/main/res/navigation/login_nav_graph.xml index 579e9a13..0cffb964 100644 --- a/presentation/src/main/res/navigation/login_nav_graph.xml +++ b/presentation/src/main/res/navigation/login_nav_graph.xml @@ -13,6 +13,9 @@ +