-
Notifications
You must be signed in to change notification settings - Fork 0
온보딩 마지막 수정 #174
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
Merged
Merged
온보딩 마지막 수정 #174
Conversation
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
…ute로 바꿔줬다. Screen에서는 2개의 파라미터를 요구하는데, Route는 요구하지 않는다.
1. Route는 무조건 만들자.
Screen은 UI 구성과 사용자 상호작용만 담당하고,
Route는 ViewModel과 이벤트 흐름을 관리하므로,
유지보수성, 테스트 가능성, 재사용성이 모두 높아집니다.
2. Uri 처리 방식
제일 좋은 방법: Uri와 화면 전환 로직을 하나의 함수로 묶어서 처리
이유:
단일 책임 원칙(SRP):
각 함수가 하나의 일을 잘 하도록 합니다. onEnterSpaceScreenRequest는 이제 이미지 선택 및 화면 전환을 모두 처리합니다.
Uri를 전달하고, 이를 기반으로 화면 전환을 처리하기 때문에, 여러 함수가 하나의 책임을 나누지 않고 서로 다른 역할을 하게 됩니다.
직관적인 코드:
profileImageUri와 onEnterSpaceScreenRequest가 하나로 묶이면, 이미지 선택 및 화면 전환 흐름을 읽기 쉽고 유지보수도 편리합니다.
Uri만 넘겨주는 방식으로, 필요한 데이터를 한 번에 전달할 수 있습니다.
직관적인 화면 전환:
이미지를 선택하고 나서 바로 화면을 전환하는 방식이 매우 자연스럽고 사용자가 UI와 상호작용하는 방식이 일관적입니다.
구조적으로 간결:
별도의 상태 관리를 하는 것보다, Uri를 한 번만 넘겨주고 그에 맞게 화면 전환을 처리하는 방식이 코드가 깔끔하고 직관적입니다.
장점 정리:
한 번의 함수 호출로 모든 처리가 가능: onEnterSpaceScreenRequest가 Uri를 받으므로, 이미지 선택 및 화면 전환을 간단히 처리할 수 있습니다.
명확한 역할 분리: 이미지를 선택하는 것과 화면 전환 로직을 별도로 나누지 않기 때문에 코드의 흐름을 이해하기 쉽고, 기능 수정이 필요할 때 더 유연합니다.
사용자 경험(UX): 사용자가 이미지를 선택하고 바로 다음 화면으로 넘어가는 경험을 제공하므로 더 직관적인 흐름을 보장합니다.
결론:
profileImageUri와 onEnterSpaceScreenRequest를 하나의 파라미터로 묶어서 Uri를 넘겨주는 방식이 가장 직관적이고, 유지 보수가 용이한 방법입니다. 이 방식은 코드가 깔끔하고, 흐름을 이해하기 쉽습니다.
3. rememberAsyncImagePainter
- profileImageUri가 null일 경우 기본 이미지 보여줌
- 로딩 중일 때도 placeholder 보여줌
- 실패했을 때 error image 보여줌
4. 이미지를 바로 UI에 반영
private val _profileImageUri = mutableStateOf<Uri?>(null)
val profileImageUri: State<Uri?> = _profileImageUri
fun updateProfileImage(uri: Uri) {
_profileImageUri.value = uri
}
이렇게 하면 Composable에서 viewModel.profileImageUri.value가 변할 때 자동으로 UI가 리컴포지션됩니다.
단일 뷰모델을 사용하려고 했으나 어려워서 2개로 분리..
agvber
reviewed
May 15, 2025
Member
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.
해당 파일은 수정되지 않았는데 같이 수정된 것 같습니다
깔끔한 commit 기록이 남기기 위해서 수정된 부분 복구 부탁드려요!
agvber
approved these changes
May 15, 2025
Member
해당부분은 사실 그룹 생성 후 랜덤 숫자를 생성해서 초대코드를 생성 하였습니다. |
…nto refactor/onboarding_finishing
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.
🤷♂️ PR 내용(Issue 꼭 달기!)
resolved: ❗️💥🚀 온보딩 찐막 마무리 #130