-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor: 즐겨찾기 화면 기능 분리 #13
base: hoya
Are you sure you want to change the base?
Conversation
storeAdapter = StoreAdapter( | ||
storeItems = storeViewModel.storeItems.value ?: mutableListOf(), | ||
favoriteItems = favoriteViewModel.favoriteState.value ?: emptyList(), | ||
onFavoriteClicked = { storeId -> |
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.
맨 처음에는 로딩이 다 되지 않았으니까 아이템들이 항상 빈 리스트로 들어가게 되지 않을까요?
degreeViewModel = ViewModelProvider(this)[DegreeViewModel::class.java] | ||
storeViewModel = ViewModelProvider(this)[StoreViewModel::class.java] | ||
favoriteViewModel = ViewModelProvider(this)[FavoriteViewModel::class.java] | ||
filterViewModel = ViewModelProvider(this)[FilterViewModel::class.java] |
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.
FilterViewModel의 역할이 무엇인가요?
@@ -17,7 +17,8 @@ class StoreAdapter( | |||
private var storeItems: MutableList<StoreModel>, |
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.
storeItems를 MutableList로 하신 이유가 있을까요?
storeItems = if (isFavoriteMode) { // FavoriteFragment | ||
newItems.filter { store -> | ||
favoriteItems.any { favorite -> favorite.storeId == store.id && favorite.isFavorite } | ||
}.toMutableList() | ||
} else { // HomeFragment | ||
newItems.toMutableList() | ||
} |
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.
이렇게 매번 연산하지 말고 그냥 StoreModel
내에 isFavorite 같은 플래그를 두는 건 어떨까요?
Summary
Describe your changes
To reviewers