[Feat] 공휴일 API를 받아와서 공휴일 점심에 스낵코너가 안뜨게 처리해요#501
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces the integration of a public holiday API to dynamically adjust the displayed menus based on whether the current date is a public holiday. It enhances user experience by informing them of public holidays and adjusting the menu display accordingly. The changes include fetching holiday data, caching it for efficiency, modifying menu loading logic, and displaying a holiday banner on the menu screen. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 공휴일 정보를 API로부터 가져와 메뉴 로딩 로직에 반영하고, UI에 공휴일 배너를 표시하는 기능 추가를 잘 구현했습니다. 전반적으로 코드 구조가 좋고, UseCase를 활용하여 관심사를 잘 분리했습니다. 몇 가지 개선점을 제안드립니다. 첫째, 공휴일 정보를 캐시하는 부분에서 메모리 효율성을 높이기 위해 LruCache 사용을 고려해볼 수 있습니다. 둘째, PublicHolidayRepository에 정의된 getHoliday 메서드는 현재 사용되지 않고 비효율적으로 구현될 수 있어, 혼동을 줄이기 위해 제거하는 것이 좋아 보입니다. 자세한 내용은 각 파일의 주석을 참고해주세요.
app/src/main/java/com/eatssu/android/data/remote/repository/PublicHolidayRepositoryImpl.kt
Outdated
Show resolved
Hide resolved
| private val publicHolidayRepository: PublicHolidayRepository, | ||
| ) { | ||
| private val mutex = Mutex() | ||
| private val cache: MutableMap<YearMonth, List<PublicHoliday>> = linkedMapOf() |
There was a problem hiding this comment.
현재 월 단위 캐시로 LinkedHashMap을 사용하고 있는데, 캐시의 크기에 제한이 없어 사용자가 여러 달을 탐색할 경우 메모리 사용량이 계속 증가할 수 있습니다. 메모리 효율성을 높이기 위해 LruCache와 같이 크기가 제한된 캐시를 사용하는 것을 권장합니다.
예시:
import androidx.collection.LruCache // or android.util.LruCache
// ...
private val cache = LruCache<YearMonth, List<PublicHoliday>>(12) // 최근 12개월 데이터 캐시
suspend operator fun invoke(yearMonth: YearMonth): List<PublicHoliday> {
mutex.withLock {
cache.get(yearMonth)?.let { return it }
}
val result = publicHolidayRepository.getHolidays(yearMonth)
mutex.withLock {
cache.put(yearMonth, result)
}
return result
}There was a problem hiding this comment.
반영했습니다. 월 캐시가 무제한으로 커지지 않도록 access-order LinkedHashMap 기반 LRU로 바꾸고 최대 12개월만 유지하도록 제한했습니다.
|
리뷰 요청사항 반영했습니다.
|
app/src/main/java/com/eatssu/android/data/remote/repository/PublicHolidayRepositoryImpl.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/eatssu/android/data/remote/repository/PublicHolidayRepositoryImpl.kt
Outdated
Show resolved
Hide resolved
* [Feat] 공휴일 API를 연동하고 메뉴 화면에 공휴일 배너를 표시합니다 * [Refactor] 메뉴 로딩(공휴일 포함) 로직을 UseCase로 이동합니다 * [Chore] 메뉴 공휴일 배너 노출 제거 * test: update MenuViewModelBehaviorSpec for LoadMenusUseCase * [Refactor] 공휴일 캐시 제한 및 repository API 정리 * chore: 공휴일 API 관련 주석 추가 * refactor: simplify public holiday fetch * chore: early return으로 수정
* release: 3.2.6 * chore: 릴리즈 노트 문구 수정 * [Feat] 공휴일 API를 받아와서 공휴일 점심에 스낵코너가 안뜨게 처리해요 (#501) * [Feat] 공휴일 API를 연동하고 메뉴 화면에 공휴일 배너를 표시합니다 * [Refactor] 메뉴 로딩(공휴일 포함) 로직을 UseCase로 이동합니다 * [Chore] 메뉴 공휴일 배너 노출 제거 * test: update MenuViewModelBehaviorSpec for LoadMenusUseCase * [Refactor] 공휴일 캐시 제한 및 repository API 정리 * chore: 공휴일 API 관련 주석 추가 * refactor: simplify public holiday fetch * chore: early return으로 수정 --------- Co-authored-by: Jin Yu <qldls0307@naver.com>
Summary
LoadMenusUseCase로 이동하고, 공휴일인 경우 고정 식당(푸드코트/스낵코너) 제외Describe your changes
BuildConfig.HOLIDAY_API_KEY를 통해 키 주입(미설정/blank면 공휴일 조회는 스킵)PublicHolidayModule로 별도 Retrofit/Service 제공Screen_recording_20260317_100131.webm
Issue
To reviewers
local.properties에HOLIDAY_API_KEY를 설정하세요. notion에서 확인