From 3591aeffda49e2ea6bdedf45547f7938127fcbae Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 26 Apr 2021 10:20:08 +0300 Subject: [PATCH 01/16] Updated on 2026-08-14 --- app/src/main/assets/tangem-android-config | 1 - app/src/main/assets/tangem-app-config | 1 + app/src/main/java/com/tangem/tap/domain/configurable/Loader.kt | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 160000 app/src/main/assets/tangem-android-config create mode 160000 app/src/main/assets/tangem-app-config diff --git a/app/src/main/assets/tangem-android-config b/app/src/main/assets/tangem-android-config deleted file mode 160000 index cbdda0d566..0000000000 --- a/app/src/main/assets/tangem-android-config +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cbdda0d566da0dd1baa534fd5ce815ce7c88cea0 diff --git a/app/src/main/assets/tangem-app-config b/app/src/main/assets/tangem-app-config new file mode 160000 index 0000000000..415eb6e9cc --- /dev/null +++ b/app/src/main/assets/tangem-app-config @@ -0,0 +1 @@ +Subproject commit 415eb6e9ccfcdc3573391b869adeba433f790087 diff --git a/app/src/main/java/com/tangem/tap/domain/configurable/Loader.kt b/app/src/main/java/com/tangem/tap/domain/configurable/Loader.kt index 3471ed78ee..873b71c500 100644 --- a/app/src/main/java/com/tangem/tap/domain/configurable/Loader.kt +++ b/app/src/main/java/com/tangem/tap/domain/configurable/Loader.kt @@ -10,7 +10,7 @@ interface Loader { companion object { const val featuresName = "features_${BuildConfig.CONFIG_ENVIRONMENT}" - const val configValuesName = "tangem-android-config/config_${BuildConfig.CONFIG_ENVIRONMENT}" + const val configValuesName = "tangem-app-config/config_${BuildConfig.CONFIG_ENVIRONMENT}" const val warnings = "warnings_${BuildConfig.CONFIG_ENVIRONMENT}" } } \ No newline at end of file From fe59a7532ec1e1da25e85b07756da83fb185b1b3 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 17 Jun 2021 09:38:01 +0300 Subject: [PATCH 02/16] Updated on 2026-08-14 --- app/build.gradle | 6 +---- .../java/com/tangem/tap/TapApplication.kt | 3 +++ build.gradle | 24 +++---------------- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5e41bbe87f..febc5293ea 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { implementation 'com.google.android.play:core-ktx:1.8.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' - implementation 'com.tangem:blockchain:develop-17' + implementation 'com.tangem:blockchain:develop-22' implementation 'com.tangem:core:develop-36' implementation 'com.tangem:sdk:develop-36' @@ -117,10 +117,6 @@ dependencies { implementation 'com.squareup.moshi:moshi:1.9.2' implementation "com.squareup.moshi:moshi-kotlin:1.9.2" implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2' -// -// //Crypto - implementation "com.madgag.spongycastle:core:1.58.0.0" - testImplementation 'junit:junit:4.13.2' testImplementation "com.google.truth:truth:1.0.1" diff --git a/app/src/main/java/com/tangem/tap/TapApplication.kt b/app/src/main/java/com/tangem/tap/TapApplication.kt index 491f1c9cfb..166ae2183f 100644 --- a/app/src/main/java/com/tangem/tap/TapApplication.kt +++ b/app/src/main/java/com/tangem/tap/TapApplication.kt @@ -5,6 +5,7 @@ import com.google.firebase.ktx.Firebase import com.google.firebase.remoteconfig.ktx.remoteConfig import com.google.firebase.remoteconfig.ktx.remoteConfigSettings import com.tangem.Log +import com.tangem.blockchain.network.BlockchainSdkRetrofitBuilder import com.tangem.tap.common.images.PicassoHelper import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.appReducer @@ -58,6 +59,8 @@ class TapApplication : Application() { initFeedbackManager() loadConfigs() + + BlockchainSdkRetrofitBuilder.enableNetworkLogging = BuildConfig.DEBUG } private fun loadConfigs() { diff --git a/build.gradle b/build.gradle index 576034574e..f2dcf4b2fe 100644 --- a/build.gradle +++ b/build.gradle @@ -19,28 +19,10 @@ buildscript { allprojects { repositories { google() + jcenter() + mavenLocal() + maven { url "https://nexus.tangem-tech.com/repository/maven-releases/" } maven { url 'https://jitpack.io' } - def nexusUser = "viewer" - def nexusPass = "smartcash124" - repositories { - google() - jcenter() - maven { - credentials { - username = nexusUser - password = nexusPass - } - url "https://nexus.tangem-tech.com/repository/maven-releases/" - } - maven { - credentials { - username = nexusUser - password = nexusPass - } - url "https://nexus.tangem-tech.com/repository/maven-snapshots/" - } - maven { url 'https://jitpack.io' } - } } } From 9f1f4999396aef98a83ef34124c428aaded42437 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 17 Jun 2021 09:54:39 +0300 Subject: [PATCH 03/16] Updated on 2026-08-14 --- .../tap/domain/tokens/CurrenciesRepository.kt | 4 ++++ .../redux/middlewares/MultiWalletMiddleware.kt | 15 ++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt b/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt index 417c3cb79e..8ddbc8b5d1 100644 --- a/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt @@ -37,6 +37,10 @@ class CurrenciesRepository(val context: Application) { saveTokens(cardId, tokens) } + fun saveAddedTokens(cardId: String, tokens: Collection) { + saveTokens(cardId, loadSavedTokens(cardId) + tokens) + } + fun saveAddedBlockchain(cardId: String, blockchain: Blockchain) { val blockchains = loadSavedBlockchains(cardId) + blockchain saveBlockchains(cardId, blockchains) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt index d35eea4fd3..905ecce398 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/MultiWalletMiddleware.kt @@ -44,14 +44,14 @@ class MultiWalletMiddleware { addTokens(action.tokens, walletState, globalState) } is WalletAction.MultiWallet.AddBlockchain -> { - if (walletState?.blockchains?.contains(action.blockchain) == true) return - globalState?.scanNoteResponse?.card?.let { card -> currenciesRepository.saveAddedBlockchain(card.cardId, action.blockchain) - globalState.tapWalletManager.walletManagerFactory + if (walletState?.blockchains?.contains(action.blockchain) != true) { + globalState.tapWalletManager.walletManagerFactory .makeWalletManagerForApp(card, action.blockchain)?.let { store.dispatch(WalletAction.MultiWallet.AddWalletManagers(it)) } + } } store.dispatch(WalletAction.LoadFiatRate(currency = Currency.Blockchain(action.blockchain))) store.dispatch(WalletAction.LoadWallet(blockchain = action.blockchain)) @@ -87,12 +87,12 @@ class MultiWalletMiddleware { val wallet = walletManager.wallet val coinAmount = wallet.amounts[AmountType.Coin]?.value if (coinAmount != null && !coinAmount.isZero()) { - if (walletState?.getWalletData(wallet.blockchain) == null) { - scope.launch(Dispatchers.Main) { + scope.launch(Dispatchers.Main) { + if (walletState?.getWalletData(wallet.blockchain) == null) { store.dispatch(WalletAction.MultiWallet.AddWalletManagers( - listOfNotNull(walletManager))) + listOfNotNull(walletManager))) store.dispatch(WalletAction.MultiWallet.AddBlockchain( - wallet.blockchain + wallet.blockchain )) store.dispatch(WalletAction.LoadWallet.Success(wallet)) } @@ -118,6 +118,7 @@ class MultiWalletMiddleware { when (result) { is Result.Success -> { if (result.data.isNotEmpty()) { + currenciesRepository.saveAddedTokens(card.cardId, result.data) store.dispatch( WalletAction.MultiWallet.AddWalletManagers( walletManager From 6840890e9e6b6a19068eb47d848f8c62bbd579a7 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 17 Jun 2021 10:30:22 +0300 Subject: [PATCH 04/16] Updated on 2026-08-14 --- .../main/java/com/tangem/tap/common/extensions/Blockchain.kt | 1 + .../main/java/com/tangem/tap/domain/extensions/Blockchain.kt | 1 + .../tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt | 5 +---- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/common/extensions/Blockchain.kt b/app/src/main/java/com/tangem/tap/common/extensions/Blockchain.kt index dc12172a82..0ca68b4ea3 100644 --- a/app/src/main/java/com/tangem/tap/common/extensions/Blockchain.kt +++ b/app/src/main/java/com/tangem/tap/common/extensions/Blockchain.kt @@ -19,5 +19,6 @@ fun Blockchain.getIconRes(): Int { Blockchain.Tezos -> R.drawable.ic_tezos Blockchain.XRP -> R.drawable.ic_xrp Blockchain.Stellar -> R.drawable.ic_stellar + else -> R.drawable.shape_circle } } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt b/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt index 17cac3c3e6..3fb9fb0d67 100644 --- a/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt +++ b/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt @@ -35,6 +35,7 @@ fun Blockchain.getSupportedCurves(): List? { Blockchain.Tezos -> listOf(EllipticCurve.Secp256k1, EllipticCurve.Ed25519) Blockchain.Cardano, Blockchain.CardanoShelley, Blockchain.Stellar -> listOf(EllipticCurve.Ed25519) + else -> listOf(EllipticCurve.Secp256k1) } } diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt index 6c0328c7ce..62e9849d04 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt @@ -18,9 +18,6 @@ import com.tangem.tap.features.wallet.ui.BalanceStatus import com.tangem.tap.store import com.tangem.wallet.R import kotlinx.android.synthetic.main.item_currency_wallet.view.* -import kotlinx.android.synthetic.main.item_currency_wallet.view.iv_currency -import kotlinx.android.synthetic.main.item_currency_wallet.view.tv_currency_symbol -import kotlinx.android.synthetic.main.item_currency_wallet.view.tv_token_letter import java.math.BigDecimal class WalletAdapter @@ -57,7 +54,7 @@ class WalletAdapter val sorted = listModified.sortedWith( compareByDescending { it.currencyData.fiatAmount ?: BigDecimal.ZERO } - .thenBy { it.currencyData.currencySymbol } + .thenBy { it.currencyData.currency } ) val sortedList = listOfNotNull(primaryBlockchainWallet, primaryTokenWallet) + sorted super.submitList(sortedList) From 4436e749231ccdaa05a47a961bf7193d28de7237 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 17 Jun 2021 11:48:03 +0300 Subject: [PATCH 05/16] Updated on 2026-08-14 --- .../com/tangem/tap/common/DialogManager.kt | 8 +++---- .../walletconnect/WalletConnectMiddleware.kt | 4 ++++ .../walletconnect/WalletConnectReducer.kt | 1 + .../redux/walletconnect/WalletConnectState.kt | 1 + .../dialogs/UnsupportedCardDialog.kt | 24 +++++++++++++++++++ .../main/res/values/strings_untranslated.xml | 1 + 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/UnsupportedCardDialog.kt diff --git a/app/src/main/java/com/tangem/tap/common/DialogManager.kt b/app/src/main/java/com/tangem/tap/common/DialogManager.kt index dd997b7997..1de2e9cb6d 100644 --- a/app/src/main/java/com/tangem/tap/common/DialogManager.kt +++ b/app/src/main/java/com/tangem/tap/common/DialogManager.kt @@ -4,10 +4,7 @@ import android.app.Dialog import android.content.Context import com.tangem.tap.common.redux.global.GlobalState import com.tangem.tap.features.details.redux.walletconnect.WalletConnectDialog -import com.tangem.tap.features.details.ui.walletconnect.dialogs.ApproveWcSessionDialog -import com.tangem.tap.features.details.ui.walletconnect.dialogs.ClipboardOrScanQrDialog -import com.tangem.tap.features.details.ui.walletconnect.dialogs.PersonalSignDialog -import com.tangem.tap.features.details.ui.walletconnect.dialogs.TransactionDialog +import com.tangem.tap.features.details.ui.walletconnect.dialogs.* import com.tangem.tap.store import org.rekotlin.StoreSubscriber @@ -40,9 +37,10 @@ class DialogManager : StoreSubscriber { if (dialog != null) return when (state.dialog) { + is WalletConnectDialog.UnsupportedCard -> + dialog = UnsupportedCardDialog.create(context) is WalletConnectDialog.ApproveWcSession -> dialog = ApproveWcSessionDialog.create(state.dialog.session, context) - is WalletConnectDialog.ClipboardOrScanQr -> dialog = ClipboardOrScanQrDialog.create(state.dialog.clipboardUri, context) is WalletConnectDialog.RequestTransaction -> diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt index 896e3c06d2..2aa35ae196 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt @@ -104,6 +104,10 @@ class WalletConnectMiddleware { } } + is WalletConnectAction.UnsupportedCard -> { + store.dispatchOnMain(GlobalAction.ShowDialog(WalletConnectDialog.UnsupportedCard)) + } + is WalletConnectAction.OpenSession -> { walletConnectManager.connect( wcUri = action.wcUri, diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt index 84ef36046b..17669f9451 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt @@ -25,6 +25,7 @@ class WalletConnectReducer { state.copy(sessions = sessions) } is WalletConnectAction.ScanCard -> state.copy(loading = true) + is WalletConnectAction.UnsupportedCard -> state.copy(loading = false) is WalletConnectAction.FailureEstablishingSession -> state.copy(loading = false) diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt index 75dad54452..369ae46dc0 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt @@ -40,6 +40,7 @@ data class WalletForSession( sealed class WalletConnectDialog : StateDialog { data class ClipboardOrScanQr(val clipboardUri: String) : WalletConnectDialog() + object UnsupportedCard : WalletConnectDialog() data class ApproveWcSession(val session: WalletConnectSession) : WalletConnectDialog() data class RequestTransaction(val dialogData: TransactionRequestDialogData) : WalletConnectDialog() diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/UnsupportedCardDialog.kt b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/UnsupportedCardDialog.kt new file mode 100644 index 0000000000..cd408d7cd2 --- /dev/null +++ b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/UnsupportedCardDialog.kt @@ -0,0 +1,24 @@ +package com.tangem.tap.features.details.ui.walletconnect.dialogs + +import android.content.Context +import androidx.appcompat.app.AlertDialog +import com.tangem.tap.common.redux.global.GlobalAction +import com.tangem.tap.store +import com.tangem.wallet.R + +class UnsupportedCardDialog { + companion object { + fun create(context: Context): AlertDialog { + + return AlertDialog.Builder(context).apply { + setTitle(context.getString(R.string.wallet_connect)) + setMessage(context.getText(R.string.wallet_connect_scanner_error_no_ethereum_wallet)) + setPositiveButton(context.getText(R.string.common_ok)) { _, _ -> } +// setNegativeButton(context.getText(R.string.common_reject)) { _, _ -> } + setOnDismissListener { + store.dispatch(GlobalAction.HideDialog) + } + }.create() + } + } +} \ No newline at end of file diff --git a/app/src/main/res/values/strings_untranslated.xml b/app/src/main/res/values/strings_untranslated.xml index d84ec691c4..ef04081bbb 100644 --- a/app/src/main/res/values/strings_untranslated.xml +++ b/app/src/main/res/values/strings_untranslated.xml @@ -153,4 +153,5 @@ this wallet. Clipboard contain WalletConnect code. Use copied value or scan QR-code Paste from clipboard Scan new code + This card can’t be used to establish WalletConnect session From 94192eba6804e681372fe97a33713ba0a1e78add Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Jun 2021 10:04:37 +0300 Subject: [PATCH 06/16] Updated on 2026-08-14 --- .../java/com/tangem/tap/common/DialogManager.kt | 14 +++++++++++++- .../domain/walletconnect/WalletConnectManager.kt | 4 ++++ .../redux/walletconnect/WalletConnectAction.kt | 2 ++ .../walletconnect/WalletConnectMiddleware.kt | 6 ++++++ .../redux/walletconnect/WalletConnectReducer.kt | 3 ++- .../redux/walletconnect/WalletConnectState.kt | 1 + ...pportedCardDialog.kt => SimpleAlertDialog.kt} | 16 ++++++++++------ app/src/main/res/values/strings_untranslated.xml | 2 ++ 8 files changed, 40 insertions(+), 8 deletions(-) rename app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/{UnsupportedCardDialog.kt => SimpleAlertDialog.kt} (53%) diff --git a/app/src/main/java/com/tangem/tap/common/DialogManager.kt b/app/src/main/java/com/tangem/tap/common/DialogManager.kt index 1de2e9cb6d..96992a5d7a 100644 --- a/app/src/main/java/com/tangem/tap/common/DialogManager.kt +++ b/app/src/main/java/com/tangem/tap/common/DialogManager.kt @@ -6,6 +6,7 @@ import com.tangem.tap.common.redux.global.GlobalState import com.tangem.tap.features.details.redux.walletconnect.WalletConnectDialog import com.tangem.tap.features.details.ui.walletconnect.dialogs.* import com.tangem.tap.store +import com.tangem.wallet.R import org.rekotlin.StoreSubscriber class DialogManager : StoreSubscriber { @@ -38,7 +39,18 @@ class DialogManager : StoreSubscriber { when (state.dialog) { is WalletConnectDialog.UnsupportedCard -> - dialog = UnsupportedCardDialog.create(context) + dialog = SimpleAlertDialog.create( + titleRes = R.string.wallet_connect, + messageRes = R.string.wallet_connect_scanner_error_no_ethereum_wallet, + context = context + ) + is WalletConnectDialog.OpeningSessionRejected -> { + dialog = SimpleAlertDialog.create( + titleRes = R.string.wallet_connect, + messageRes = R.string.wallet_connect_same_wcuri, + context = context + ) + } is WalletConnectDialog.ApproveWcSession -> dialog = ApproveWcSessionDialog.create(state.dialog.session, context) is WalletConnectDialog.ClipboardOrScanQr -> diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectManager.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectManager.kt index 442b46ce83..44eece7399 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectManager.kt @@ -44,6 +44,10 @@ class WalletConnectManager { fun connect(wcUri: String, wallet: WalletForSession) { val session = WCSession.from(wcUri) ?: return + if (sessions[session] != null) { + store.dispatchOnMain(WalletConnectAction.RefuseOpeningSession) + return + } val client = WCClient(httpClient = okHttpClient) setListeners(client) val peerId = UUID.randomUUID().toString() diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt index 6e950a1cab..a2308891de 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt @@ -29,6 +29,8 @@ sealed class WalletConnectAction : Action { val wallet: WalletForSession, ) : WalletConnectAction() + object RefuseOpeningSession : WalletConnectAction() + data class AcceptOpeningSession(val session: WalletConnectSession) : WalletConnectAction() data class ApproveSession( diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt index 2aa35ae196..f3c581daf4 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt @@ -115,6 +115,12 @@ class WalletConnectMiddleware { ) } + is WalletConnectAction.RefuseOpeningSession -> { + store.dispatch(GlobalAction.ShowDialog( + WalletConnectDialog.OpeningSessionRejected + )) + } + is WalletConnectAction.AcceptOpeningSession -> { store.dispatchOnMain(GlobalAction.ShowDialog(WalletConnectDialog.ApproveWcSession( action.session))) diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt index 17669f9451..df3eec9834 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectReducer.kt @@ -25,8 +25,9 @@ class WalletConnectReducer { state.copy(sessions = sessions) } is WalletConnectAction.ScanCard -> state.copy(loading = true) - is WalletConnectAction.UnsupportedCard -> state.copy(loading = false) + is WalletConnectAction.UnsupportedCard -> state.copy(loading = false) + is WalletConnectAction.RefuseOpeningSession -> state.copy(loading = false) is WalletConnectAction.FailureEstablishingSession -> state.copy(loading = false) else -> state diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt index 369ae46dc0..f5b7ce0c5f 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectState.kt @@ -41,6 +41,7 @@ data class WalletForSession( sealed class WalletConnectDialog : StateDialog { data class ClipboardOrScanQr(val clipboardUri: String) : WalletConnectDialog() object UnsupportedCard : WalletConnectDialog() + object OpeningSessionRejected : WalletConnectDialog() data class ApproveWcSession(val session: WalletConnectSession) : WalletConnectDialog() data class RequestTransaction(val dialogData: TransactionRequestDialogData) : WalletConnectDialog() diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/UnsupportedCardDialog.kt b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/SimpleAlertDialog.kt similarity index 53% rename from app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/UnsupportedCardDialog.kt rename to app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/SimpleAlertDialog.kt index cd408d7cd2..f4efd59532 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/UnsupportedCardDialog.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/SimpleAlertDialog.kt @@ -6,15 +6,19 @@ import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.store import com.tangem.wallet.R -class UnsupportedCardDialog { +class SimpleAlertDialog { companion object { - fun create(context: Context): AlertDialog { + fun create( + titleRes: Int, + messageRes: Int, + buttonRes: Int = R.string.common_ok, + context: Context, + ): AlertDialog { return AlertDialog.Builder(context).apply { - setTitle(context.getString(R.string.wallet_connect)) - setMessage(context.getText(R.string.wallet_connect_scanner_error_no_ethereum_wallet)) - setPositiveButton(context.getText(R.string.common_ok)) { _, _ -> } -// setNegativeButton(context.getText(R.string.common_reject)) { _, _ -> } + setTitle(context.getString(titleRes)) + setMessage(context.getText(messageRes)) + setPositiveButton(context.getText(buttonRes)) { _, _ -> } setOnDismissListener { store.dispatch(GlobalAction.HideDialog) } diff --git a/app/src/main/res/values/strings_untranslated.xml b/app/src/main/res/values/strings_untranslated.xml index ef04081bbb..d6c4426536 100644 --- a/app/src/main/res/values/strings_untranslated.xml +++ b/app/src/main/res/values/strings_untranslated.xml @@ -154,4 +154,6 @@ this wallet. Paste from clipboard Scan new code This card can’t be used to establish WalletConnect session + The operation couldn\'t be completed + The operation couldn\'t be completed. \n\nYou have already established a WalletConnect session with this parameters. From 3bb9672c2138bd23682c0b7130d432f68c8f7b43 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Jun 2021 10:23:42 +0300 Subject: [PATCH 07/16] Updated on 2026-08-14 --- .../details/redux/walletconnect/WalletConnectAction.kt | 2 +- .../redux/walletconnect/WalletConnectMiddleware.kt | 10 +++++++++- .../ui/walletconnect/dialogs/ApproveWcSessionDialog.kt | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt index a2308891de..728a8d0446 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectAction.kt @@ -39,7 +39,7 @@ sealed class WalletConnectAction : Action { data class Success(val session: WalletConnectSession) : WalletConnectAction() } - object FailureEstablishingSession : WalletConnectAction() + data class FailureEstablishingSession(val session: WCSession?) : WalletConnectAction() data class SetSessionsRestored(val sessions: List) : diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt index f3c581daf4..a58ba756ec 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt @@ -98,12 +98,20 @@ class WalletConnectMiddleware { )) } is CompletionResult.Failure -> - store.dispatchOnMain(WalletConnectAction.FailureEstablishingSession) + store.dispatchOnMain(WalletConnectAction.FailureEstablishingSession( + null + )) } } } } + is WalletConnectAction.FailureEstablishingSession -> { + if (action.session != null) { + walletConnectManager.disconnect(action.session) + } + } + is WalletConnectAction.UnsupportedCard -> { store.dispatchOnMain(GlobalAction.ShowDialog(WalletConnectDialog.UnsupportedCard)) } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/ApproveWcSessionDialog.kt b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/ApproveWcSessionDialog.kt index 0b6a55899b..84b9151436 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/ApproveWcSessionDialog.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/dialogs/ApproveWcSessionDialog.kt @@ -25,7 +25,9 @@ class ApproveWcSessionDialog { session.session )) } - setNegativeButton(context.getText(R.string.common_reject)) { _, _ -> } + setNegativeButton(context.getText(R.string.common_reject)) { _, _ -> + store.dispatch(WalletConnectAction.FailureEstablishingSession(session.session)) + } setOnDismissListener { store.dispatch(GlobalAction.HideDialog) } From 7e9b5d1cdc0216c1696610ba1b4b47464fb7de78 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Jun 2021 10:24:27 +0300 Subject: [PATCH 08/16] Updated on 2026-08-14 --- .../layout/fragment_wallet_connect_sessions.xml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/layout/fragment_wallet_connect_sessions.xml b/app/src/main/res/layout/fragment_wallet_connect_sessions.xml index cf92a1ed6d..a2990696a4 100644 --- a/app/src/main/res/layout/fragment_wallet_connect_sessions.xml +++ b/app/src/main/res/layout/fragment_wallet_connect_sessions.xml @@ -31,14 +31,6 @@ android:layout_marginTop="16dp" app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - - + + Date: Fri, 18 Jun 2021 10:51:27 +0300 Subject: [PATCH 09/16] Updated on 2026-08-14 --- .../walletconnect/WalletConnectMiddleware.kt | 117 ++++++++++-------- 1 file changed, 68 insertions(+), 49 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt index a58ba756ec..89bec71f1f 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/walletconnect/WalletConnectMiddleware.kt @@ -1,6 +1,7 @@ package com.tangem.tap.features.details.redux.walletconnect import com.tangem.blockchain.common.* +import com.tangem.commands.common.card.Card import com.tangem.common.CompletionResult import com.tangem.common.extensions.toHexString import com.tangem.tap.* @@ -14,6 +15,7 @@ import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.extensions.makeWalletManagerForApp import com.tangem.tap.domain.isMultiwalletAllowed import com.tangem.tap.domain.walletconnect.WalletConnectManager +import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.wallet.R import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -55,55 +57,7 @@ class WalletConnectMiddleware { } is WalletConnectAction.ScanCard -> { - scope.launch { - val result = tangemSdkManager.scanNote( - FirebaseAnalyticsHandler, - R.string.wallet_connect_scan_card_message - ) - withContext(Dispatchers.Main) { - when (result) { - is CompletionResult.Success -> { - val card = result.data.card - val factory = - store.state.globalState.tapWalletManager.walletManagerFactory - - val walletManager = if (card.isMultiwalletAllowed) { - if (currenciesRepository.loadCardCurrencies(card.cardId)?.blockchains?.contains( - Blockchain.Ethereum) == true - ) { - factory.makeWalletManagerForApp(result.data.card, - Blockchain.Ethereum) - } else { - factory.makeWalletManagerForApp(result.data.card, - Blockchain.Ethereum)?.also { - currenciesRepository.saveAddedBlockchain(card.cardId, - Blockchain.Ethereum) - } - } - } else { - null - } - if (walletManager == null) { - store.dispatchOnMain(WalletConnectAction.UnsupportedCard) - return@withContext - }; - - val key = walletManager.wallet.publicKey - store.dispatchOnMain(WalletConnectAction.OpenSession( - wcUri = action.wcUri, - wallet = WalletForSession( - card.cardId, key.toHexString(), - isTestNet = false - ), - )) - } - is CompletionResult.Failure -> - store.dispatchOnMain(WalletConnectAction.FailureEstablishingSession( - null - )) - } - } - } + handleScanCard(action.wcUri) } is WalletConnectAction.FailureEstablishingSession -> { @@ -171,4 +125,69 @@ class WalletConnectMiddleware { } } } + + private fun handleScanCard(wcUri: String) { + scope.launch { + val result = tangemSdkManager.scanNote( + FirebaseAnalyticsHandler, + R.string.wallet_connect_scan_card_message + ) + withContext(Dispatchers.Main) { + when (result) { + is CompletionResult.Success -> { + val card = result.data.card + + if (!card.isMultiwalletAllowed) { + store.dispatchOnMain(WalletConnectAction.UnsupportedCard) + return@withContext + } + + val walletManager = getWalletManager(card) + if (walletManager == null) { + store.dispatchOnMain(WalletConnectAction.UnsupportedCard) + return@withContext + } + + val key = walletManager.wallet.publicKey + store.dispatchOnMain(WalletConnectAction.OpenSession( + wcUri = wcUri, + wallet = WalletForSession( + card.cardId, key.toHexString(), + isTestNet = false + ), + )) + } + is CompletionResult.Failure -> + store.dispatchOnMain(WalletConnectAction.FailureEstablishingSession( + null + )) + } + } + } + } + + private fun getWalletManager(card: Card): WalletManager? { + val factory = store.state.globalState.tapWalletManager.walletManagerFactory + + return if (store.state.globalState.scanNoteResponse?.card?.cardId == card.cardId) { + store.state.walletState.getWalletManager(Blockchain.Ethereum) + ?: factory.makeWalletManagerForApp(card, Blockchain.Ethereum) + ?.also { walletManager -> + store.dispatch(WalletAction.MultiWallet.AddWalletManagers(walletManager)) + store.dispatch(WalletAction.MultiWallet.AddBlockchain(walletManager.wallet.blockchain)) + } + } else { + if (currenciesRepository.loadCardCurrencies(card.cardId)?.blockchains?.contains( + Blockchain.Ethereum) == true + ) { + factory.makeWalletManagerForApp(card, Blockchain.Ethereum) + } else { + factory.makeWalletManagerForApp(card, + Blockchain.Ethereum) + ?.also { + currenciesRepository.saveAddedBlockchain(card.cardId, Blockchain.Ethereum) + } + } + } + } } \ No newline at end of file From 2ac23370916f7291ddf333c8565a674f5d193c93 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Jun 2021 11:09:35 +0300 Subject: [PATCH 10/16] Updated on 2026-08-14 --- .../com/tangem/tap/features/feedback/FeedbackManager.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt b/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt index c3ff7b8de0..4d4a3522e3 100644 --- a/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt +++ b/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt @@ -14,9 +14,9 @@ import com.tangem.Log import com.tangem.TangemSdkLogger import com.tangem.blockchain.common.* import com.tangem.commands.common.card.Card +import com.tangem.commands.wallet.WalletStatus import com.tangem.tap.common.extensions.stripZeroPlainString import com.tangem.tap.domain.TapWorkarounds -import com.tangem.tap.domain.extensions.signedHashesCount import com.tangem.tap.store import timber.log.Timber import java.io.File @@ -173,7 +173,9 @@ class AdditionalEmailInfo { fun setCardInfo(card: Card) { cardId = card.cardId cardFirmwareVersion = card.firmwareVersion.version - signedHashesCount = card.signedHashesCount().toString() + signedHashesCount = card.wallets + .filter { it.status == WalletStatus.Loaded } + .joinToString(";") { "${it.curve?.curve} - ${it.signedHashes}" } } fun setWalletsInfo(walletManagers: List) { @@ -289,6 +291,7 @@ class SendTransactionFailedEmail(private val error: String) : EmailData { appendKeyValue("OS version", infoHolder.osVersion) appendKeyValue("App version", infoHolder.appVersion) appendKeyValue("Firmware version", infoHolder.cardFirmwareVersion) + appendKeyValue("Signed hashes", infoHolder.signedHashesCount) // appendKeyValue("Transaction HEX", infoHolder.transactionHex) }.toString() } @@ -301,6 +304,7 @@ class FeedbackEmail : EmailData { val builder = StringBuilder() builder.appendKeyValue("Card ID", infoHolder.cardId) builder.appendKeyValue("Firmware version", infoHolder.cardFirmwareVersion) + builder.appendKeyValue("Signed hashes", infoHolder.signedHashesCount) infoHolder.walletsInfo.forEach { builder.appendKeyValue("Blockchain", it.blockchain.fullName) From 1a0a53420c73200a0a69be54eb5e8a7ccd0477bd Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Jun 2021 11:55:59 +0300 Subject: [PATCH 11/16] Updated on 2026-08-14 --- app/build.gradle | 2 +- .../tap/domain/tokens/CurrenciesRepository.kt | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index febc5293ea..9348b311d2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { implementation 'com.google.android.play:core-ktx:1.8.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' - implementation 'com.tangem:blockchain:develop-22' + implementation 'com.tangem:blockchain:develop-24' implementation 'com.tangem:core:develop-36' implementation 'com.tangem:sdk:develop-36' diff --git a/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt b/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt index 8ddbc8b5d1..754d7ea239 100644 --- a/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/tokens/CurrenciesRepository.kt @@ -100,9 +100,9 @@ class CurrenciesRepository(val context: Application) { fun getBlockchains(cardFirmware: FirmwareVersion?): List { return if (cardFirmware == null || cardFirmware.major < 4) { - secp256k1Blochcains + secp256k1Blockchains } else { - secp256k1Blochcains + ed25519Blockchains + secp256k1Blockchains + ed25519Blockchains } } @@ -115,10 +115,19 @@ class CurrenciesRepository(val context: Application) { fun getFileNameForBlockchains(cardId: String): String = "${FILE_NAME_PREFIX_BLOCKCHAINS}_$cardId" - private val secp256k1Blochcains = listOf( - Blockchain.Bitcoin, Blockchain.BitcoinCash, Blockchain.Binance, Blockchain.Litecoin, - Blockchain.XRP, Blockchain.Tezos, - Blockchain.Ethereum, Blockchain.RSK) + private val secp256k1Blockchains = listOf( + Blockchain.Bitcoin, + Blockchain.BitcoinCash, + Blockchain.Binance, + Blockchain.BSC, + Blockchain.Litecoin, + Blockchain.XRP, + Blockchain.Tezos, + Blockchain.Ethereum, + Blockchain.RSK, + Blockchain.Polygon, + Blockchain.Dogecoin, + ) private val ed25519Blockchains = listOf(Blockchain.CardanoShelley, Blockchain.Stellar) } } From 84adf56364ac64668e6b01c460b2159b688bdd58 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Jun 2021 14:27:35 +0300 Subject: [PATCH 12/16] Updated on 2026-08-14 --- .../tangem/tap/features/feedback/FeedbackManager.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt b/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt index 4d4a3522e3..66690f555b 100644 --- a/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt +++ b/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt @@ -17,7 +17,6 @@ import com.tangem.commands.common.card.Card import com.tangem.commands.wallet.WalletStatus import com.tangem.tap.common.extensions.stripZeroPlainString import com.tangem.tap.domain.TapWorkarounds -import com.tangem.tap.store import timber.log.Timber import java.io.File import java.io.FileWriter @@ -193,7 +192,6 @@ class AdditionalEmailInfo { } fun updateOnSendError(wallet: Wallet, host: String, amountToSend: Amount, feeAmount: Amount, destinationAddress: String) { - val amountState = store.state.sendState.amountState onSendErrorWalletInfo = EmailWalletInfo( blockchain = wallet.blockchain, address = getAddress(wallet), @@ -204,9 +202,7 @@ class AdditionalEmailInfo { this.destinationAddress = destinationAddress amount = amountToSend.value?.stripZeroPlainString() ?: "0" fee = feeAmount.value?.stripZeroPlainString() ?: "0" - if (amountState.typeOfAmount is AmountType.Token) { - token = amountState.amountToExtract?.currencySymbol ?: "" - } + token = if (amountToSend.type is AmountType.Token) amountToSend.currencySymbol else "" } private fun getAddress(wallet: Wallet): String { @@ -320,6 +316,6 @@ class FeedbackEmail : EmailData { } } -fun StringBuilder.appendKeyValue(key: String, value: String): StringBuilder { - return this.append("$key: $value\n") +private fun StringBuilder.appendKeyValue(key: String, value: String): StringBuilder { + return if (value.isNotBlank()) this.append("$key: $value\n") else this } \ No newline at end of file From 34aab42b37ee52ac92bce5d147569e73f0935555 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 18 Jun 2021 17:09:26 +0300 Subject: [PATCH 13/16] Updated on 2026-08-14 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9348b311d2..7ac5f47056 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,8 +78,8 @@ dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' implementation 'com.tangem:blockchain:develop-24' - implementation 'com.tangem:core:develop-36' - implementation 'com.tangem:sdk:develop-36' + implementation 'com.tangem:core:fixes_for_app_release-44' + implementation 'com.tangem:sdk:fixes_for_app_release-44' // WebView implementation "androidx.browser:browser:1.3.0" From 8c7f2b3d07d1a19fe0fd50be20602b62241d84cb Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 21 Jun 2021 16:48:43 +0300 Subject: [PATCH 14/16] Updated on 2026-08-14 --- .../java/com/tangem/tap/domain/TapWalletManager.kt | 4 ++-- .../java/com/tangem/tap/domain/TapWorkarounds.kt | 13 +++++++------ .../tap/features/details/redux/DetailsReducer.kt | 4 ++-- .../tangem/tap/features/feedback/FeedbackManager.kt | 8 +++++++- .../send/redux/middlewares/SendMiddleware.kt | 4 ++-- 5 files changed, 20 insertions(+), 13 deletions(-) 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 357db63124..acdc924fd4 100644 --- a/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt @@ -9,6 +9,7 @@ import com.tangem.tap.common.analytics.FirebaseAnalyticsHandler import com.tangem.tap.common.redux.global.FiatCurrencyName import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.currenciesRepository +import com.tangem.tap.domain.TapWorkarounds.isStart2Coin import com.tangem.tap.domain.configurable.config.ConfigManager import com.tangem.tap.domain.extensions.* import com.tangem.tap.domain.tasks.ScanNoteResponse @@ -89,7 +90,6 @@ class TapWalletManager { if (addAnalyticsEvent) { FirebaseAnalyticsHandler.triggerEvent(AnalyticsEvent.CARD_IS_SCANNED, data.card) } - TapWorkarounds.updateCard(data.card) store.state.globalState.feedbackManager?.infoHolder?.setCardInfo(data.card) updateConfigManager(data) @@ -119,7 +119,7 @@ class TapWalletManager { private fun updateConfigManager(data: ScanNoteResponse) { val configManager = store.state.globalState.configManager val blockchain = data.card.getBlockchain() - if (TapWorkarounds.isStart2Coin) { + if (data.card.isStart2Coin) { configManager?.turnOff(ConfigManager.isSendingToPayIdEnabled) configManager?.turnOff(ConfigManager.isTopUpEnabled) } else if (blockchain == Blockchain.Bitcoin diff --git a/app/src/main/java/com/tangem/tap/domain/TapWorkarounds.kt b/app/src/main/java/com/tangem/tap/domain/TapWorkarounds.kt index ace735abd2..5807bd024e 100644 --- a/app/src/main/java/com/tangem/tap/domain/TapWorkarounds.kt +++ b/app/src/main/java/com/tangem/tap/domain/TapWorkarounds.kt @@ -3,18 +3,19 @@ package com.tangem.tap.domain import com.tangem.commands.common.card.Card import com.tangem.commands.common.card.EllipticCurve import com.tangem.commands.common.card.masks.Product +import com.tangem.tap.domain.TapWorkarounds.isStart2Coin import com.tangem.tap.domain.extensions.getSingleWallet import java.util.* object TapWorkarounds { - var isStart2Coin: Boolean = false - private set - - fun updateCard(card: Card) { - isStart2Coin = card.cardData?.issuerName?.toLowerCase(Locale.US) == START_2_COIN_ISSUER + fun isStart2CoinIssuer(cardIssuer: String?): Boolean { + return cardIssuer?.toLowerCase(Locale.US) == START_2_COIN_ISSUER } + val Card.isStart2Coin: Boolean + get() = isStart2CoinIssuer(cardData?.issuerName) + fun Card.isExcluded(): Boolean { val cardData = this.cardData ?: return false val productMask = cardData.productMask @@ -43,7 +44,7 @@ object TapWorkarounds { val Card.isMultiwalletAllowed: Boolean get() { return cardData?.productMask?.contains(Product.TwinCard) != true - && !TapWorkarounds.isStart2Coin + && !isStart2Coin && (firmwareVersion.major >= 4 || getSingleWallet()?.curve == EllipticCurve.Secp256k1) } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt index 3a7b39e788..132dbddb18 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt @@ -4,7 +4,7 @@ package com.tangem.tap.features.details.redux import com.tangem.commands.common.card.Card import com.tangem.commands.common.card.masks.Settings import com.tangem.tap.common.redux.AppState -import com.tangem.tap.domain.TapWorkarounds +import com.tangem.tap.domain.TapWorkarounds.isStart2Coin import com.tangem.tap.domain.extensions.isWalletDataSupported import com.tangem.tap.domain.extensions.signedHashesCount import com.tangem.tap.domain.extensions.toSendableAmounts @@ -143,7 +143,7 @@ private fun handleSecurityAction( ): DetailsState { return when (action) { is DetailsAction.ManageSecurity.OpenSecurity -> { - if (TapWorkarounds.isStart2Coin) { + if (state.card?.isStart2Coin == true) { return state.copy(securityScreenState = state.securityScreenState?.copy( allowedOptions = EnumSet.of(SecurityOption.LongTap), selectedOption = state.securityScreenState.currentOption diff --git a/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt b/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt index 66690f555b..bab36b6f67 100644 --- a/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt +++ b/app/src/main/java/com/tangem/tap/features/feedback/FeedbackManager.kt @@ -49,7 +49,11 @@ class FeedbackManager( } private fun getSupportEmail(): String { - return if (TapWorkarounds.isStart2Coin) S2C_SUPPORT_EMAIL else DEFAULT_SUPPORT_EMAIL + return if (TapWorkarounds.isStart2CoinIssuer(infoHolder.cardIssuer)) { + S2C_SUPPORT_EMAIL + } else { + DEFAULT_SUPPORT_EMAIL + } } private fun sendTo(email: String, subject: String, message: String, fileLog: File? = null) { @@ -144,6 +148,7 @@ class AdditionalEmailInfo { // card var cardId: String = "" var cardFirmwareVersion: String = "" + var cardIssuer: String = "" // wallets internal val walletsInfo = mutableListOf() @@ -172,6 +177,7 @@ class AdditionalEmailInfo { fun setCardInfo(card: Card) { cardId = card.cardId cardFirmwareVersion = card.firmwareVersion.version + cardIssuer = card.cardData?.issuerName ?: "" signedHashesCount = card.wallets .filter { it.status == WalletStatus.Loaded } .joinToString(";") { "${it.curve?.curve} - ${it.signedHashes}" } diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt index 3d2b5e9c37..7dcececcda 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt @@ -14,7 +14,7 @@ import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.TangemSigner import com.tangem.tap.domain.TapError -import com.tangem.tap.domain.TapWorkarounds +import com.tangem.tap.domain.TapWorkarounds.isStart2Coin import com.tangem.tap.domain.configurable.warningMessage.WarningMessage import com.tangem.tap.domain.extensions.minimalAmount import com.tangem.tap.features.send.redux.* @@ -108,7 +108,7 @@ private fun sendTransaction( scope.launch { walletManager.update() val isLinkedTerminal = tangemSdk.config.linkedTerminal - if (TapWorkarounds.isStart2Coin) { + if (card.isStart2Coin) { tangemSdk.config.linkedTerminal = false } val signer = TangemSigner( From cc7d436ec1037033ec3512c1c201e5b788496fb1 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 21 Jun 2021 16:49:21 +0300 Subject: [PATCH 15/16] Updated on 2026-08-14 --- .../main/java/com/tangem/tap/domain/extensions/Blockchain.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt b/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt index 3fb9fb0d67..a89f4fe24c 100644 --- a/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt +++ b/app/src/main/java/com/tangem/tap/domain/extensions/Blockchain.kt @@ -31,8 +31,8 @@ fun Blockchain.getSupportedCurves(): List? { Blockchain.Unknown -> null Blockchain.Bitcoin, Blockchain.BitcoinTestnet, Blockchain.BitcoinCash, Blockchain.Litecoin, Blockchain.Ducatus, Blockchain.Ethereum, Blockchain.EthereumTestnet, Blockchain.RSK, - Blockchain.XRP, Blockchain.Binance, Blockchain.BinanceTestnet -> listOf(EllipticCurve.Secp256k1) - Blockchain.Tezos -> listOf(EllipticCurve.Secp256k1, EllipticCurve.Ed25519) + Blockchain.Binance, Blockchain.BinanceTestnet -> listOf(EllipticCurve.Secp256k1) + Blockchain.Tezos, Blockchain.XRP -> listOf(EllipticCurve.Secp256k1, EllipticCurve.Ed25519) Blockchain.Cardano, Blockchain.CardanoShelley, Blockchain.Stellar -> listOf(EllipticCurve.Ed25519) else -> listOf(EllipticCurve.Secp256k1) From 3e9bfb51a5932271657103f10d6c593ff4b0a01a Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 24 Jun 2021 14:45:39 +0300 Subject: [PATCH 16/16] Updated on 2026-08-14 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 7ac5f47056..e188911f47 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { implementation 'com.google.android.play:core-ktx:1.8.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' - implementation 'com.tangem:blockchain:develop-24' + implementation 'com.tangem:blockchain:develop-26' implementation 'com.tangem:core:fixes_for_app_release-44' implementation 'com.tangem:sdk:fixes_for_app_release-44'