-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Feat/#6] 1주차 심화과제 (Compose) #8
base: develop-compose
Are you sure you want to change the base?
Conversation
…네비게이션을 통해 부모 컴포저블에서 전달하도록 변경
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// Testing | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: 위에도 테스팅 범주가 있고 아래도 있네요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: 이제 버전 카탈로그의 사용도 고민해보시면 좋을듯?
fun navigateToHome(id: String?, password: String?, nickname: String?, phoneNumber: String?) { | ||
navController.navigate("home/$id/$password/$nickname/$phoneNumber") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: data class를 활용한 네비게이션의 활용도 배워보시면 좋을듯!
} | ||
|
||
private fun signInIdValidation(): Boolean { | ||
return signInId.isNotEmpty() && signInId == _user.value?.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: xml 코드에서 달았던 리뷰와 같은 의미로 달았습니다 :)
private fun setUser() { | ||
_user.value = User( | ||
id = signUpId, | ||
password = signUpPassword, | ||
nickname = signUpNickname, | ||
phoneNumber = signUpPhoneNumber | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: _user를 update하다가 더 적절하게도 보입니다!
|
||
fun onClickSignIn() { | ||
authViewModel.signInValidation() | ||
when (authViewModel.signInState.value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: 분기처리 좋네요 👍
is SignUpState.Success -> { | ||
showToast(context, context.getString(R.string.signup_signup_success)) | ||
authNavigator.navigateToSignIn() | ||
Log.d("user_info", authViewModel.user.value.toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: 로그를 남겨두신 이유가 있나요?
when (authViewModel.signUpState.value) { | ||
is SignUpState.IdInvalid -> { | ||
showToast(context, context.getString(R.string.signup_id_invalid)) | ||
} | ||
|
||
is SignUpState.PasswordInvalid -> { | ||
showToast(context, context.getString(R.string.signup_password_invalid)) | ||
} | ||
|
||
is SignUpState.NicknameInvalid -> { | ||
showToast(context, context.getString(R.string.signup_nickname_invalid)) | ||
} | ||
|
||
is SignUpState.PhoneNumberInvalid -> { | ||
showToast(context, context.getString(R.string.signup_phone_number_invalid)) | ||
} | ||
|
||
is SignUpState.Success -> { | ||
showToast(context, context.getString(R.string.signup_signup_success)) | ||
authNavigator.navigateToSignIn() | ||
Log.d("user_info", authViewModel.user.value.toString()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: 현재 로직에 다른 역할이 부여되는게 아니라면 when문은 showToast의 텍스트만 설정해줘도 괜찮아보임! 선택사항
keyboardOptions = KeyboardOptions.Default.copy(imeAction = ImeAction.Next), | ||
keyboardActions = KeyboardActions(onNext = { nicknameFocusRequester.requestFocus() }) | ||
) | ||
Spacer(modifier = Modifier.height(30.dp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: Spacer의 과한 사용은 안좋을 수 있어요! 이유를 아실까요?!
@@ -0,0 +1,10 @@ | |||
package com.sopt.now.compose.presentation.ui.auth.screen | |||
|
|||
sealed class SignUpState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a: 👍
📌 개요
✨ 작업 내용
Activiy 생명주기 알아보기 - [미완성]
ViewModel을 사용하여 State 관리해보기 - [미완성]
UX 고려하여 기능 추가해보기
✨ PR 포인트
authViewModel: AuthViewModel = hiltViewModel()
을 넘겨주니 각자 다른 객체를 생성해서 user의 value가 공유가 안되더라구요, 그래서 네비게이션의 부모 컴포저블함수에서 넘겨주는 형식으로 해결 했는데 적절한 방법이였는지 확인 부탁드립니다!!!
📸 스크린샷/동영상