Updated on 2026-08-14

This commit is contained in:
Tangem 2023-11-10 17:06:12 +08:00
parent c2a6235483
commit e8e7358ef5
3 changed files with 19 additions and 10 deletions

View file

@ -4,6 +4,7 @@ import android.net.Uri
import com.tangem.blockchain.common.Blockchain
import com.tangem.common.CompletionResult
import com.tangem.common.core.TangemSdkError
import com.tangem.common.extensions.guard
import com.tangem.common.extensions.ifNotNull
import com.tangem.common.extensions.toHexString
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.ScanResponse
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.presentation.wallet2.analytics.SeedPhraseSource
import com.tangem.operations.attestation.OnlineCardVerifier
@ -40,6 +42,7 @@ import com.tangem.wallet.R
import kotlinx.coroutines.launch
import org.rekotlin.Action
import org.rekotlin.Middleware
import timber.log.Timber
object OnboardingWalletMiddleware {
val handler = onboardingWalletMiddleware
@ -501,10 +504,18 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
Analytics.send(Onboarding.Backup.Finished(backupState.backupCardsNumber))
}
userWalletsListManager.selectedUserWalletSync?.walletId?.let {
if (scanResponse != null) {
scope.launch {
val userWallet = UserWalletBuilder(scanResponse)
.backupCardsIds(backupState.backupCardIds.toSet())
.build()
.guard {
Timber.e("User wallet not created")
return@launch
}
userWalletsListManager.update(
userWalletId = it,
userWalletId = userWallet.walletId,
update = { wallet ->
wallet.copy(
scanResponse = updateScanResponseAfterBackup(

View file

@ -109,10 +109,7 @@ private inline fun RowScope.ButtonContentContainer(
progressIndicator()
} else {
Column {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Center,
) {
Row(horizontalArrangement = Arrangement.Center) {
if (buttonIcon is TangemButtonIconPosition.Start) {
icon(buttonIcon.iconResId)
Spacer(modifier = Modifier.requiredWidth(iconPadding))

View file

@ -3,6 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.factory
import com.tangem.common.Provider
import com.tangem.domain.wallets.models.UserWallet
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.state.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.components.WalletCardState
@ -27,16 +28,16 @@ internal class WalletUpdateCardCountConverter(
}
private fun WalletsListConfig.refreshCardCount(): WalletsListConfig {
val selectedWallet = currentWalletProvider()
return copy(
wallets = wallets
.mapIndexed { index, walletCard ->
if (index == selectedWalletIndex) {
when (walletCard) {
is WalletCardState.Content -> walletCard.copy(
additionalInfo = WalletAdditionalInfoFactory.resolve(
wallet = currentWalletProvider(),
),
cardCount = currentWalletProvider().getCardsCount(),
additionalInfo = WalletAdditionalInfoFactory.resolve(wallet = selectedWallet),
imageResId = WalletImageResolver.resolve(userWallet = selectedWallet),
cardCount = selectedWallet.getCardsCount(),
)
else -> walletCard
}