Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-11 20:25:30 +04:00
parent 3935ed7635
commit ee556fefaf
2 changed files with 24 additions and 13 deletions

View file

@ -1,14 +1,15 @@
package com.tangem.feature.wallet.presentation.wallet.domain
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.domain.card.repository.CardRepository
import com.tangem.domain.card.common.util.cardTypesResolver
import com.tangem.domain.card.repository.CardRepository
import com.tangem.domain.demo.models.DemoConfig
import com.tangem.domain.models.network.Network
import com.tangem.domain.walletmanager.WalletManagersFacade
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.walletmanager.WalletManagersFacade
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import timber.log.Timber
import javax.inject.Inject
@ModelScoped
@ -27,18 +28,23 @@ class HasSingleWalletSignedHashesUseCase @Inject constructor(
return@map false
}
return@map walletManagersFacade.validateSignatureCount(
userWalletId = userWallet.walletId,
network = network,
signedHashes = userWallet.scanResponse.card.wallets.firstOrNull()?.totalSignedHashes ?: 0,
)
.fold(
ifLeft = { true },
ifRight = {
cardRepository.setCardWasScanned(cardId = userWallet.cardId)
false
},
return@map try {
walletManagersFacade.validateSignatureCount(
userWalletId = userWallet.walletId,
network = network,
signedHashes = userWallet.scanResponse.card.wallets.firstOrNull()?.totalSignedHashes ?: 0,
)
.fold(
ifLeft = { true },
ifRight = {
cardRepository.setCardWasScanned(cardId = userWallet.cardId)
false
},
)
} catch (e: IllegalArgumentException) {
Timber.w(e, "Unable to validate signature count: user wallet not found")
false
}
}
}

View file

@ -17,6 +17,11 @@ internal class DeleteWalletTransformer(
val deletedWalletUM = prevState.getDeletedWalletState2()
return when {
deletedWalletUM != null && deletedWalletState != null -> prevState.copy(
selectedWalletIndex = selectedWalletIndex,
wallets = (prevState.wallets - deletedWalletState).toImmutableList(),
wallets2 = (prevState.wallets2 - deletedWalletUM).toImmutableList(),
)
deletedWalletUM != null -> prevState.copy(
selectedWalletIndex = selectedWalletIndex,
wallets2 = (prevState.wallets2 - deletedWalletUM).toImmutableList(),