Updated on 2026-08-14

This commit is contained in:
Tangem 2020-11-17 10:54:38 +03:00
parent ee6f684780
commit 2ea7bbdb77

View file

@ -25,13 +25,17 @@ class ConfigManager(
private val payIdIsEnabled = "payIdIsEnabled"
private val useTopUp = "useTopUp"
private val isStart2Coin = "isStart2Coin"
private val coinMarketCapKey = "coinMarketCapKey"
private val moonPayApiKey = "moonPayApiKey"
private val moonPayApiSecretKey = "moonPayApiSecretKey"
var config: ConfigState = ConfigState()
private set
fun load(onComplete: VoidCallback? = null) {
localLoader.loadConfig {
it.features?.forEach { feature -> updateFeature(feature.name, feature.value) }
localLoader.loadConfig {config ->
config.features?.forEach { updateFeature(it.name, it.value) }
config.configValues?.forEach { updateKeys(it.name, it.value) }
}
remoteLoader.loadConfig {
it.features?.forEach { feature -> updateFeature(feature.name, feature.value) }
@ -53,4 +57,12 @@ class ConfigManager(
isStart2Coin -> config = config.copy(isStart2Coin = newValue)
}
}
private fun updateKeys(name: String, value: String) {
when (name) {
coinMarketCapKey -> config = config.copy(coinMarketCapKey = value)
moonPayApiKey -> config = config.copy(moonPayApiKey = value)
moonPayApiSecretKey -> config = config.copy(moonPayApiSecretKey = value)
}
}
}