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 @@ +