-
Notifications
You must be signed in to change notification settings - Fork 0
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
선호학과 정보 저장 #366
base: develop
Are you sure you want to change the base?
선호학과 정보 저장 #366
Conversation
plgafhd
commented
Oct 10, 2024
- 사실 최근 검색 학과 저장 (5개 저장)
- 필터 바텀시트에서 학과 목록을 보여줄 때 별도의 맨 위 항목으로 뜨게 됨
- 최근 검색 기록은 로컬 저장 (로그아웃 하면 초기화)
) | ||
closeBottomSheetPlaceable.placeRelative( | ||
tagTypePlaceable.width + tagListPlaceable.width - 52, | ||
(SearchOptionSheetConstants.TopMargin.toPx().roundToInt() - 32) / 2, | ||
) | ||
if (baseAnimatedFloat.value != 0f) dragSheetPlaceable.placeRelative(0, 0) |
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.
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.
-52를 한 이유는 아이콘 size 32 + padding 20
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.
toPx() 적용하기~~
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.
@@ -66,6 +70,22 @@ class LectureSearchRepositoryImpl @Inject constructor( | |||
return response.content | |||
} | |||
|
|||
override fun storeRecentSearchedDepartment(tag: TagDto) { | |||
stoarge.recentSearchedDepartments.update( |
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.
stoarge -> storage 오타나있어
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.
@@ -23,4 +27,6 @@ interface LectureSearchRepository { | |||
suspend fun getBuildings( | |||
places: String, | |||
): List<LectureBuildingDto> | |||
|
|||
fun storeRecentSearchedDepartment(tag: TagDto) |
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.
굳이 TagDto 를 저장할 이유가 있나? 어차피 TagType.DEPARTMENT 만 저장되는거면 학과 이름만 하는게 나을 것 같은데
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.
어차피 꺼낼 때 TagDto 형태로 꺼내서 UI 에 바로 넣는구나
상관없겠다
override fun storeRecentSearchedDepartment(tag: TagDto) { | ||
storage.recentSearchedDepartments.update( | ||
storage.recentSearchedDepartments.get().toMutableList().apply { | ||
if (contains(tag)) remove(tag) | ||
add(tag) | ||
while (count() > 5) removeAt(0) | ||
}, | ||
) | ||
} |
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.
override fun storeRecentSearchedDepartment(tag: TagDto) { | |
storage.recentSearchedDepartments.update( | |
storage.recentSearchedDepartments.get().toMutableList().apply { | |
if (contains(tag)) remove(tag) | |
add(tag) | |
while (count() > 5) removeAt(0) | |
}, | |
) | |
} | |
override fun storeRecentSearchedDepartment(tag: TagDto) { | |
val previousStoredTags = storage.recentSearchedDepartments.get() | |
if (tag in previousStoredTags) { | |
storage.recentSearchedDepartments.update(previousStoredTags - tag) | |
} else { | |
storage.recentSearchedDepartments.update((previousStoredTags + tag).takeLast(5)) | |
} | |
} |
tagsByTagType, recentSearchedDepartments, _selectedTags, | ||
) { tagsByTagType, recentDepartments, selectedTags -> | ||
recentDepartments.filter { recentDepartment -> | ||
tagsByTagType.map { tag -> tag.item }.contains(recentDepartment) |
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.
tagsByTagType.map { tag -> tag.item } 를 filter 내부 루프 돌면서 매번 계산하는데 살짝 개선해보자