Skip to content

Commit

Permalink
Merge pull request #75 from team-JMT/fix/sign_up_flow
Browse files Browse the repository at this point in the history
변경된 회원 가입 플로우 디테일하게 변경
  • Loading branch information
dogdduddy authored Sep 23, 2023
2 parents a7479da + 6e94d9d commit 174eb8c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ class LoginViewModel @Inject constructor(
fun requestSignUpWithImage(file: MultipartBody.Part, afterSuccessSignUp: () -> Unit) {
viewModelScope.launch {
postProfileImageUseCase(file)
postNicknameUseCase(nicknameState.value)
afterSuccessSignUp()
}
}

fun requestSignUpWithoutImage(afterSuccessSignUp: () -> Unit) {
viewModelScope.launch {
postDefaultProfileImageUseCase()
postNicknameUseCase(nicknameState.value)
afterSuccessSignUp()
}
}
Expand All @@ -95,6 +93,7 @@ class LoginViewModel @Inject constructor(
viewModelScope.launch {
checkDuplicatedNicknameUseCase(nicknameState.value).let { isNotDuplicated ->
if (isNotDuplicated) {
postNicknameUseCase(nicknameState.value)
onNicknameIsNotDuplicated()
} else {
onNicknameIsDuplicated()
Expand Down
3 changes: 3 additions & 0 deletions presentation/src/main/res/navigation/login_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<action
android:id="@+id/action_loginFragment_to_signUpNicknameFragment"
app:destination="@id/signUpNicknameFragment" />
<action
android:id="@+id/action_loginFragment_to_signUpCompleteFragment"
app:destination="@id/signUpCompleteFragment" />
</fragment>
<fragment
android:id="@+id/signUpNicknameFragment"
Expand Down

0 comments on commit 174eb8c

Please sign in to comment.