[#132] UserDefautls를 관리하는 객체를 Persistence 디렉토리 내에 구현한다#133
[#132] UserDefautls를 관리하는 객체를 Persistence 디렉토리 내에 구현한다#133
Conversation
opficdev
commented
Feb 25, 2026
- closed UserDefaults를 관리하는 객체를 Persistence 디렉토리 내에 구현한다 #132
Summary of ChangesHello @opficdev, 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! 이 PR은 애플리케이션 내 사용자 환경설정 관리 방식을 리팩토링합니다. UserDefaults에 직접 접근하는 방식을 추상화하기 위해 전용 UserPreferencesRepository와 관련 UseCase를 도입했습니다. 이 변경으로 시스템 테마, 첫 실행 상태, 최근 검색어, 푸시 알림 표시 설정 등 다양한 사용자 설정 처리가 중앙 집중화되어, 더 모듈화되고 테스트하기 쉬운 아키텍처를 제공합니다. Highlights
Changelog
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
This pull request refactors UserDefaults access through UserPreferencesRepository, enhancing testability and maintainability by decoupling ViewModel and UserDefaults implementations. It introduces UserDefaultsStore and ThemeStore, defining user setting-related use cases following clean architecture principles. However, a critical vulnerability exists in the isFirstLaunch implementation, leading to a permanent denial of service. The method incorrectly checks for a Boolean value's existence, causing the application to remain in a perpetual "first launch" state, which triggers repeated automatic sign-outs and prevents users from accessing the main application features. This issue must be addressed before merging.
| if store.string(forKey: Key.firstLaunch) == nil { | ||
| return true | ||
| } | ||
| return store.bool(forKey: Key.firstLaunch) |
| try await signOutUseCase.execute() | ||
| send(.didLogined(false)) | ||
| sessionUseCase.execute(false) |
There was a problem hiding this comment.
The automatic sign-out logic removed the error handling that was previously present. If signOutUseCase.execute() fails (e.g., due to a network error), the subsequent lines that clear the local session state (send(.didLogined(false)) and sessionUseCase.execute(false)) will not be executed. This leaves the user's session active on the device, which could lead to unauthorized access if the device is shared or accessed by another person. It is recommended to ensure that the local session state is always cleared, regardless of whether the server-side sign-out request succeeds.
do {
try await signOutUseCase.execute()
} catch {}
send(.didLogined(false))
sessionUseCase.execute(false)