Updated on 2026-08-14
This commit is contained in:
parent
0727a63e43
commit
1e6ee16b22
3 changed files with 37 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package com.tangem.tap.domain
|
|||
import com.tangem.commands.common.card.Card
|
||||
import com.tangem.commands.common.card.EllipticCurve
|
||||
import com.tangem.commands.common.card.masks.Product
|
||||
import com.tangem.tap.domain.TapWorkarounds.isNote
|
||||
import com.tangem.tap.domain.TapWorkarounds.isStart2Coin
|
||||
import com.tangem.tap.domain.extensions.getSingleWallet
|
||||
import java.util.*
|
||||
|
|
@ -27,6 +28,14 @@ object TapWorkarounds {
|
|||
|
||||
}
|
||||
|
||||
fun Card.isNote(): Boolean {
|
||||
return notesBatches.contains(cardData?.batchId)
|
||||
}
|
||||
|
||||
fun Card.isMultiCurrencyWallet(): Boolean {
|
||||
return multiCurrencyWalletsBatches.contains(cardData?.batchId)
|
||||
}
|
||||
|
||||
private const val START_2_COIN_ISSUER = "start2coin"
|
||||
|
||||
private val excludedBatches = listOf(
|
||||
|
|
@ -39,12 +48,24 @@ object TapWorkarounds {
|
|||
private val excludedIssuers = listOf(
|
||||
"TTM BANK"
|
||||
)
|
||||
|
||||
private val notesBatches = listOf(
|
||||
"AB01",
|
||||
"AB02",
|
||||
"AB03",
|
||||
"AB04",
|
||||
"AB05",
|
||||
"AB06",
|
||||
)
|
||||
|
||||
private val multiCurrencyWalletsBatches = listOf("AC01")
|
||||
}
|
||||
|
||||
val Card.isMultiwalletAllowed: Boolean
|
||||
get() {
|
||||
return cardData?.productMask?.contains(Product.TwinCard) != true
|
||||
&& !isStart2Coin
|
||||
&& !isNote()
|
||||
&& (firmwareVersion.major >= 4 ||
|
||||
getSingleWallet()?.curve == EllipticCurve.Secp256k1)
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ import com.tangem.common.CompletionResult
|
|||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.tap.domain.TapSdkError
|
||||
import com.tangem.tap.domain.TapWorkarounds.isExcluded
|
||||
import com.tangem.tap.domain.TapWorkarounds.isMultiCurrencyWallet
|
||||
import com.tangem.tap.domain.extensions.getSingleWallet
|
||||
import com.tangem.tap.domain.extensions.getStatus
|
||||
import com.tangem.tap.domain.twins.TwinCardsManager
|
||||
|
|
@ -23,6 +24,7 @@ import com.tangem.tap.store
|
|||
import com.tangem.tasks.PreflightReadCapable
|
||||
import com.tangem.tasks.PreflightReadSettings
|
||||
import com.tangem.tasks.ScanTask
|
||||
import com.tangem.wallet.R
|
||||
|
||||
data class ScanNoteResponse(
|
||||
val card: Card,
|
||||
|
|
@ -147,6 +149,8 @@ class ScanNoteTask(val card: Card? = null) : CardSessionRunnable<ScanNoteRespons
|
|||
if (card.isExcluded()) return TapSdkError.CardForDifferentApp
|
||||
if (card.status == CardStatus.Purged) return TangemSdkError.WalletIsPurged()
|
||||
if (card.status == CardStatus.NotPersonalized) return TangemSdkError.NotPersonalized()
|
||||
// Disable new multi-currency HD wallet cards on the old version of the app
|
||||
if (card.isMultiCurrencyWallet()) return UpdateAppToUseThisCard()
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
@ -157,3 +161,13 @@ class ScanNoteTask(val card: Card? = null) : CardSessionRunnable<ScanNoteRespons
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class UpdateAppToUseThisCard : TangemError {
|
||||
override val code: Int = 50005
|
||||
override var customMessage: String = code.toString()
|
||||
override val messageResId: Int
|
||||
get() = R.string.error_update_app
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -156,4 +156,6 @@ this wallet.
|
|||
<string name="wallet_connect_scanner_error_no_ethereum_wallet" translatable="false">This card can’t be used to establish WalletConnect session</string>
|
||||
<string name="wallet_connect_could_not_complete" translatable="false">The operation couldn\'t be completed</string>
|
||||
<string name="wallet_connect_same_wcuri" translatable="false">The operation couldn\'t be completed. \n\nYou have already established a WalletConnect session with this parameters.</string>
|
||||
|
||||
<string name="error_update_app" translatable="false">Oops, the current version of the application is not ready to work with this card, please check for updates.</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue