Skip to content

Feat/week compose 07#13

Open
hyoeunjoo wants to merge 13 commits into
develop-composefrom
feat/week-compose-07
Open

Feat/week compose 07#13
hyoeunjoo wants to merge 13 commits into
develop-composefrom
feat/week-compose-07

Conversation

@hyoeunjoo
Copy link
Copy Markdown
Collaborator

@hyoeunjoo hyoeunjoo commented May 31, 2024

📌𝘐𝘴𝘴𝘶𝘦𝘴

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

  • 폴더링 다시 하긴 했는데.. 뭔가 이상한 것 같습니다.. 시험 끝나고 다시 고쳐볼게요!
  • Repository를 이용해서 UI와 Data로직 분리했습니다

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

화면 작동은 그 전과 동일합니다. 모두 실행됩니다.

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

담주에 시험이라 급하게 미리 올려서 고칠 점이 많을 것 같습니다
언제든지 고칠 점 많이 많이 얘기해주시면 감사하겠습니다..!!

@hyoeunjoo hyoeunjoo requested review from OliviaYJH, cacaocoffee, chanubc and kez-lab and removed request for OliviaYJH, cacaocoffee and chanubc May 31, 2024 12:12
@hyoeunjoo hyoeunjoo self-assigned this May 31, 2024
Copy link
Copy Markdown
Member

@OliviaYJH OliviaYJH left a comment

Choose a reason for hiding this comment

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

수고했어요!!

private val authRepository: AuthRepository,
) : ViewModel() {

val loginResult: MutableLiveData<Boolean> = MutableLiveData()
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
val loginResult: MutableLiveData<Boolean> = MutableLiveData()
private val _loginResult = MutableLiveData<Boolean>()
val loginResult: LiveData<Boolean> get() = _loginResult

이렇게 작성해서 _loginResult는 ViewModel에서만 수정 가능하게 하고 activity에서는 loginResult에 접근만 가능할 수 있게 하면 좋을 것 같아요!

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.

errorMessage도 마찬가지 에요!!

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.

여기도 6주차 머지 되면 다시 봐볼게용
한학기동안 너무 고생했어요
진짜 일.취.월.장!!!

고마워ㅠㅠ

private val authRepository: AuthRepository,
) : ViewModel() {

val loginResult: MutableLiveData<Boolean> = MutableLiveData()
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.

errorMessage도 마찬가지 에요!!

Comment on lines +8 to +18
class LoginViewModelFactory : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
if (modelClass.isAssignableFrom(LoginViewModel::class.java)) {
val repository =
AuthRepoImpl(ServicePool.authService)
return LoginViewModel(repository) as T
} else {
throw IllegalArgumentException("Failed to create ViewModel: ${modelClass.name}")
}
}
} No newline at end of file
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.

factory 뷰모델 마다 만들필요 없이 하나로 합쳐주세요!
확장성과 중앙 집중화과 되기 때문에 더 효율적입니다
시험 끝나면 자세하게 알려드릴게용

Comment on lines +22 to +25
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 id by rememberSaveable { mutableStateOf("") }
var password by rememberSaveable { mutableStateOf("") }
var nickName by rememberSaveable { mutableStateOf("") }
var mbti by rememberSaveable { mutableStateOf("") }

by remember키워드를 통해 객체를 생성후 생된 객체를 기억하고 재사용 할 수 있습니다!
컴포즈에서의 상태관리 패턴이에여

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.

3 participants