Updated on 2026-08-14

This commit is contained in:
Tangem 2022-05-20 23:37:30 +03:00
parent ae87969a37
commit d4dec5a563
2 changed files with 10 additions and 11 deletions

View file

@ -22,10 +22,8 @@ data class TokensState(
val scanResponse: ScanResponse? = null
) : StateType {
fun canHandleToken(token: TokenWithBlockchain?): Boolean {
val token = token ?: return false
val card = scanResponse?.card ?: return false
return card.canHandleToken(token.blockchain)
fun canHandleToken(token: TokenWithBlockchain): Boolean {
return scanResponse?.card?.canHandleToken(token.blockchain) ?: false
}
}

View file

@ -107,15 +107,16 @@ fun CurrenciesScreen(
allowToAdd = tokensState.value.allowToAdd,
onAddCurrencyToggled = { currency, token ->
onAddCurrencyToggleClick(currency, token)
if (!tokensState.value.canHandleToken(token)) {
val dialog = AppDialog.SimpleOkDialog(
header = context.getString(R.string.common_warning),
message = context.getString(R.string.alert_manage_tokens_unsupported_message)
) {
onAddCurrencyToggleClick(currency, token)
token?.let {
if (!tokensState.value.canHandleToken(it)) {
val dialog = AppDialog.SimpleOkDialog(
header = context.getString(R.string.common_warning),
message = context.getString(R.string.alert_manage_tokens_unsupported_message)
) { onAddCurrencyToggleClick(currency, it) }
store.dispatchDialogShow(dialog)
}
store.dispatchDialogShow(dialog)
}
},
onNetworkItemClicked = onNetworkItemClicked
)