Updated on 2026-08-14

This commit is contained in:
Tangem 2020-11-18 12:46:39 +03:00
parent 0e5727eda0
commit 03372962fa
4 changed files with 15 additions and 15 deletions

View file

@ -86,9 +86,9 @@ class TapWalletManager {
}
tapWorkarounds = TapWorkarounds(data.card)
if (tapWorkarounds!!.isStart2Coin) {
store.state.globalState.configManager?.turnOf(ConfigManager.isPayIdCreationEnabled)
store.state.globalState.configManager?.turnOf(ConfigManager.isWalletPayIdEnabled)
} else {
store.state.globalState.configManager?.resetToDefault(ConfigManager.isPayIdCreationEnabled)
store.state.globalState.configManager?.resetToDefault(ConfigManager.isWalletPayIdEnabled)
}
withContext(Dispatchers.Main) {
store.dispatch(WalletAction.ResetState)
@ -158,7 +158,7 @@ class TapWalletManager {
private suspend fun loadPayIdIfNeeded(): Result<String?>? {
val scanNoteResponse = store.state.globalState.scanNoteResponse
if (store.state.globalState.configManager?.config?.isPayIdCreationEnabled == false
if (store.state.globalState.configManager?.config?.isWalletPayIdEnabled == false
|| scanNoteResponse?.walletManager?.wallet?.blockchain?.isPayIdSupported() == false) {
return null
}
@ -175,7 +175,7 @@ class TapWalletManager {
when (result) {
is Result.Success -> {
val config = store.state.globalState.configManager?.config
if (config?.isPayIdCreationEnabled == false) {
if (config?.isWalletPayIdEnabled == false) {
store.dispatch(WalletAction.DisablePayId)
return@withContext
}

View file

@ -9,7 +9,7 @@ data class Config(
val coinMarketCapKey: String = "f6622117-c043-47a0-8975-9d673ce484de",
val moonPayApiKey: String = "pk_test_kc90oYTANy7UQdBavDKGfL4K9l6VEPE",
val moonPayApiSecretKey: String = "sk_test_V8w4M19LbDjjYOt170s0tGuvXAgyEb1C",
val isPayIdCreationEnabled: Boolean = true,
val isWalletPayIdEnabled: Boolean = true,
val isTopUpEnabled: Boolean = false,
)
@ -36,14 +36,14 @@ class ConfigManager(
fun turnOf(name: String) {
when (name) {
isPayIdCreationEnabled -> config = config.copy(isPayIdCreationEnabled = false)
isWalletPayIdEnabled -> config = config.copy(isWalletPayIdEnabled = false)
isTopUpEnabled -> config = config.copy(isTopUpEnabled = false)
}
}
fun resetToDefault(name: String) {
when (name) {
isPayIdCreationEnabled -> config = config.copy(isPayIdCreationEnabled = defaultConfig.isPayIdCreationEnabled)
isWalletPayIdEnabled -> config = config.copy(isWalletPayIdEnabled = defaultConfig.isWalletPayIdEnabled)
isTopUpEnabled -> config = config.copy(isTopUpEnabled = defaultConfig.isTopUpEnabled)
}
}
@ -52,9 +52,9 @@ class ConfigManager(
val newValue = value ?: return
when (name) {
isPayIdCreationEnabled -> {
config = config.copy(isPayIdCreationEnabled = newValue)
defaultConfig = defaultConfig.copy(isPayIdCreationEnabled = newValue)
isWalletPayIdEnabled -> {
config = config.copy(isWalletPayIdEnabled = newValue)
defaultConfig = defaultConfig.copy(isWalletPayIdEnabled = newValue)
}
isTopUpEnabled -> {
config = config.copy(isTopUpEnabled = newValue)
@ -81,7 +81,7 @@ class ConfigManager(
}
companion object {
const val isPayIdCreationEnabled = "isPayIdCreationEnabled"
const val isWalletPayIdEnabled = "isWalletPayIdEnabled"
const val isTopUpEnabled = "useTopUp"
const val coinMarketCapKey = "coinMarketCapKey"
const val moonPayApiKey = "moonPayApiKey"