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

[Feat/#10] 7주차 필수과제 #11

Merged
merged 9 commits into from
Jan 3, 2024
Merged

[Feat/#10] 7주차 필수과제 #11

merged 9 commits into from
Jan 3, 2024

Conversation

chanubc
Copy link
Contributor

@chanubc chanubc commented Dec 22, 2023

📌𝘐𝘴𝘴𝘶𝘦𝘴

📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯

  • 회원가입 페이지 uiState적용
  • 로그인 페이지 uiState 적용

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

KakaoTalk_20231222_192802737.mp4

💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴

@chanubc chanubc added the 📕 필수 과제 필수 과제 label Dec 22, 2023
@chanubc chanubc requested a review from a team December 22, 2023 10:28
@chanubc chanubc self-assigned this Dec 22, 2023
Copy link

@m6z1 m6z1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

찬우빙봉 8주동안 고생많아써요 ~~~~😁

Copy link

@codingmy codingmy left a 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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 이건 뭐죠

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

새로운 상태를 업데이트 하는 것 같네요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞습니다! 서버로부터 userInfo를 받게 되면 오브젝트에 저장하는 방식입니다! copy는 매핑함수에요!

Copy link

@librarywon librarywon left a 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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

새로운 상태를 업데이트 하는 것 같네요

Comment on lines 13 to 16
@POST("api/v1/members")
fun signUp(
suspend fun signUp(
@Body request: RequestSignUpDto,
): Call<Unit>
): Response<Unit>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 코드리뷰에서도 언급하였는데 함수 이름이 길어지더라도 직관적이고 정확한 이름을 제시해주면 좋습니다.
제가 스터디 하였던 클린코드에서는 함수의 이름 시작을 동사로 제시하라고 적혀있는데요
postSignUp으로 함수 이름을 변경하는 것은 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 중요한 부분을 놓쳤네요! 감사합니다!!

Copy link
Contributor Author

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)

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 은 실제로 서버와 통신을 진행하는 동안 스캘레톤 로딩을 보여주거나 로딩 화면을 보여줄 때를 주로 정의합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네! 그래서 loading state에서 불필요하게 toast가 띄워지는 형식이긴 하네요,,

Copy link

@sohyun127 sohyun127 left a 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 {

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 {

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)를 활용해 볼 수 있지 않을까요~~

Copy link
Contributor Author

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수명은 동사 혹은 동사구를 사용하라.(postPayment, deletePayment, deletePage, save 등) - 클린코드

Copy link

@librarywon librarywon Jan 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postUser가 좋겠군요

Copy link
Contributor Author

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sharedFlow가 아닌 stateFlow를 사용하신 이유가 무엇일까요~~

Copy link
Contributor Author

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로 작성하였습니다!

아직 차이를 잘 모르겠네요ㅠㅠ

Comment on lines +39 to +42
id = binding.editId.text.toString(),
pwd = binding.editPwd.text.toString(),
nickName = binding.editNickname.text.toString(),
mbti = binding.editMbti.text.toString(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 값들을 viewModel이 가지고 있는건 어떻게 생각하시나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래 함수에서 뷰모델로 전달하긴 했습니다..! 아니면 양방향 데이터 통신 말씀하신 걸까요?

@chanubc chanubc merged commit dc13bac into develop Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📕 필수 과제 필수 과제
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[7차 세미나] : 필수과제
5 participants