Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/main/res/xml/remote_config_defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<key>min_required_version_code</key>
<value>1</value>
</entry>
<entry>
<key>offline_cache_enabled</key>
<value>false</value>
</entry>
</defaultsMap>
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ package com.project200.common.constants
object RemoteConfigKeys {
const val LATEST_VERSION_CODE = "latest_version_code"
const val MIN_REQUIRED_VERSION_CODE = "min_required_version_code"

// 오프라인 캐시 경로 on/off. 문제 시 앱 배포 없이 기존 네트워크 경로로 되돌리는 수단
const val OFFLINE_CACHE_ENABLED = "offline_cache_enabled"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.project200.data.datasource

import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.project200.common.constants.RemoteConfigKeys
import javax.inject.Inject
import javax.inject.Singleton

/**
* Remote Config로 켜고 끄는 기능 플래그를 읽습니다.
*
* fetch는 앱 진입의 업데이트 확인(`AppUpdateRepositoryImpl.getUpdateInfo`)이 이미 수행합니다.
* 여기서는 활성화된 값만 읽습니다
*
* 진입 전이거나 fetch가 실패한 기기에서는 `remote_config_defaults.xml`의 기본값이 읽힙니다.
* 기본값이 곧 최악 상황의 동작이라 꺼짐으로 두었습니다
*/
@Singleton
class FeatureFlagDataSource
@Inject
constructor(
private val firebaseRemoteConfig: FirebaseRemoteConfig,
) {
fun isOfflineCacheEnabled(): Boolean = firebaseRemoteConfig.getBoolean(RemoteConfigKeys.OFFLINE_CACHE_ENABLED)
}
Loading