Updated on 2026-08-14
This commit is contained in:
parent
ee6f684780
commit
2ea7bbdb77
1 changed files with 14 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue