Updated on 2026-08-14
This commit is contained in:
commit
a2e049ee27
7 changed files with 42 additions and 15 deletions
|
|
@ -151,7 +151,9 @@ private class CreateWalletTangemWallet(
|
|||
) {
|
||||
val config = CardConfig.createConfig(card)
|
||||
val walletsOnCard = card.wallets.map { it.curve }.toSet()
|
||||
val curves = card.supportedCurves.intersect(config.mandatoryCurves.toSet()).subtract(walletsOnCard).toList()
|
||||
val curves = config.mandatoryCurves.toSet()
|
||||
.intersect(card.supportedCurves.toSet())
|
||||
.subtract(walletsOnCard).toList()
|
||||
|
||||
if (curves.isEmpty()) {
|
||||
val createWalletResponses = card.wallets.map { wallet ->
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.tangem.common.CardIdFormatter
|
|||
import com.tangem.common.CompletionResult
|
||||
import com.tangem.common.core.CardIdDisplayFormat
|
||||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.domain.common.util.cardTypesResolver
|
||||
import com.tangem.feature.onboarding.data.model.CreateWalletResponse
|
||||
import com.tangem.feature.onboarding.presentation.wallet2.analytics.SeedPhraseSource
|
||||
import com.tangem.feature.onboarding.presentation.wallet2.viewmodel.SeedPhraseMediator
|
||||
|
|
@ -64,6 +65,7 @@ class OnboardingWalletFragment :
|
|||
private val seedPhraseViewModel by viewModels<SeedPhraseViewModel>()
|
||||
|
||||
private lateinit var cardsWidget: WalletCardsWidget
|
||||
private var seedPhraseRouter: SeedPhraseRouter? = null
|
||||
private var accessCodeDialog: AccessCodeDialog? = null
|
||||
|
||||
private lateinit var animator: BackupAnimator
|
||||
|
|
@ -77,7 +79,9 @@ class OnboardingWalletFragment :
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
seedPhraseViewModel.setRouter(makeSeedPhraseRouter())
|
||||
val newSeedPhraseRouter = makeSeedPhraseRouter()
|
||||
seedPhraseRouter = newSeedPhraseRouter
|
||||
seedPhraseViewModel.setRouter(newSeedPhraseRouter)
|
||||
seedPhraseViewModel.setMediator(makeSeedPhraseMediator())
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +199,6 @@ class OnboardingWalletFragment :
|
|||
OnboardingWalletStep.CreateWallet -> setupCreateWalletState()
|
||||
OnboardingWalletStep.Backup -> setBackupState(
|
||||
state = state.backupState,
|
||||
isWallet2 = state.wallet2State != null,
|
||||
)
|
||||
|
||||
else -> {}
|
||||
|
|
@ -220,9 +223,9 @@ class OnboardingWalletFragment :
|
|||
animator.setupCreateWalletState()
|
||||
}
|
||||
|
||||
private fun setBackupState(state: BackupState, isWallet2: Boolean) {
|
||||
private fun setBackupState(state: BackupState) {
|
||||
when (state.backupStep) {
|
||||
BackupStep.InitBackup -> showBackupIntro(state, isWallet2)
|
||||
BackupStep.InitBackup -> showBackupIntro(state)
|
||||
BackupStep.ScanOriginCard -> showScanOriginCard()
|
||||
BackupStep.AddBackupCards -> showAddBackupCards(state)
|
||||
BackupStep.SetAccessCode -> showSetAccessCode()
|
||||
|
|
@ -234,7 +237,7 @@ class OnboardingWalletFragment :
|
|||
}
|
||||
}
|
||||
|
||||
private fun showBackupIntro(state: BackupState, isWallet2: Boolean) = with(binding) {
|
||||
private fun showBackupIntro(state: BackupState) = with(binding) {
|
||||
imvFirstBackupCard.show()
|
||||
imvSecondBackupCard.show()
|
||||
|
||||
|
|
@ -250,7 +253,7 @@ class OnboardingWalletFragment :
|
|||
|
||||
btnWalletAlternativeAction.text = getText(R.string.onboarding_button_skip_backup)
|
||||
btnWalletAlternativeAction.setOnClickListener { store.dispatch(BackupAction.SkipBackup) }
|
||||
btnWalletAlternativeAction.show(state.canSkipBackup && !isWallet2)
|
||||
btnWalletAlternativeAction.show(state.canSkipBackup)
|
||||
}
|
||||
animator.showBackupIntro(state)
|
||||
}
|
||||
|
|
@ -443,6 +446,19 @@ class OnboardingWalletFragment :
|
|||
}
|
||||
|
||||
override fun handleOnBackPressed() {
|
||||
// workaround to use right navigation back for toolbar back btn on seed phrase flow
|
||||
val isWallet2 =
|
||||
store.state.globalState.onboardingState.onboardingManager?.scanResponse?.cardTypesResolver?.isWallet2()
|
||||
?: false
|
||||
val seedPhraseRouter = seedPhraseRouter
|
||||
if (seedPhraseRouter != null && isWallet2) {
|
||||
seedPhraseRouter.navigateBack()
|
||||
} else {
|
||||
legacyOnBackHandler()
|
||||
}
|
||||
}
|
||||
|
||||
private fun legacyOnBackHandler() {
|
||||
store.dispatch(OnboardingWalletAction.OnBackPressed)
|
||||
}
|
||||
|
||||
|
|
@ -453,7 +469,7 @@ class OnboardingWalletFragment :
|
|||
}
|
||||
|
||||
private fun makeSeedPhraseRouter(): SeedPhraseRouter = SeedPhraseRouter(
|
||||
onBack = ::handleOnBackPressed,
|
||||
onBack = ::legacyOnBackHandler,
|
||||
onOpenChat = {
|
||||
store.dispatch(GlobalAction.OpenChat(SupportInfo()))
|
||||
},
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ internal class TokensListViewModel @Inject constructor(
|
|||
val supportedTokens = scanResponse.card.supportedTokens(cardTypesResolver)
|
||||
|
||||
// refactor this later by moving all this logic in card config
|
||||
if (!supportedTokens.contains(Blockchain.Solana)) {
|
||||
if (blockchain == Blockchain.Solana && !supportedTokens.contains(Blockchain.Solana)) {
|
||||
return SupportTokensState.SolanaNetworkUnsupported
|
||||
}
|
||||
val canHandleToken = scanResponse.card.canHandleToken(
|
||||
|
|
|
|||
|
|
@ -399,6 +399,12 @@ class DemoConfig {
|
|||
"AB02000000048063",
|
||||
"AB02000000023736",
|
||||
"AB02000000058187",
|
||||
|
||||
// Wallet 2
|
||||
"AF04000000012006",
|
||||
"AF04000000012014",
|
||||
"AF04000000012022",
|
||||
"AF04000000012030",
|
||||
)
|
||||
|
||||
@Suppress("ClassOrdering")
|
||||
|
|
@ -406,6 +412,7 @@ class DemoConfig {
|
|||
"FB20000000000186", // Note ETH
|
||||
"FB10000000000196", // Note BTC
|
||||
"FB30000000000176", // Wallet
|
||||
"FB04000000000152", // Wallet 2
|
||||
)
|
||||
|
||||
@Suppress("ClassOrdering")
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.domain.common
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.common.card.Card
|
||||
import com.tangem.common.card.FirmwareVersion
|
||||
import com.tangem.domain.demo.DemoConfig
|
||||
import com.tangem.domain.models.scan.CardDTO
|
||||
import java.util.*
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ object TapWorkarounds {
|
|||
private const val TEST_CARD_BATCH = "99FF"
|
||||
private const val TEST_CARD_ID_STARTS_WITH = "FF99"
|
||||
private val backupRequiredFirmwareVersion = FirmwareVersion(major = 6, minor = 21)
|
||||
private val demoConfig = DemoConfig()
|
||||
|
||||
val CardDTO.isTangemTwins: Boolean
|
||||
get() = TwinsHelper.getTwinCardNumber(cardId) != null
|
||||
|
|
@ -26,7 +28,7 @@ object TapWorkarounds {
|
|||
|
||||
// for cards 6.21 and higher backup is not skippable
|
||||
val CardDTO.canSkipBackup: Boolean
|
||||
get() = this.firmwareVersion < backupRequiredFirmwareVersion
|
||||
get() = this.firmwareVersion < backupRequiredFirmwareVersion || demoConfig.isDemoCardId(cardId)
|
||||
|
||||
val CardDTO.useOldStyleDerivation: Boolean
|
||||
get() = batchId == "AC01" || batchId == "AC02" || batchId == "CB95"
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ object Wallet2CardConfig : CardConfig {
|
|||
get() = listOf(
|
||||
EllipticCurve.Secp256k1,
|
||||
EllipticCurve.Ed25519,
|
||||
EllipticCurve.Bip0340,
|
||||
EllipticCurve.Bls12381G2Aug,
|
||||
EllipticCurve.Bip0340,
|
||||
EllipticCurve.Ed25519Slip0010,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ class SeedPhraseRouter(
|
|||
fun navigateBack() {
|
||||
_currentScreen.value = when (_currentScreen.value) {
|
||||
SeedPhraseScreen.CheckSeedPhrase -> SeedPhraseScreen.YourSeedPhrase
|
||||
SeedPhraseScreen.Intro,
|
||||
SeedPhraseScreen.AboutSeedPhrase,
|
||||
SeedPhraseScreen.YourSeedPhrase,
|
||||
SeedPhraseScreen.AboutSeedPhrase -> SeedPhraseScreen.Intro
|
||||
SeedPhraseScreen.ImportSeedPhrase,
|
||||
-> {
|
||||
SeedPhraseScreen.YourSeedPhrase,
|
||||
-> SeedPhraseScreen.AboutSeedPhrase
|
||||
SeedPhraseScreen.Intro -> {
|
||||
onBack.invoke()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue