Conversation
| @@ -0,0 +1,7 @@ | |||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | |||
| plugins { | |||
| id("com.android.application") version "8.2.2" apply false | |||
There was a problem hiding this comment.
제가 고생했던 부분이네요! 버전을 낮추는 걸 몰라서 엄청 고생했습니다
jeongkyueun
left a comment
There was a problem hiding this comment.
폴더 구조를 조금만 다듬어서 정리하면 보기 편할 거 같아요 !! 과제 모두 잘 수행하셨습니다!!
| id("com.android.library") version "8.2.2" apply false | ||
| id("org.jetbrains.kotlin.android") version "1.9.22" apply false | ||
| id("com.google.dagger.hilt.android") version "2.48.1" apply false | ||
| } No newline at end of file |
There was a problem hiding this comment.
gradle 맞추느라 너무 수고하셨어요... 멋져요
kimdoyeon1234
left a comment
There was a problem hiding this comment.
수고하셨습니다! 🍋ㅎㅎ
이번 코드는 @HiltAndroidApp, @androidentrypoint, @hiltviewmodel 어노테이션을
모두 정확하게 적용하셨고, NetworkModule과 LocalModule을 분리하고
RemoteRepository/LocalRepository로 역할을 나눈 점, 그리고 ProductAdapter에 DiffUtil을 활용한 점이 정말 좋았어요!
다만 이번 미션의 핵심은 패키지 분리입니다!
현재 MainActivity, Fragment, Repository, Model 등 모든 파일이 루트 패키지(com.example.week3)에 몰려있는데,
data/model/, data/repository/, domain/repository/, di/, ui/home/, ui/profile/ 처럼
역할에 맞게 패키지를 나눠주세요 !
또한 MainViewModel 하나가 프로필, 팔로잉, 상품, 위시리스트를 모두 담당하고 있는데,
화면별로 HomeViewModel, ProfileViewModel, PurchaseShoesViewModel, WishlistViewModel로 분리하고, WishlistFragment의 위시리스트 필터링 로직처럼 Fragment에 있는 비즈니스 로직은 ViewModel로 옮겨주시면 더욱 완성도 있는 코드가 될 것 같아요!
전반적으로 Hilt 적용 자체는 완벽하게 하셨으니 패키지 구조와 ViewModel 분리만
다듬어주시면 훨씬 좋아질 것 같습니다. 고생 많으셨어요!
There was a problem hiding this comment.
MainViewModel 하나가 프로필, 팔로잉, 상품, 위시리스트를 모두 처리하고 있어요! 화면별로 HomeViewModel, ProfileViewModel, PurchaseShoesViewModel, WishlistViewModel로 분리 하는게 좋을거 같습니다!
| private val viewModel: MainViewModel by viewModels() | ||
|
|
There was a problem hiding this comment.
MainViewModel을 공유하지 않고 HomeFragment 전용 HomeViewModel을 만들어서 사용해보는게 좋을거 같습니다! 현재는 불필요한 프로필/팔로잉 데이터까지 들고 있게 됩니다..
| viewModel.productList.observe(viewLifecycleOwner) { allProducts -> | ||
| val wishList = allProducts.filter { it.isWished } | ||
| productAdapter.submitList(wishList) | ||
| } |
There was a problem hiding this comment.
위시리스트 필터링 로직이 Fragment에 있어요! 이런 비즈니스 로직은 ViewModel 안으로 옮겨주세요 :)
| viewModel.userProfile.observe(viewLifecycleOwner) { user -> | ||
| tvNickname.text = "${user.firstName} ${user.lastName}" | ||
| Glide.with(this).load(user.avatar).into(imgProfile) | ||
| } | ||
|
|
There was a problem hiding this comment.
"${user.firstName} ${user.lastName}" 같은 문자열 조합은 UI 로직이라 Fragment에 있어도 괜찮지만, Glide 이미지 로딩은 BindingAdapter로 분리하면 더 깔끔해요!
There was a problem hiding this comment.
이번 미션의 핵심은 패키지 분리입니다! LocalRepository → data/repository/ 패키지를 만들어서 이동시켜주세요 :)
There was a problem hiding this comment.
RemoteRepository도 data/repository/ 패키지로 이동시켜주세요! 추가로 domain/repository/에 interface를 만들고,
data/repository/에 구현체를 두는 구조로 분리하면 더 좋습니다!
There was a problem hiding this comment.
모델 클래스들은 data/model/ 패키지로 이동시켜주세요!
There was a problem hiding this comment.
모델 클래스들은 data/model/ 패키지로 이동시켜주세요!
| Glide.with(holder.itemView.context) | ||
| .load(user.avatar) | ||
| .into(holder.image) | ||
| } |
There was a problem hiding this comment.
이것도 이미지 로딩을 ProfileBindingAdapters.kt처럼 BindingAdapter로 분리하면 더 좋을거 같습니다!
📌 PR 제목
🔗 관련 이슈
Closes #43
✨ 변경 사항
-Hilt 설정
-Repository 생성
-ViewModel 생성
-Fragment와 ViewModel 연결
🔍 테스트
📸 스크린샷 (선택)
🚨 추가 이슈