Skip to content
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

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

plgafhd
Copy link
Collaborator

@plgafhd plgafhd commented Oct 10, 2024

  • 사실 최근 검색 학과 저장 (5개 저장)
  • 필터 바텀시트에서 학과 목록을 보여줄 때 별도의 맨 위 항목으로 뜨게 됨
  • 최근 검색 기록은 로컬 저장 (로그아웃 하면 초기화)

@plgafhd plgafhd requested a review from a team as a code owner October 10, 2024 13:44
Comment on lines 172 to 177
)
closeBottomSheetPlaceable.placeRelative(
tagTypePlaceable.width + tagListPlaceable.width - 52,
(SearchOptionSheetConstants.TopMargin.toPx().roundToInt() - 32) / 2,
)
if (baseAnimatedFloat.value != 0f) dragSheetPlaceable.placeRelative(0, 0)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필터 바텀시트에 X 버튼 넣으려다가 실패

얘는 뭐냐면... 그 피그마에 보면 필터 바텀시트 상단에 X 버튼이 있는데, 원래 없었길래 추가하려 했는데
왜인지 모르게 사진처럼 오른쪽으로 쏠려서 나와... 코드에서 이상한 점을 못찾겠어

Copy link
Collaborator Author

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toPx() 적용하기~~

Copy link
Collaborator Author

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(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stoarge -> storage 오타나있어

Copy link
Collaborator Author

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳이 TagDto 를 저장할 이유가 있나? 어차피 TagType.DEPARTMENT 만 저장되는거면 학과 이름만 하는게 나을 것 같은데

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어차피 꺼낼 때 TagDto 형태로 꺼내서 UI 에 바로 넣는구나
상관없겠다

Comment on lines +73 to +81
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)
},
)
}
Copy link
Collaborator

@JuTaK97 JuTaK97 Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Collaborator

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 내부 루프 돌면서 매번 계산하는데 살짝 개선해보자

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants