Updated on 2026-08-14

This commit is contained in:
Tangem 2023-12-06 15:17:41 +04:00
parent d5027aa5f0
commit ec1e5c62fc
9 changed files with 19 additions and 12 deletions

View file

@ -48,6 +48,7 @@ class CardContextInterceptor(
ProductType.Wallet2 -> "Wallet 2.0"
ProductType.Ring -> "Ring"
ProductType.Start2Coin -> "Start2Coin"
ProductType.Visa -> "VISA"
else -> if (DemoHelper.isDemoCard(scanResponse)) {
if (DemoHelper.isTestDemoCard(scanResponse)) {
"Demo Test"

View file

@ -18,6 +18,7 @@ import com.tangem.domain.common.TapWorkarounds.isExcluded
import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease
import com.tangem.domain.common.TapWorkarounds.isStart2Coin
import com.tangem.domain.common.TapWorkarounds.isTangemTwins
import com.tangem.domain.common.TapWorkarounds.isVisa
import com.tangem.domain.common.TwinsHelper
import com.tangem.domain.common.configs.CardConfig
import com.tangem.domain.common.util.derivationStyleProvider
@ -172,10 +173,10 @@ private class ScanWalletProcessor(
}
private fun determineProductTypeForSingleCurrencyWallet(card: CardDTO): ProductType {
return if (card.isStart2Coin) {
ProductType.Start2Coin
} else {
ProductType.Note
return when {
card.isStart2Coin -> ProductType.Start2Coin
card.isVisa -> ProductType.Visa
else -> ProductType.Note
}
}

View file

@ -54,7 +54,7 @@ object OnboardingHelper {
}
fun whereToNavigate(scanResponse: ScanResponse): AppScreen {
return when (scanResponse.productType) {
return when (val type = scanResponse.productType) {
ProductType.Note -> AppScreen.OnboardingNote
ProductType.Wallet,
ProductType.Wallet2,
@ -65,9 +65,9 @@ object OnboardingHelper {
AppScreen.OnboardingOther
}
ProductType.Twins -> AppScreen.OnboardingTwins
ProductType.Start2Coin -> throw java.lang.UnsupportedOperationException(
"Onboarding for Start2Coin cards is not supported",
)
ProductType.Start2Coin,
ProductType.Visa,
-> throw UnsupportedOperationException("Onboarding for ${type.name} cards is not supported")
}
}

View file

@ -53,6 +53,7 @@ internal class DefaultCardSdkConfigRepository(
ProductType.Wallet2,
ProductType.Start2Coin,
ProductType.Ring,
ProductType.Visa,
-> CardIdDisplayFormat.Full
}
}

View file

@ -45,7 +45,7 @@ internal class TangemCardTypesResolver(
card.settings.isKeysImportAllowed
}
override fun isVisaWallet(): Boolean = card.firmwareVersion.doubleValue in FirmwareVersion.visaRange
override fun isVisaWallet(): Boolean = productType == ProductType.Visa
override fun isRing(): Boolean {
return productType == ProductType.Ring

View file

@ -4,7 +4,7 @@ import com.tangem.blockchain.common.Blockchain
import com.tangem.common.card.FirmwareVersion
import com.tangem.domain.demo.DemoConfig
import com.tangem.domain.models.scan.CardDTO
import java.util.*
import java.util.Locale
/**
[REDACTED_AUTHOR]
@ -22,6 +22,9 @@ object TapWorkarounds {
val CardDTO.isStart2Coin: Boolean
get() = isStart2CoinIssuer(issuer.name)
val CardDTO.isVisa: Boolean
get() = firmwareVersion.doubleValue in FirmwareVersion.visaRange
val CardDTO.isTestCard: Boolean
get() = batchId == TEST_CARD_BATCH && cardId.startsWith(TEST_CARD_ID_STARTS_WITH)

View file

@ -20,6 +20,7 @@ class UserWalletBuilder(
ProductType.Note -> "Note"
ProductType.Twins -> "Twin"
ProductType.Start2Coin -> "Start2Coin"
ProductType.Visa -> "Tangem Visa"
ProductType.Wallet,
ProductType.Wallet2,
ProductType.Ring,
@ -28,7 +29,6 @@ class UserWalletBuilder(
cardTypesResolver.isStart2Coin() -> "Start2Coin"
else -> "Wallet"
}
ProductType.Wallet2 -> "Wallet"
}
/**

View file

@ -63,6 +63,7 @@ class UserWalletIdBuilder private constructor(
ProductType.Wallet2,
ProductType.Ring,
ProductType.Start2Coin,
ProductType.Visa,
-> null
},
)

View file

@ -21,5 +21,5 @@ data class ScanResponse(
typealias KeyWalletPublicKey = ByteArrayKey
enum class ProductType {
Note, Twins, Wallet, Start2Coin, Wallet2, Ring
Note, Twins, Wallet, Start2Coin, Wallet2, Ring, Visa,
}