Updated on 2026-08-14
This commit is contained in:
parent
da5d8766f0
commit
69298b05ab
3 changed files with 25 additions and 9 deletions
|
|
@ -32,6 +32,10 @@ object TapWorkarounds {
|
|||
DerivationStyle.NEW
|
||||
}
|
||||
|
||||
val Card.allowToAddCustomDerivation: Boolean
|
||||
get() = useOldStyleDerivation || batchId == "AC03"
|
||||
// To recover funds for users who scanned AC03 batch on old app version and got old style derivation
|
||||
|
||||
fun Card.isExcluded(): Boolean {
|
||||
val excludedBatch = excludedBatches.contains(batchId)
|
||||
val excludedIssuerName = excludedIssuers.contains(issuer.name.uppercase(Locale.ROOT))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.tangem.domain.features.addCustomToken.redux
|
|||
|
||||
import android.webkit.ValueCallback
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.DerivationStyle
|
||||
import com.tangem.common.extensions.guard
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.AddCustomTokenError
|
||||
|
|
@ -10,6 +9,7 @@ import com.tangem.domain.AddCustomTokenError.Warning.*
|
|||
import com.tangem.domain.AddCustomTokenException
|
||||
import com.tangem.domain.DomainDialog
|
||||
import com.tangem.domain.DomainWrapped
|
||||
import com.tangem.domain.common.TapWorkarounds.allowToAddCustomDerivation
|
||||
import com.tangem.domain.common.TapWorkarounds.derivationStyle
|
||||
import com.tangem.domain.common.extensions.canHandleToken
|
||||
import com.tangem.domain.common.extensions.fromNetworkId
|
||||
|
|
@ -572,9 +572,10 @@ private class AddCustomTokenReducer(
|
|||
)
|
||||
|
||||
var derivationPathState = state.screenState.derivationPath
|
||||
derivationPathState = when (card.derivationStyle) {
|
||||
DerivationStyle.LEGACY -> derivationPathState.copy(isVisible = true)
|
||||
null, DerivationStyle.NEW -> derivationPathState.copy(isVisible = false)
|
||||
derivationPathState = if (card.allowToAddCustomDerivation) {
|
||||
derivationPathState.copy(isVisible = true)
|
||||
} else {
|
||||
derivationPathState.copy(isVisible = false)
|
||||
}
|
||||
val form = Form(AddCustomTokenState.createFormFields(card, CustomTokenType.Blockchain))
|
||||
state.copy(
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ data class AddCustomTokenState(
|
|||
|
||||
fun blockchainToName(blockchain: Blockchain, isDerivationPath: Boolean = false): String? {
|
||||
return when {
|
||||
isDerivationPath -> blockchain.derivationPath(cardDerivationStyle)?.rawPath
|
||||
isDerivationPath -> blockchain.derivationPath(DerivationStyle.LEGACY)?.rawPath
|
||||
else -> {
|
||||
when (blockchain) {
|
||||
Blockchain.Unknown -> null
|
||||
|
|
@ -150,10 +150,21 @@ data class AddCustomTokenState(
|
|||
mainNetwork: Blockchain,
|
||||
derivationNetwork: Blockchain,
|
||||
derivationStyle: DerivationStyle?
|
||||
): com.tangem.common.hdWallet.DerivationPath? = when (derivationNetwork) {
|
||||
Blockchain.Unknown -> mainNetwork
|
||||
else -> derivationNetwork
|
||||
}.derivationPath(derivationStyle)
|
||||
): com.tangem.common.hdWallet.DerivationPath? {
|
||||
// If we allow user to select derivations, we need to provide different derivations
|
||||
// (Legacy style derivations).
|
||||
// But the mainNetwork derivation depends on whether a user has a card
|
||||
// with legacy derivations or new style derivations.
|
||||
val derivationStyleToUse = if (derivationNetwork == Blockchain.Unknown) {
|
||||
derivationStyle
|
||||
} else {
|
||||
DerivationStyle.LEGACY
|
||||
}
|
||||
return when (derivationNetwork) {
|
||||
Blockchain.Unknown -> mainNetwork
|
||||
else -> derivationNetwork
|
||||
}.derivationPath(derivationStyleToUse)
|
||||
}
|
||||
|
||||
internal fun createFormFields(card: Card, type: CustomTokenType): List<DataField<*>> {
|
||||
return listOf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue