Updated on 2026-08-14
This commit is contained in:
parent
c2a6235483
commit
e8e7358ef5
3 changed files with 19 additions and 10 deletions
|
|
@ -4,6 +4,7 @@ import android.net.Uri
|
||||||
import com.tangem.blockchain.common.Blockchain
|
import com.tangem.blockchain.common.Blockchain
|
||||||
import com.tangem.common.CompletionResult
|
import com.tangem.common.CompletionResult
|
||||||
import com.tangem.common.core.TangemSdkError
|
import com.tangem.common.core.TangemSdkError
|
||||||
|
import com.tangem.common.extensions.guard
|
||||||
import com.tangem.common.extensions.ifNotNull
|
import com.tangem.common.extensions.ifNotNull
|
||||||
import com.tangem.common.extensions.toHexString
|
import com.tangem.common.extensions.toHexString
|
||||||
import com.tangem.common.services.Result
|
import com.tangem.common.services.Result
|
||||||
|
|
@ -18,6 +19,7 @@ import com.tangem.domain.common.util.derivationStyleProvider
|
||||||
import com.tangem.domain.models.scan.CardDTO
|
import com.tangem.domain.models.scan.CardDTO
|
||||||
import com.tangem.domain.models.scan.ScanResponse
|
import com.tangem.domain.models.scan.ScanResponse
|
||||||
import com.tangem.domain.userwallets.Artwork
|
import com.tangem.domain.userwallets.Artwork
|
||||||
|
import com.tangem.domain.userwallets.UserWalletBuilder
|
||||||
import com.tangem.feature.onboarding.data.model.CreateWalletResponse
|
import com.tangem.feature.onboarding.data.model.CreateWalletResponse
|
||||||
import com.tangem.feature.onboarding.presentation.wallet2.analytics.SeedPhraseSource
|
import com.tangem.feature.onboarding.presentation.wallet2.analytics.SeedPhraseSource
|
||||||
import com.tangem.operations.attestation.OnlineCardVerifier
|
import com.tangem.operations.attestation.OnlineCardVerifier
|
||||||
|
|
@ -40,6 +42,7 @@ import com.tangem.wallet.R
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.rekotlin.Action
|
import org.rekotlin.Action
|
||||||
import org.rekotlin.Middleware
|
import org.rekotlin.Middleware
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
object OnboardingWalletMiddleware {
|
object OnboardingWalletMiddleware {
|
||||||
val handler = onboardingWalletMiddleware
|
val handler = onboardingWalletMiddleware
|
||||||
|
|
@ -501,10 +504,18 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
|
||||||
Analytics.send(Onboarding.Backup.Finished(backupState.backupCardsNumber))
|
Analytics.send(Onboarding.Backup.Finished(backupState.backupCardsNumber))
|
||||||
}
|
}
|
||||||
|
|
||||||
userWalletsListManager.selectedUserWalletSync?.walletId?.let {
|
if (scanResponse != null) {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
|
val userWallet = UserWalletBuilder(scanResponse)
|
||||||
|
.backupCardsIds(backupState.backupCardIds.toSet())
|
||||||
|
.build()
|
||||||
|
.guard {
|
||||||
|
Timber.e("User wallet not created")
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
|
||||||
userWalletsListManager.update(
|
userWalletsListManager.update(
|
||||||
userWalletId = it,
|
userWalletId = userWallet.walletId,
|
||||||
update = { wallet ->
|
update = { wallet ->
|
||||||
wallet.copy(
|
wallet.copy(
|
||||||
scanResponse = updateScanResponseAfterBackup(
|
scanResponse = updateScanResponseAfterBackup(
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,7 @@ private inline fun RowScope.ButtonContentContainer(
|
||||||
progressIndicator()
|
progressIndicator()
|
||||||
} else {
|
} else {
|
||||||
Column {
|
Column {
|
||||||
Row(
|
Row(horizontalArrangement = Arrangement.Center) {
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.Center,
|
|
||||||
) {
|
|
||||||
if (buttonIcon is TangemButtonIconPosition.Start) {
|
if (buttonIcon is TangemButtonIconPosition.Start) {
|
||||||
icon(buttonIcon.iconResId)
|
icon(buttonIcon.iconResId)
|
||||||
Spacer(modifier = Modifier.requiredWidth(iconPadding))
|
Spacer(modifier = Modifier.requiredWidth(iconPadding))
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.factory
|
||||||
import com.tangem.common.Provider
|
import com.tangem.common.Provider
|
||||||
import com.tangem.domain.wallets.models.UserWallet
|
import com.tangem.domain.wallets.models.UserWallet
|
||||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory
|
import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory
|
||||||
|
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
|
||||||
import com.tangem.feature.wallet.presentation.wallet.domain.getCardsCount
|
import com.tangem.feature.wallet.presentation.wallet.domain.getCardsCount
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletState
|
import com.tangem.feature.wallet.presentation.wallet.state.WalletState
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.components.WalletCardState
|
import com.tangem.feature.wallet.presentation.wallet.state.components.WalletCardState
|
||||||
|
|
@ -27,16 +28,16 @@ internal class WalletUpdateCardCountConverter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun WalletsListConfig.refreshCardCount(): WalletsListConfig {
|
private fun WalletsListConfig.refreshCardCount(): WalletsListConfig {
|
||||||
|
val selectedWallet = currentWalletProvider()
|
||||||
return copy(
|
return copy(
|
||||||
wallets = wallets
|
wallets = wallets
|
||||||
.mapIndexed { index, walletCard ->
|
.mapIndexed { index, walletCard ->
|
||||||
if (index == selectedWalletIndex) {
|
if (index == selectedWalletIndex) {
|
||||||
when (walletCard) {
|
when (walletCard) {
|
||||||
is WalletCardState.Content -> walletCard.copy(
|
is WalletCardState.Content -> walletCard.copy(
|
||||||
additionalInfo = WalletAdditionalInfoFactory.resolve(
|
additionalInfo = WalletAdditionalInfoFactory.resolve(wallet = selectedWallet),
|
||||||
wallet = currentWalletProvider(),
|
imageResId = WalletImageResolver.resolve(userWallet = selectedWallet),
|
||||||
),
|
cardCount = selectedWallet.getCardsCount(),
|
||||||
cardCount = currentWalletProvider().getCardsCount(),
|
|
||||||
)
|
)
|
||||||
else -> walletCard
|
else -> walletCard
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue