Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

변경된 회원 가입 플로우 디테일하게 변경 #75

Merged
merged 1 commit into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading