diff --git a/app/build.gradle b/app/build.gradle index b639eb6dab..df88037b21 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,9 +67,9 @@ dependencies { implementation 'com.google.android.material:material:1.2.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10' - implementation 'com.tangem:blockchain:1.74.0' - implementation 'com.tangem:core:1.63.0' - implementation 'com.tangem:sdk:1.63.0' + implementation 'com.tangem:blockchain:1.76.0' + implementation 'com.tangem:core:1.64.0' + implementation 'com.tangem:sdk:1.64.0' //lifecycle implementation "androidx.lifecycle:lifecycle-runtime:2.2.0" diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletMiddleware.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletMiddleware.kt index da8dc6eeed..18d024a379 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletMiddleware.kt @@ -3,10 +3,7 @@ package com.tangem.tap.features.wallet.redux import android.content.Intent import android.net.Uri import androidx.core.content.ContextCompat -import com.tangem.blockchain.common.Amount -import com.tangem.blockchain.common.AmountType -import com.tangem.blockchain.common.SignatureCountValidator -import com.tangem.blockchain.common.Wallet +import com.tangem.blockchain.common.* import com.tangem.blockchain.extensions.SimpleResult import com.tangem.commands.Card import com.tangem.commands.common.network.Result @@ -218,22 +215,25 @@ private fun checkIfWarningNeeded( private fun checkHashesCountOnline() { if (store.state.walletState.hashesCountVerified != false) return - if (!NetworkConnectivity.getInstance().isOnlineOrConnecting()) return val card = store.state.globalState.scanNoteResponse?.card + if (card == null || preferencesStorage.wasCardScannedBefore(card.cardId)) return + val validator = store.state.globalState.scanNoteResponse?.walletManager as? SignatureCountValidator - scope.launch { - val result = validator?.validateSignatureCount(card?.walletSignedHashes - ?: 0) + val result = validator?.validateSignatureCount(card.walletSignedHashes ?: 0) withContext(Dispatchers.Main) { when (result) { - SimpleResult.Success -> store.dispatch(WalletAction.ConfirmHashesCount) - is SimpleResult.Failure -> store.dispatch( - WalletAction.ShowWarning(WarningType.CardSignedHashesBefore) - ) + SimpleResult.Success -> { + store.dispatch(WalletAction.ConfirmHashesCount) + store.dispatch(WalletAction.SaveCardId) + } + is SimpleResult.Failure -> + if (result.error is BlockchainSdkError.SignatureCountNotMatched) { + store.dispatch(WalletAction.ShowWarning(WarningType.CardSignedHashesBefore)) + } } } }