Feat/week compose 07#13
Open
hyoeunjoo wants to merge 13 commits into
Open
Conversation
OliviaYJH
approved these changes
Jun 9, 2024
| private val authRepository: AuthRepository, | ||
| ) : ViewModel() { | ||
|
|
||
| val loginResult: MutableLiveData<Boolean> = MutableLiveData() |
Member
There was a problem hiding this comment.
Suggested change
| val loginResult: MutableLiveData<Boolean> = MutableLiveData() | |
| private val _loginResult = MutableLiveData<Boolean>() | |
| val loginResult: LiveData<Boolean> get() = _loginResult |
이렇게 작성해서 _loginResult는 ViewModel에서만 수정 가능하게 하고 activity에서는 loginResult에 접근만 가능할 수 있게 하면 좋을 것 같아요!
chanubc
reviewed
Jun 9, 2024
Member
chanubc
left a comment
There was a problem hiding this comment.
여기도 6주차 머지 되면 다시 봐볼게용
한학기동안 너무 고생했어요
진짜 일.취.월.장!!!
고마워ㅠㅠ
| private val authRepository: AuthRepository, | ||
| ) : ViewModel() { | ||
|
|
||
| val loginResult: MutableLiveData<Boolean> = MutableLiveData() |
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 |
Member
There was a problem hiding this comment.
factory 뷰모델 마다 만들필요 없이 하나로 합쳐주세요!
확장성과 중앙 집중화과 되기 때문에 더 효율적입니다
시험 끝나면 자세하게 알려드릴게용
Comment on lines
+22
to
+25
| var signUpId = mutableStateOf("") | ||
| var signUpPw = mutableStateOf("") | ||
| var signUpName = mutableStateOf("") | ||
| var signUpPhone = mutableStateOf("") |
Member
There was a problem hiding this comment.
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키워드를 통해 객체를 생성후 생된 객체를 기억하고 재사용 할 수 있습니다!
컴포즈에서의 상태관리 패턴이에여
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
화면 작동은 그 전과 동일합니다. 모두 실행됩니다.
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴
담주에 시험이라 급하게 미리 올려서 고칠 점이 많을 것 같습니다
언제든지 고칠 점 많이 많이 얘기해주시면 감사하겠습니다..!!