From bf0a1ee7b8eb8083818a872667ba21eaaf096b0f Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Dec 2020 19:53:52 +0300 Subject: [PATCH] Updated on 2026-08-14 --- app/build.gradle | 4 ++-- .../java/com/tangem/tap/domain/TangemSdkManager.kt | 10 ++++++++-- .../java/com/tangem/tap/domain/TapWalletManager.kt | 7 +++---- .../java/com/tangem/tap/domain/tasks/ScanNoteTask.kt | 3 ++- .../tap/features/details/redux/DetailsReducer.kt | 4 ++-- .../tangem/tap/features/home/redux/HomeMiddleware.kt | 1 + .../tap/features/wallet/redux/WalletMiddleware.kt | 1 + 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3428782d33..5e3c0acf1d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,8 +72,8 @@ dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1' implementation 'com.tangem:blockchain:1.123.0' - implementation 'com.tangem:core:1.88.0' - implementation 'com.tangem:sdk:1.88.0' + implementation 'com.tangem:core:1.89.0' + implementation 'com.tangem:sdk:1.89.0' // WebView implementation "androidx.browser:browser:1.2.0" diff --git a/app/src/main/java/com/tangem/tap/domain/TangemSdkManager.kt b/app/src/main/java/com/tangem/tap/domain/TangemSdkManager.kt index e34ddfe8c7..77d26702ab 100644 --- a/app/src/main/java/com/tangem/tap/domain/TangemSdkManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/TangemSdkManager.kt @@ -3,6 +3,7 @@ package com.tangem.tap.domain import androidx.activity.ComponentActivity import com.tangem.* import com.tangem.commands.* +import com.tangem.commands.common.card.Card import com.tangem.commands.common.card.CardType import com.tangem.common.CompletionResult import com.tangem.common.extensions.calculateSha256 @@ -12,6 +13,7 @@ import com.tangem.tap.common.analytics.AnalyticsHandler import com.tangem.tap.domain.tasks.CreateWalletAndRescanTask import com.tangem.tap.domain.tasks.ScanNoteResponse import com.tangem.tap.domain.tasks.ScanNoteTask +import com.tangem.tap.domain.twins.isTwinCard import com.tangem.wallet.R import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -65,7 +67,7 @@ class TangemSdkManager(val activity: ComponentActivity) { } suspend fun runTaskAsync( - runnable: CardSessionRunnable, cardId: String? = null, initialMessage: Message? = null + runnable: CardSessionRunnable, cardId: String? = null, initialMessage: Message? = null, ): CompletionResult = withContext(Dispatchers.IO) { suspendCoroutine { continuation -> @@ -76,9 +78,13 @@ class TangemSdkManager(val activity: ComponentActivity) { } private suspend fun runTaskAsyncReturnOnMain( - runnable: CardSessionRunnable, cardId: String? = null, initialMessage: Message? = null + runnable: CardSessionRunnable, cardId: String? = null, initialMessage: Message? = null, ): CompletionResult { val result = runTaskAsync(runnable, cardId, initialMessage) return withContext(Dispatchers.Main) { result } } + + fun changeDisplayedCardIdNumbersCount(card: Card) { + tangemSdk.config.cardIdDisplayedNumbersCount = if (card.isTwinCard()) 4 else null + } } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt b/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt index c26f2b36a2..36dd3c238c 100644 --- a/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt @@ -5,7 +5,6 @@ import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.Wallet import com.tangem.blockchain.common.WalletManager import com.tangem.commands.common.card.CardStatus -import com.tangem.commands.common.card.masks.Product import com.tangem.commands.common.network.Result import com.tangem.common.extensions.toHexString import com.tangem.tap.common.analytics.AnalyticsEvent @@ -18,6 +17,7 @@ import com.tangem.tap.domain.extensions.amountToCreateAccount import com.tangem.tap.domain.extensions.isNoAccountError import com.tangem.tap.domain.tasks.ScanNoteResponse import com.tangem.tap.domain.twins.TwinsHelper +import com.tangem.tap.domain.twins.isTwinCard import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.network.NetworkConnectivity import com.tangem.tap.network.coinmarketcap.CoinMarketCapService @@ -102,7 +102,7 @@ class TapWalletManager { withContext(Dispatchers.Main) { store.dispatch(WalletAction.ResetState) store.dispatch(GlobalAction.SaveScanNoteResponse(data)) - if (data.card.cardData?.productMask?.contains(Product.TwinCard) == true) { + if (data.card.isTwinCard()) { val secondCardId = TwinsHelper.getTwinsCardId(data.card.cardId) val cardNumber = TwinsHelper.getTwinCardNumber(data.card.cardId) if (secondCardId != null && cardNumber != null) { @@ -131,8 +131,7 @@ class TapWalletManager { store.dispatch(WalletAction.LoadArtwork(data.card, artworkId)) store.dispatch(WalletAction.LoadFiatRate) store.dispatch(WalletAction.LoadPayId) - } else if (data.card.status == CardStatus.Empty || - data.card.cardData?.productMask?.contains(Product.TwinCard) == true) { + } else if (data.card.status == CardStatus.Empty || data.card.isTwinCard()) { store.dispatch(WalletAction.EmptyWallet) store.dispatch(WalletAction.LoadArtwork(data.card, artworkId)) } else { diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/ScanNoteTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/ScanNoteTask.kt index f106f2a930..dfa1752929 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/ScanNoteTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/ScanNoteTask.kt @@ -17,6 +17,7 @@ import com.tangem.common.CompletionResult import com.tangem.common.extensions.toHexString import com.tangem.tap.domain.TapSdkError import com.tangem.tap.domain.twins.TwinCardsManager +import com.tangem.tap.domain.twins.isTwinCard import com.tangem.tasks.ScanTask data class ScanNoteResponse( @@ -46,7 +47,7 @@ class ScanNoteTask(val card: Card? = null) : CardSessionRunnable { + tangemSdkManager.changeDisplayedCardIdNumbersCount(result.data.card) store.dispatch(GlobalAction.RestoreAppCurrency) store.state.globalState.tapWalletManager.onCardScanned(result.data) showDisclaimerOrNavigateToWallet() 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 c838228c2b..2f2c041924 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 @@ -125,6 +125,7 @@ class WalletMiddleware { val result = tangemSdkManager.scanNote(FirebaseAnalyticsHandler) when (result) { is CompletionResult.Success -> { + tangemSdkManager.changeDisplayedCardIdNumbersCount(result.data.card) store.state.globalState.tapWalletManager .onCardScanned(result.data, true) if (store.state.walletState.twinCardsState != null) {