-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] firebase remote config 활용 코드 개선 #398
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
Conversation
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.
Pull Request Overview
This PR refactors the Firebase Remote Config implementation to follow better architectural patterns. The main goal is to improve code organization by introducing interface-based design and relocating version checking logic to a more appropriate location.
Key changes:
- Introduced interface-implementation separation for FirebaseRemoteConfigRepository
- Moved force update logic from BaseActivity to IntroViewModel, eliminating unnecessary checks on every screen
- Replaced JSONArray parsing with Gson for restaurant information
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| IntroViewModel.kt | Added version checking and Remote Config initialization logic with proper error handling |
| IntroActivity.kt | Added UI handling for force update dialog based on version check results |
| VersionViewModelFactory.kt | Removed obsolete factory class |
| VersionViewModel.kt | Removed obsolete ViewModel for version checking |
| InfoViewModel.kt | Simplified to fetch restaurant info on-demand instead of maintaining in-memory cache |
| InfoBottomSheetFragment.kt | Removed unnecessary flow collection and fixed property reference |
| BaseActivity.kt | Removed version checking logic and related dependencies |
| FirebaseRemoteConfigRepository.kt | Created new interface defining repository contract |
| RestaurantInfo.kt | Renamed photoUrl field to image for consistency |
| DataModule.kt | Added Hilt binding for FirebaseRemoteConfigRepository interface |
| AppModule.kt | Removed manual provider in favor of interface binding |
| FirebaseRemoteConfigRepositoryImpl.kt | New implementation with Gson parsing and suspend function support |
| FirebaseRemoteConfigRepository.kt (data) | Deleted old implementation file |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
app/src/main/java/com/eatssu/android/presentation/intro/IntroViewModel.kt
Show resolved
Hide resolved
| import com.eatssu.android.domain.model.RestaurantInfo | ||
| import com.eatssu.android.domain.repository.FirebaseRemoteConfigRepository | ||
| import com.eatssu.common.enums.Restaurant | ||
| import com.google.common.reflect.TypeToken |
Copilot
AI
Oct 16, 2025
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.
Using Guava's TypeToken is not recommended for Android projects. Consider using Gson's TypeToken (com.google.gson.reflect.TypeToken) instead, which is already available in the Gson library and is more appropriate for Android applications.
| import com.google.common.reflect.TypeToken | |
| import com.google.gson.reflect.TypeToken |
app/src/main/java/com/eatssu/android/data/repository/FirebaseRemoteConfigRepositoryImpl.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/eatssu/android/data/repository/FirebaseRemoteConfigRepositoryImpl.kt
Outdated
Show resolved
Hide resolved
|
FirebaseRemoteConfig에서 fetchAndActivate를 계속 실행하더라도 설정한 setMinimumFetchIntervalInSeconds 값이 지나지 않았으면 Fetch를 하지 않더라구요! Init을 명시적으로 코드 내부에서 해줘야하는 것이 이상해서 제 PR에서는 이 부분을 아예 삭제했는데 |
|
맞습니다! 너무 뭉뚱그려 말씀드린 것 같아 이 부분에 더하자면 제 의견은 다음과 같습니다! 기존 코드는 FirebaseRemoteConfigRepositoryImpl.init()을 초기애 1회 실행시켜줘야 했습니다. 지금은 VersionViewModel.kt가 해당 역할을 수행하고 있죠. 현재는 init 때만 fetchAndActivate를 호출하고 있어, 의도한 바인 '10분에 한번씩 값 업데이트'가 이루어지지 않고 있습니다. 앱 실행 최초 한번에만 Firebase Config를 가져오는 것이죠. |
kangyuri1114
left a comment
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.
좋네요!!! 수고하셨습니다~~
| private suspend fun initializeRemoteConfig() { | ||
| try { | ||
| firebaseRemoteConfigRepository.init().fold( | ||
| onSuccess = { | ||
| Timber.d("Firebase Remote Config 초기화 성공") | ||
| }, | ||
| onFailure = { error -> | ||
| Timber.e(error, "Firebase Remote Config 초기화 실패") | ||
| // Remote Config 초기화 실패해도 앱은 계속 진행 | ||
| } |
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.
전에 runcatching으로Viewmodel 내 api 결과 오류/성공 처리 하자고 했던거같아서요!
요기도 적용하면 어떨까용
private suspend fun initializeRemoteConfig() {
firebaseRemoteConfigRepository.init()
.onSuccess { Timber.d("Firebase Remote Config 초기화 성공") }
.onFailure { error ->
Timber.e(error, "Firebase Remote Config 초기화 실패")
}
}
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.
해당 함수는 Init을 뷰모델(외부)에서 안하게 되어서 삭제 되었답니다..😮
kangyuri1114
left a comment
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.
fetchAndActivate를 아무리 많이 호출해도 마지막 fetch로부터 지난 시간이 min fetch interval이 되지 않았으면 로컬에서 가져옵니다.
이 말씀은 그럼 기존 코드처럼 매 화면마다 version 체크가 이루어져야 한다는 걸까요?>??
c20375e to
c9ab6c4
Compare
|
@PeraSite 님 말씀 참고해서
두 가지 큰 변동이 있습니다! @kangyuri1114 @PeraSite 마지막으로 한 번 더 봐주시면 감사하겠습니다! 663280d |
|
확인했습니다! 제가 볼 땐 문제 없어보여요 코드도 더 좋아진 것 같습니다 |


Summary
firebase remote config 활용 코드를 개선했습니다
Describe your changes
remote config에서는 2가지 정보를 받아옵니다.
추가로, 인터페이스 - 구현체로 나누는게 좋을 것 같아서 해당 부분 정의 했습니다.