-
Notifications
You must be signed in to change notification settings - Fork 1
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/#10] 7주차 필수과제 #11
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.
찬우빙봉 8주동안 고생많아써요 ~~~~😁
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.
원온원 하고 와서 코리 자세히 봐볼게용~!!
진짜진짜 고생 많았구!!!!! 앱잼팀 가서 우리 빙봉들 까먹으면 찾아갑니다요?
nickName: String = userInfoList.nickName, | ||
mbti: String = userInfoList.mbti, | ||
) { | ||
userInfoList = userInfoList.copy(id = id, pwd = pwd, nickName = nickName, mbti = mbti) |
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.
오 이건 뭐죠
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.
새로운 상태를 업데이트 하는 것 같네요
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.
맞습니다! 서버로부터 userInfo를 받게 되면 오브젝트에 저장하는 방식입니다! copy는 매핑함수에요!
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.
찬우형 진짜 8주 동안 너무 잘 따라오고 잘해줘서 너무 고마워!!!
형이 있어서 진짜 든든하게 우리 코끼리조 달려온 것 같아 앱잼에서도 우리 행복하자 😄
nickName: String = userInfoList.nickName, | ||
mbti: String = userInfoList.mbti, | ||
) { | ||
userInfoList = userInfoList.copy(id = id, pwd = pwd, nickName = nickName, mbti = mbti) |
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.
새로운 상태를 업데이트 하는 것 같네요
@POST("api/v1/members") | ||
fun signUp( | ||
suspend fun signUp( | ||
@Body request: RequestSignUpDto, | ||
): Call<Unit> | ||
): Response<Unit> |
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.
다른 코드리뷰에서도 언급하였는데 함수 이름이 길어지더라도 직관적이고 정확한 이름을 제시해주면 좋습니다.
제가 스터디 하였던 클린코드에서는 함수의 이름 시작을 동사로 제시하라고 적혀있는데요
postSignUp
으로 함수 이름을 변경하는 것은 어떨까요?
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.
헉 중요한 부분을 놓쳤네요! 감사합니다!!
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.
1be6757 수정했습니다
private val _loginSuccess: MutableLiveData<Boolean> = MutableLiveData() | ||
val loginSuccess: LiveData<Boolean> | ||
get() = _loginSuccess | ||
private val _loginState = MutableStateFlow<LoginState>(LoginState.Loading) |
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.
처음 UiState의 기본 상태를 Loading으로 두는 것 같은데 init State
상태를 추가해주시는 것이 좋을 것 같아요
loading State
은 실제로 서버와 통신을 진행하는 동안 스캘레톤 로딩을 보여주거나 로딩 화면을 보여줄 때를 주로 정의합니다.
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.
네네! 그래서 loading state에서 불필요하게 toast가 띄워지는 형식이긴 하네요,,
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.
쿼카햄 굿!-!
|
||
import org.sopt.dosopttemplate.network.login.ResponseLoginDto | ||
|
||
sealed class LoginState { |
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.
요 state들은 Login state라기 보다 ui의 전반적인 state를 다루고 있어 보입니다!
네이밍 ui state로 바꿔도 좋을듯!
login할 때만 필요한 분기처리가 추가로 있다면 그때 따로 만들어주면 될듯 합니다
@@ -0,0 +1,7 @@ | |||
package org.sopt.dosopttemplate.ui.login | |||
|
|||
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.
굳이 SignUpState를 만들지 않아도,
위에서 말했던 ui state(login state)를 활용해 볼 수 있지 않을까요~~
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.
감사합니다 util로 따로 만들어 수정할께요!!
@@ -90,4 +102,26 @@ class SignUpViewModel : ViewModel() { | |||
private fun updateBtnValidity() { | |||
_isBtnSelected.value = isIdValid && isPasswordValid && isNickNameValid && isMbtiValid | |||
} | |||
|
|||
fun signUpServer(userEntity: User) { |
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.
함수명은 동사 혹은 동사구를 사용하라.(postPayment, deletePayment, deletePage, save 등) - 클린코드
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.
postUser가 좋겠군요
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.
수정했습니다!
|
||
class SignUpViewModel : ViewModel() { | ||
private val _signUpState = MutableStateFlow<SignUpState>(SignUpState.Loading) |
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.
sharedFlow가 아닌 stateFlow를 사용하신 이유가 무엇일까요~~
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.
사실 둘의 차이를 모르고 작성했습니다!
각 조건(이름,패스워드,닉네임, mbti)의 여러 경우에 따라 stateflow를 바꾸지 않고, 각 조건의 valid가 모두 true인 경우에만 stateflow에 값을 변경 시키는 구조입니다!
일단은 여러 경우가 아닌 한 가지 경우(조건이 전부 true)에만 한 가지 ui(버튼 색상) 이 변경 된다 생각해서 stateflow로 작성하였습니다!
아직 차이를 잘 모르겠네요ㅠㅠ
id = binding.editId.text.toString(), | ||
pwd = binding.editPwd.text.toString(), | ||
nickName = binding.editNickname.text.toString(), | ||
mbti = binding.editMbti.text.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.
이 값들을 viewModel이 가지고 있는건 어떻게 생각하시나요?
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.
아래 함수에서 뷰모델로 전달하긴 했습니다..! 아니면 양방향 데이터 통신 말씀하신 걸까요?
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
KakaoTalk_20231222_192802737.mp4
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴