Skip to content

Feat/week compose 06#12

Open
hyoeunjoo wants to merge 12 commits into
develop-composefrom
feat/week-compose-06
Open

Feat/week compose 06#12
hyoeunjoo wants to merge 12 commits into
develop-composefrom
feat/week-compose-06

Conversation

@hyoeunjoo
Copy link
Copy Markdown
Collaborator

📌𝘐𝘴𝘴𝘶𝘦𝘴

  • closed #

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

  • Login ViewModel 분리
  • SignUp ViewModel 분리

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

week06.compose.mp4

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

@hyoeunjoo hyoeunjoo requested review from OliviaYJH, cacaocoffee, chanubc and kez-lab and removed request for OliviaYJH and chanubc May 24, 2024 14:02
@hyoeunjoo hyoeunjoo self-assigned this May 24, 2024
Comment on lines +18 to +19
var loginId = mutableStateOf("")
var loginPw = mutableStateOf("")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

recomposition을 위해 이렇게 바꾸는건 어떨까요?

Suggested change
var loginId = mutableStateOf("")
var loginPw = mutableStateOf("")
var loginId by remember { mutableStateOf("") }
var loginPw by remember { mutableStateOf("") }

Comment on lines +39 to +43
Toast.makeText(
context,
"로그인 성공",
Toast.LENGTH_SHORT,
).show()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

뷰모델의 역할에 맞게 토스트 메세지는 뷰에서 띄우면 좋을 것 같아요!

Copy link
Copy Markdown
Member

@cacaocoffee cacaocoffee left a comment

Choose a reason for hiding this comment

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

합세때문에 바쁠텐데도 과제까지 하느라 수고 많으셨습니다! viewmodel 에 통신 로직은 6주차때 배웠던 것들로 바꿔보시길 추천드려요!

Comment on lines +18 to +21
var signupId = mutableStateOf("")
var signupPw = mutableStateOf("")
var signupName = mutableStateOf("")
var signupPhone = mutableStateOf("")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

이 부분도 위에 정현님이 말씀해 주신것처럼 변경하면 좋을거 같아요

Copy link
Copy Markdown
Member

@chanubc chanubc left a comment

Choose a reason for hiding this comment

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

리컴포지션만 주의하면 좋을것 같아요!

나머지는 xml과 동일합니다!

Comment on lines +17 to +20
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

이건 어떤거죠??

request = RequestSignUpDto(
authenticationId = authEntity.id,
password = authEntity.pw,
nickname = authEntity.name ?: "",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
nickname = authEntity.name ?: "",
nickname = authEntity.name.orEmpty(),

쿄틀린의 확장함수도 사용 가능해요!

@GET("member/info")
fun getUserInfo(
@Header("memberId") memberId : Int
): Call<ResponseUserProfile>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

얘도 Response로 바꾸어보야요

Comment on lines +90 to +91
value = viewModel.loginId.value,
onValueChange = { viewModel.loginId.value = it },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

이러면 리컴포지션에 영향을 받을거 같아요! by 를 활용해보아요 (저도 리컴포지션은 아직..)ㅠ

Comment on lines +21 to +24
var signUpId = mutableStateOf("")
var signUpPw = mutableStateOf("")
var signUpName = mutableStateOf("")
var signUpPhone = mutableStateOf("")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
var signUpId = mutableStateOf("")
var signUpPw = mutableStateOf("")
var signUpName = mutableStateOf("")
var signUpPhone = mutableStateOf("")
var signUpId by remember { mutableStateOf("") }
var signUpPw by remember { mutableStateOf("") }
var signUpName by remember { mutableStateOf("") }
var signUpPhone by remember { mutableStateOf("") }

이렇게 해야 리컴포지션 영향을 받지 않을 것 같아요!

remember는 상태를 유지하여 리컴포지션이 발생하더라도 입력된 값이 초기화되지 않도록 해준다고 하네요!
by remember를 같이 사용하면 상태관리에 더욱 효율적일 것 같아요!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NOW-SOPT-ANDROID/chanwoo-bae#17 (comment)

var id by rememberSaveable { mutableStateOf("") }
var password by rememberSaveable { mutableStateOf("") }
var nickName by rememberSaveable { mutableStateOf("") }
var mbti by rememberSaveable { mutableStateOf("") }

rememberSaveable: 컴포넌트의 생명주기 동안 상태를 유지하며, 프로세스 종료 및 구성 변경(예: 화면 회전) 시에도 상태를 유지합니다.

이런것도 있다고 합니다!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants