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/#6] 1주차 심화과제 (Compose) #8

Open
wants to merge 16 commits into
base: develop-compose
Choose a base branch
from

Conversation

SYAAINN
Copy link
Collaborator

@SYAAINN SYAAINN commented Sep 18, 2024

📌 개요

✨ 작업 내용

  • Activiy 생명주기 알아보기 - [미완성]

  • ViewModel을 사용하여 State 관리해보기 - [미완성]

  • UX 고려하여 기능 추가해보기

    • 뒤로가기 버튼 조정 - 메인에서 뒤로가기 클릭 시 앱 종료
    • 텍스트 입력 시 2줄 방지, 엔터키를 누르면 다음 입력칸으로 진행
    • 키보드가 올라오면 버튼도 키보드 위로 올라가도록 구현
    • 클릭 시 리플효과 제거

✨ PR 포인트

  1. 나름 제거한다고 제거했는데 불필요한 modifier 속성이나 구문들이 있을까요?
  2. SignUpScreen에서 키보드와 버튼이 함께 올라오면서 맨 밑에 있는 전화번호 TextField가 가리는 문제가 발생해서 찾다찾다 LazyColumn으로 스크롤이 가능하도록 해서 해결했는데 더 좋은 방법이 있을까요? scrollState로 Column 내부에서 해결해보려 했으나, Box에 선언된 fillMaxSize() 때문인지 불가능하더군요 😭
  3. Requseter(엔터키 누르면 다음 창으로 옮기는거 하려고 넣었습니다!) 얘는 Route로 빼거나 ViewModel로 빼는거보다 Screen에 두는게 좋을까요? 지극히 UI스럽긴 합니다..
  4. SignInScreen과 SignUpScreen에서 동일한 ViewModel 객체를 이용하려고 하다보니 HiltViewModel의 필요성을 느껴서 사용하게 되었는데 평소에 사용하던대로 Route 함수에 파라미터로
    authViewModel: AuthViewModel = hiltViewModel()
    을 넘겨주니 각자 다른 객체를 생성해서 user의 value가 공유가 안되더라구요, 그래서 네비게이션의 부모 컴포저블함수에서 넘겨주는 형식으로 해결 했는데 적절한 방법이였는지 확인 부탁드립니다!!!

📸 스크린샷/동영상

@SYAAINN SYAAINN added ✨ FEAT 기능 개발 🔥 민재 민재 심화과제 심화과제 labels Sep 18, 2024
@SYAAINN SYAAINN self-assigned this Sep 18, 2024
Copy link
Member

@junseo511 junseo511 left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines +80 to +83
// Testing
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Copy link
Member

Choose a reason for hiding this comment

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

c: 위에도 테스팅 범주가 있고 아래도 있네요?

Copy link
Member

Choose a reason for hiding this comment

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

c: 이제 버전 카탈로그의 사용도 고민해보시면 좋을듯?

Comment on lines +16 to 18
fun navigateToHome(id: String?, password: String?, nickname: String?, phoneNumber: String?) {
navController.navigate("home/$id/$password/$nickname/$phoneNumber")
}
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

c: xml 코드에서 달았던 리뷰와 같은 의미로 달았습니다 :)

Comment on lines +116 to +123
private fun setUser() {
_user.value = User(
id = signUpId,
password = signUpPassword,
nickname = signUpNickname,
phoneNumber = signUpPhoneNumber
)
}
Copy link
Member

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) {
Copy link
Member

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())
Copy link
Member

Choose a reason for hiding this comment

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

c: 로그를 남겨두신 이유가 있나요?

Comment on lines +45 to +66
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())
}
Copy link
Member

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))
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

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

a: 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ FEAT 기능 개발 심화과제 심화과제 🔥 민재 민재
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants