Open
Conversation
cometj03
reviewed
Feb 17, 2025
Comment on lines
327
to
330
| storeAdapter = StoreAdapter( | ||
| storeItems = storeViewModel.storeItems.value ?: mutableListOf(), | ||
| favoriteItems = favoriteViewModel.favoriteState.value ?: emptyList(), | ||
| onFavoriteClicked = { storeId -> |
There was a problem hiding this comment.
맨 처음에는 로딩이 다 되지 않았으니까 아이템들이 항상 빈 리스트로 들어가게 되지 않을까요?
| degreeViewModel = ViewModelProvider(this)[DegreeViewModel::class.java] | ||
| storeViewModel = ViewModelProvider(this)[StoreViewModel::class.java] | ||
| favoriteViewModel = ViewModelProvider(this)[FavoriteViewModel::class.java] | ||
| filterViewModel = ViewModelProvider(this)[FilterViewModel::class.java] |
Collaborator
Author
There was a problem hiding this comment.
4가지 필터(단체, 데이트, 가성비, 제휴)의 체크 상태를(true, false) 관리하는 뷰모델입니다
| @@ -17,7 +17,8 @@ class StoreAdapter( | |||
| private var storeItems: MutableList<StoreModel>, | |||
There was a problem hiding this comment.
storeItems를 MutableList로 하신 이유가 있을까요?
Collaborator
Author
There was a problem hiding this comment.
처음 개발할 때 즐겨찾기 화면에서 즐겨찾기 제거 시 해당 아이템을 직접 제거 하려고 MutableList로 했던 것 같은데, 지금 다시 보니 새로운 가게 리스트를 넘겨 받아 대체하는 식으로 되어있어서 크게 의미가 없네요!
Comment on lines
104
to
110
| 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.
이렇게 매번 연산하지 말고 그냥 StoreModel 내에 isFavorite 같은 플래그를 두는 건 어떨까요?
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.
Summary
Describe your changes
To reviewers