-
Notifications
You must be signed in to change notification settings - Fork 0
week6 - 기본과제 #7
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
base: main
Are you sure you want to change the base?
week6 - 기본과제 #7
Conversation
- Reqres GET /users API 연동 - ResponseReqresUsersDto, ReqresUser DTO 추가 - ReqresService 및 ReqresApiFactory 생성 - HomeItem에 UserProfile 타입 추가 - HomeViewModel에서 API 호출 및 에러 처리 로직 구현 - UserProfileComponent 컴포넌트 추가 (Coil 이미지 로딩) - HomeScreen에 UserProfile 타입 렌더링 로직 추가
ShinHyeongcheol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
솝커톤에 합세까지 바빴을텐데 수고하셨습니다!!
7셈 심화인 리팩도 진행하실거죠?ㅎㅎㅋㅋㅋㅋ
| */ | ||
| viewModelScope.launch { | ||
| // 로딩 시작 | ||
| _uiState.value = _uiState.value.copy(isLoading = true, errorMessage = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy를 바로 사용하지 말고 update라는게 있는데, 둘의 차이점을 알아보면 좋을 것 같아요!!
| @SerialName("message") | ||
| val message: String, | ||
| @SerialName("data") | ||
| val data: ResponseUserDataDto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전에 코리조에게 코리 받았던 내용 중 하나인데, 솝커톤때도 사용했듯이 Response 같은 경우의 BaseResponse를 만드는 것도 하나의 좋은 방법인것 같아요!!
success, code, message, data의 구조로 data만 병경이 되어서 사용하는데, 이 부분을 저는 제네릭으로 하여 구성했었습니다.
| * - collectAsState()가 변경을 감지 | ||
| * - 이 Composable이 자동으로 리컴포지션됨 | ||
| */ | ||
| val uiState by viewModel.uiState.collectAsState() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분 세미나에서 잠깐 다루었던것 같은데, collectAsState와 collectAsStateWithLifecycle의 차이점을 알아보면 좋을 것 같아요.
sohee6989
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!!
조금 더 읽고 코리 더 남기겠습니다 :)
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| fun UserProfileComponentPreview() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
프리뷰 코드는 private 붙여주시는거 어떠세요??
5차 과제 PR - Flow 기반 입력 검증 및 코루틴 기반 API 호출 구현
Callback 코드를 코루틴으로 변환
에러 처리 정리
변경사항
LoginUiState.kt - 검증 상태 필드 추가
LoginViewModel.kt - Flow로 실시간 검증 구현
LoginScreen.kt - Flow 상태를 UI에 표시
AuthService.kt- suspend 함수로 변경ReqresService.kt- suspend 함수로 변경LoginViewModel.kt- Callback → 코루틴 (loginWithApi 함수)MyViewModel.kt- Callback → 코루틴 (fetchUserFromServer 함수)SignUpViewModel.kt- Callback → 코루틴 (signUpWithApi 함수)주요 변경 사항
2025-11-28.18.00.09.mov