From bd173232ede3a4a4a377e20390345864409b2944 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 27 Jun 2023 18:03:24 +0300 Subject: [PATCH 01/19] Updated on 2026-08-14 --- .../src/main/assets/configs/feature_toggles_config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json b/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json index b0b9550686..ab2ed7ee14 100644 --- a/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json +++ b/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json @@ -9,7 +9,7 @@ }, { "name": "NEW_CARD_SCANNING_ENABLED", - "version": "4.8.0" + "version": "4.9.0" }, { "name": "REDESIGNED_WALLET_SCREEN_ENABLED", From 677dd370a65085254c2414c5f85731cc7a3f852b Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 29 Jun 2023 17:32:01 +0300 Subject: [PATCH 02/19] Updated on 2026-08-14 --- .../impl/presentation/ui/TokensListScreen.kt | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt index 44e620b8ac..6896480058 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt @@ -25,9 +25,6 @@ import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.AnnotatedString -import androidx.compose.ui.text.SpanStyle -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp @@ -155,18 +152,8 @@ private fun DifferentAddressesWarning() { contentAlignment = Alignment.Center, ) { val text = stringResource(id = R.string.alert_manage_tokens_addresses_message) - val firstSpaceIndex = text.indexOf(" ") Text( - text = AnnotatedString( - text = text, - spanStyles = listOf( - AnnotatedString.Range( - SpanStyle(fontWeight = FontWeight.Bold), - start = 0, - end = firstSpaceIndex, - ), - ), - ), + text = text, modifier = Modifier.padding( horizontal = TangemTheme.dimens.spacing16, vertical = TangemTheme.dimens.spacing8, From ca46cb41a6f186f76affdcf13a71d298c6650d04 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 29 Jun 2023 19:05:42 +0300 Subject: [PATCH 03/19] Updated on 2026-08-14 --- .../wallet/ui/utils/WalletDataOperations.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/utils/WalletDataOperations.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/utils/WalletDataOperations.kt index f2d65a4fcf..63de2cf579 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/utils/WalletDataOperations.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/utils/WalletDataOperations.kt @@ -12,7 +12,6 @@ import com.tangem.tap.common.extensions.toFormattedCurrencyString import com.tangem.tap.common.extensions.toFormattedFiatValue import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletStoreModel -import com.tangem.tap.features.wallet.models.PendingTransactionType import com.tangem.tap.features.wallet.models.WalletWarning import com.tangem.tap.features.wallet.redux.WalletMainButton import com.tangem.tap.features.wallet.redux.utils.UNKNOWN_AMOUNT_SIGN @@ -27,14 +26,15 @@ internal fun WalletDataModel.mainButton(blockchainAmount: BigDecimal): WalletMai internal fun WalletDataModel.hasPendingTransactions(): Boolean { // for now check pending ongoing only just for BTC, later test and add other utxo networks - val isBitcoinBlockchain = - currency.blockchain == Blockchain.Bitcoin || currency.blockchain == Blockchain.BitcoinTestnet - if (currency.isBlockchain() && isBitcoinBlockchain) { - val outgoingTransactions = status.pendingTransactions.filter { - it.type == PendingTransactionType.Outgoing - } - return outgoingTransactions.isEmpty() - } + // disabled for release 4.8, test and enable in 4.9 + // val isBitcoinBlockchain = + // currency.blockchain == Blockchain.Bitcoin || currency.blockchain == Blockchain.BitcoinTestnet + // if (currency.isBlockchain() && isBitcoinBlockchain) { + // val outgoingTransactions = status.pendingTransactions.filter { + // it.type == PendingTransactionType.Outgoing + // } + // return outgoingTransactions.isEmpty() + // } return status.pendingTransactions.isEmpty() } From 910cabb39b6c3476017987432f2a8a31770d9d88 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 30 Jun 2023 17:35:56 +0300 Subject: [PATCH 04/19] Updated on 2026-08-14 --- gradle/dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index bab0670f48..a9ef1dcf23 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -77,7 +77,7 @@ walletConnectWeb3 = "1.8.0" # endregion Other libraries # region Tangem -tangemBlockchainSdk = "release-app_4.8-251" +tangemBlockchainSdk = "release-app_4.8-255" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "release-app_4.8-270" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds From d86e205e98040e30755d4f4a73227b329eaeee1a Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 3 Jul 2023 20:43:49 +0300 Subject: [PATCH 05/19] Updated on 2026-08-14 --- .../data/WalletConnectRepositoryImpl.kt | 30 +++++++++++++------ .../domain/WalletConnectInteractor.kt | 6 ++-- .../domain/models/WalletConnectEvents.kt | 3 +- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt index 01e3803798..50265e3953 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt @@ -1,6 +1,7 @@ package com.tangem.tap.domain.walletconnect2.data import android.app.Application +import arrow.core.flatten import com.tangem.tap.domain.walletconnect2.domain.WalletConnectRepository import com.tangem.tap.domain.walletconnect2.domain.WcJrpcRequestsDeserializer import com.tangem.tap.domain.walletconnect2.domain.models.* @@ -97,6 +98,7 @@ class WalletConnectRepositoryImpl @Inject constructor( sessionProposal.url, sessionProposal.icons, sessionProposal.requiredNamespaces.values.flatMap { it.chains ?: emptyList() }, + sessionProposal.optionalNamespaces.values.flatMap { it.chains ?: emptyList() }, ), ) } @@ -187,6 +189,7 @@ class WalletConnectRepositoryImpl @Inject constructor( namespaces = sessionProposal.requiredNamespaces, userNamespaces = userNamespaces, ) + if (missingNetworks.isNotEmpty()) { Timber.e("Not added blockchains: $missingNetworks") scope.launch { @@ -204,17 +207,26 @@ class WalletConnectRepositoryImpl @Inject constructor( }.groupBy { pair -> pair.first } .mapValues { entry -> entry.value.map { pair -> pair.second }.toSet() } - val preparedNamespaces = sessionProposal.requiredNamespaces.map { requiredNamespace -> - val accounts = requiredNamespace.value.chains?.mapNotNull { userChains[it] }?.flatten() ?: emptyList() + val preparedNamespaces = sessionProposal.requiredNamespaces + .map { requiredNamespace -> + val accountsRequired = requiredNamespace.value.chains + ?.mapNotNull { chain -> userChains[chain] } + ?.flatten() ?: emptyList() + val accountsOptional = sessionProposal.optionalNamespaces[requiredNamespace.key]?.chains + ?.mapNotNull { chain -> userChains[chain] } + ?.flatten() ?: emptyList() - requiredNamespace.key to Wallet.Model.Namespace.Session( - accounts = accounts, - methods = requiredNamespace.value.methods, - events = requiredNamespace.value.events, - ) - }.toMap() + requiredNamespace.key to Wallet.Model.Namespace.Session( + accounts = accountsRequired + accountsOptional, + methods = requiredNamespace.value.methods, + events = requiredNamespace.value.events, + ) + }.toMap() - val sessionApproval = Wallet.Params.SessionApprove(sessionProposal.proposerPublicKey, preparedNamespaces) + val sessionApproval = Wallet.Params.SessionApprove( + proposerPublicKey = sessionProposal.proposerPublicKey, + namespaces = preparedNamespaces, + ) Timber.d("Session approval is prepared for sending: $sessionApproval") diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WalletConnectInteractor.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WalletConnectInteractor.kt index ef202cd085..7d929df9fc 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WalletConnectInteractor.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WalletConnectInteractor.kt @@ -50,15 +50,15 @@ class WalletConnectInteractor( when (wcEvent) { is WalletConnectEvents.SessionProposal -> { Timber.d("WC session proposal event received") - val unsupportedNetworks = wcEvent.chainIds + val unsupportedNetworks = wcEvent.requiredChainIds .filter { blockchainHelper.chainIdToNetworkIdOrNull(it) == null } if (unsupportedNetworks.isNotEmpty()) { val error = WalletConnectError.ApprovalErrorUnsupportedNetwork(unsupportedNetworks) handler.onSessionRejected(error) return@onEach } - - val networksFormatted = wcEvent.chainIds + val networksFormatted = (wcEvent.requiredChainIds + wcEvent.optionalChainIds) + .distinct() .mapNotNull { blockchainHelper.chainIdToFullNameOrNull(it) } .toString() handler.onProposalReceived(proposal = wcEvent, networksFormatted = networksFormatted) diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/WalletConnectEvents.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/WalletConnectEvents.kt index bec06dd554..e481daa22d 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/WalletConnectEvents.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/WalletConnectEvents.kt @@ -9,7 +9,8 @@ sealed interface WalletConnectEvents { val description: String, val url: String, val icons: List, - val chainIds: List, + val requiredChainIds: List, + val optionalChainIds: List, ) : WalletConnectEvents data class SessionApprovalError(val error: WalletConnectError) : WalletConnectEvents From 07a2f9f411b312f9ce2f023dcce1b8d84aa7e3ec Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 4 Jul 2023 07:22:10 +0300 Subject: [PATCH 06/19] Updated on 2026-08-14 --- .../wallet/ui/view/TotalBalanceCard.kt | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt index d89d245766..fdfadc43e1 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt @@ -27,6 +27,7 @@ import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.features.wallet.redux.utils.UNKNOWN_AMOUNT_SIGN import com.tangem.wallet.R import com.valentinilk.shimmer.shimmer +import timber.log.Timber import java.math.BigDecimal import java.math.RoundingMode import java.text.DecimalFormat @@ -227,14 +228,21 @@ private fun buildAmountString(amount: BigDecimal?, fiatCurrency: FiatCurrency): ?: return AnnotatedString("${amount.toPlainString()} ${fiatCurrency.symbol}") val currencyToShow = "${fiatCurrency.symbol} " - val scaledAmount = Currency.getInstance(fiatCurrency.code)?.let { currency -> - formatter.currency = currency - formatter.maximumFractionDigits = fractionDigits - formatter.minimumFractionDigits = fractionDigits - formatter.isGroupingUsed = true - formatter.roundingMode = RoundingMode.HALF_UP - formatter.format(amount).replace(currency.symbol, currencyToShow) - } ?: formatter.format(amount) + val scaledAmount = try { + Currency.getInstance(fiatCurrency.code)?.let { currency -> + formatter.currency = currency + formatter.maximumFractionDigits = fractionDigits + formatter.minimumFractionDigits = fractionDigits + formatter.isGroupingUsed = true + formatter.roundingMode = RoundingMode.HALF_UP + formatter.format(amount).replace(currency.symbol, currencyToShow) + } ?: formatter.format(amount) + } catch (e: IllegalArgumentException) { + Timber.e("TotalBalanceCard buildAmountString currencyCode is not a supported ISO 4217 code: $e") + formatter.currency?.let { + formatter.format(amount).replace(it.symbol, currencyToShow) + } ?: formatter.format(amount) + } val integer = scaledAmount.substringBefore(formatter.decimalFormatSymbols.decimalSeparator) var reminder = scaledAmount.substringAfter(formatter.decimalFormatSymbols.decimalSeparator) From 0f465cf04b4ebc1699a17d4247c0de0a80b0ba63 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 4 Jul 2023 15:44:46 +0400 Subject: [PATCH 07/19] Updated on 2026-08-14 --- gradle/dependencies.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index a9ef1dcf23..19e1dc5045 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -72,8 +72,8 @@ mviCore = "1.3.1" kotlinSerialization = "1.4.1" arrow = "1.2.0-RC" reactiveNetwork = "3.0.8" -walletConnectCore = "1.15.0" -walletConnectWeb3 = "1.8.0" +walletConnectCore = "1.17.0" +walletConnectWeb3 = "1.10.0" # endregion Other libraries # region Tangem From 56e272bb2bb361d8f1b38ff0b50f95c467dcd45a Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 4 Jul 2023 22:25:49 +0400 Subject: [PATCH 08/19] Updated on 2026-08-14 --- .../walletconnect2/data/WalletConnectRepositoryImpl.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt index 50265e3953..12c5510122 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/WalletConnectRepositoryImpl.kt @@ -212,13 +212,16 @@ class WalletConnectRepositoryImpl @Inject constructor( val accountsRequired = requiredNamespace.value.chains ?.mapNotNull { chain -> userChains[chain] } ?.flatten() ?: emptyList() - val accountsOptional = sessionProposal.optionalNamespaces[requiredNamespace.key]?.chains + val optionalNamespace = sessionProposal.optionalNamespaces[requiredNamespace.key] + val accountsOptional = optionalNamespace?.chains ?.mapNotNull { chain -> userChains[chain] } ?.flatten() ?: emptyList() + val methods = (requiredNamespace.value.methods + (optionalNamespace?.methods ?: emptyList())) + .distinct() requiredNamespace.key to Wallet.Model.Namespace.Session( - accounts = accountsRequired + accountsOptional, - methods = requiredNamespace.value.methods, + accounts = (accountsRequired + accountsOptional).distinct(), + methods = methods, events = requiredNamespace.value.events, ) }.toMap() From 103a78782fd66bc1d0c29cd1cd9a44e82ba2f8cf Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 7 Jul 2023 15:27:53 +0300 Subject: [PATCH 09/19] Updated on 2026-08-14 --- app/src/main/assets/testnet_tokens.json | 11 +++++++++++ .../com/tangem/tap/common/extensions/Blockchain.kt | 1 + app/src/main/res/drawable/ic_azero_no_color.xml | 12 ++++++++++++ .../com/tangem/core/ui/extensions/BlockchainIcons.kt | 1 + core/ui/src/main/res/drawable/img_azero_22.xml | 12 ++++++++++++ .../tangem/domain/common/extensions/Blockchain.kt | 10 +++++----- gradle/dependencies.toml | 2 +- 7 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 app/src/main/res/drawable/ic_azero_no_color.xml create mode 100644 core/ui/src/main/res/drawable/img_azero_22.xml diff --git a/app/src/main/assets/testnet_tokens.json b/app/src/main/assets/testnet_tokens.json index b39a86f330..e10caf1e7f 100644 --- a/app/src/main/assets/testnet_tokens.json +++ b/app/src/main/assets/testnet_tokens.json @@ -506,6 +506,17 @@ "networkId": "cosmos/test" } ] + }, + { + "id": "aleph-zero", + "symbol": "AZERO", + "name": "Aleph Zero", + "networks": + [ + { + "networkId": "aleph-zero/test" + } + ] } ] } 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 06078c9488..68aca58758 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 @@ -44,6 +44,7 @@ fun Blockchain.getGreyedOutIconRes(): Int { Blockchain.TerraV2 -> R.drawable.ic_terra2_no_color Blockchain.Cronos -> R.drawable.ic_cronos_no_color Blockchain.Telos, Blockchain.TelosTestnet -> R.drawable.ic_telos_no_color + Blockchain.AlephZero, Blockchain.AlephZeroTestnet -> R.drawable.ic_azero_no_color else -> R.drawable.ic_tangem_logo } } diff --git a/app/src/main/res/drawable/ic_azero_no_color.xml b/app/src/main/res/drawable/ic_azero_no_color.xml new file mode 100644 index 0000000000..da712895b3 --- /dev/null +++ b/app/src/main/res/drawable/ic_azero_no_color.xml @@ -0,0 +1,12 @@ + + + + diff --git a/core/ui/src/main/java/com/tangem/core/ui/extensions/BlockchainIcons.kt b/core/ui/src/main/java/com/tangem/core/ui/extensions/BlockchainIcons.kt index e0dcf1e7c8..c4eeba732a 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/extensions/BlockchainIcons.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/extensions/BlockchainIcons.kt @@ -41,6 +41,7 @@ fun getActiveIconRes(blockchainId: String): Int { "terra-2", "terra-luna-2" -> R.drawable.img_terra2_22 "cronos" -> R.drawable.img_cronos_22 "TELOS", "TELOS/test" -> R.drawable.img_telos_22 + "aleph-zero", "aleph-zero/test" -> R.drawable.img_azero_22 else -> R.drawable.ic_alert_24 } } diff --git a/core/ui/src/main/res/drawable/img_azero_22.xml b/core/ui/src/main/res/drawable/img_azero_22.xml new file mode 100644 index 0000000000..9a9fd4a2f1 --- /dev/null +++ b/core/ui/src/main/res/drawable/img_azero_22.xml @@ -0,0 +1,12 @@ + + + + diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt b/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt index 1b5e32c734..f4084f38df 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt +++ b/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt @@ -61,8 +61,8 @@ fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? { "cronos" -> Blockchain.Cronos "telos" -> Blockchain.Telos "telos/test" -> Blockchain.TelosTestnet - "azero" -> Blockchain.AlephZero - "azero/test" -> Blockchain.AlephZeroTestnet + "aleph-zero" -> Blockchain.AlephZero + "aleph-zero/test" -> Blockchain.AlephZeroTestnet else -> null } } @@ -128,8 +128,8 @@ fun Blockchain.toNetworkId(): String { Blockchain.Cronos -> "cronos" Blockchain.Telos -> "telos" Blockchain.TelosTestnet -> "telos/test" - Blockchain.AlephZero -> "azero" - Blockchain.AlephZeroTestnet -> "azero/test" + Blockchain.AlephZero -> "aleph-zero" + Blockchain.AlephZeroTestnet -> "aleph-zero/test" } } @@ -171,7 +171,7 @@ fun Blockchain.toCoinId(): String { Blockchain.TerraV2 -> "terra-luna-2" Blockchain.Cronos -> "crypto-com-chain" Blockchain.Telos, Blockchain.TelosTestnet -> "telos" - Blockchain.AlephZero, Blockchain.AlephZeroTestnet -> "azero" + Blockchain.AlephZero, Blockchain.AlephZeroTestnet -> "aleph-zero" } } diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 5fb4bbfb94..b39d1e0b90 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -78,7 +78,7 @@ walletConnectWeb3 = "1.8.0" # endregion Other libraries # region Tangem -tangemBlockchainSdk = "develop-259" +tangemBlockchainSdk = "develop-264" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "develop-266" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds From 6359ee7dbed721c94582d0c2b2ecb12eedc55c06 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 7 Jul 2023 17:50:28 +0500 Subject: [PATCH 10/19] Updated on 2026-08-14 --- app/build.gradle.kts | 2 + .../main/java/com/tangem/tap/MainActivity.kt | 5 +++ .../java/com/tangem/tap/TapApplication.kt | 5 +++ .../tap/common/extensions/Navigation.kt | 13 ++++++- .../tap/proxy/redux/DaggerGraphAction.kt | 2 + .../tap/proxy/redux/DaggerGraphReducer.kt | 1 + .../tap/proxy/redux/DaggerGraphState.kt | 4 ++ .../configs/feature_toggles_config.json | 6 ++- features/tokendetails/api/.gitignore | 1 + features/tokendetails/api/build.gradle.kts | 14 +++++++ .../TokenDetailsFeatureToggles.kt | 5 +++ .../navigation/TokenDetailsRouter.kt | 8 ++++ features/tokendetails/impl/.gitignore | 1 + features/tokendetails/impl/build.gradle.kts | 38 +++++++++++++++++++ .../di/TokenDetailsFeatureTogglesModule.kt | 21 ++++++++++ .../di/TokenDetailsRouterModule.kt | 18 +++++++++ .../DefaultTokenDetailsFeatureToggles.kt | 14 +++++++ .../router/DefaultTokenDetailsRouter.kt | 10 +++++ settings.gradle.kts | 5 +++ 19 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 features/tokendetails/api/.gitignore create mode 100644 features/tokendetails/api/build.gradle.kts create mode 100644 features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/featuretoggles/TokenDetailsFeatureToggles.kt create mode 100644 features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsRouter.kt create mode 100644 features/tokendetails/impl/.gitignore create mode 100644 features/tokendetails/impl/build.gradle.kts create mode 100644 features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsFeatureTogglesModule.kt create mode 100644 features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsRouterModule.kt create mode 100644 features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/featuretoggles/DefaultTokenDetailsFeatureToggles.kt create mode 100644 features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/router/DefaultTokenDetailsRouter.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index efe2848d8c..1f144358fa 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -52,6 +52,8 @@ dependencies { implementation(project(":features:tester:impl")) implementation(project(":features:wallet:api")) implementation(project(":features:wallet:impl")) + implementation(projects.features.tokendetails.api) + implementation(projects.features.tokendetails.impl) /** AndroidX libraries */ implementation(deps.androidx.core.ktx) diff --git a/app/src/main/java/com/tangem/tap/MainActivity.kt b/app/src/main/java/com/tangem/tap/MainActivity.kt index 4b406eaccd..de2272f1f5 100644 --- a/app/src/main/java/com/tangem/tap/MainActivity.kt +++ b/app/src/main/java/com/tangem/tap/MainActivity.kt @@ -13,6 +13,7 @@ import com.google.android.material.snackbar.Snackbar import com.tangem.TangemSdk import com.tangem.domain.card.ScanCardUseCase import com.tangem.features.tester.api.TesterRouter +import com.tangem.features.tokendetails.navigation.TokenDetailsRouter import com.tangem.features.wallet.navigation.WalletRouter import com.tangem.operations.backup.BackupService import com.tangem.sdk.extensions.init @@ -98,6 +99,9 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac @Inject lateinit var walletRouter: WalletRouter + @Inject + lateinit var tokenDetailsRouter: TokenDetailsRouter + @Inject lateinit var walletConnectInteractor: WalletConnectInteractor @@ -139,6 +143,7 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac scanCardUseCase = scanCardUseCase, walletRouter = walletRouter, walletConnectInteractor = walletConnectInteractor, + tokenDetailsRouter = tokenDetailsRouter, ), ) } diff --git a/app/src/main/java/com/tangem/tap/TapApplication.kt b/app/src/main/java/com/tangem/tap/TapApplication.kt index 114746ccdb..4288c782e7 100644 --- a/app/src/main/java/com/tangem/tap/TapApplication.kt +++ b/app/src/main/java/com/tangem/tap/TapApplication.kt @@ -22,6 +22,7 @@ import com.tangem.datasource.connection.NetworkConnectionManager import com.tangem.domain.DomainLayer import com.tangem.domain.common.LogConfig import com.tangem.feature.learn2earn.domain.api.Learn2earnInteractor +import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles import com.tangem.tap.common.analytics.AnalyticsFactory import com.tangem.tap.common.analytics.api.AnalyticsHandlerBuilder @@ -147,6 +148,9 @@ class TapApplication : Application(), ImageLoaderFactory { @Inject lateinit var learn2earnInteractor: Learn2earnInteractor + @Inject + lateinit var tokenDetailsFeatureToggles: TokenDetailsFeatureToggles + override fun onCreate() { super.onCreate() @@ -163,6 +167,7 @@ class TapApplication : Application(), ImageLoaderFactory { walletFeatureToggles = walletFeatureToggles, walletConnectRepository = walletConnect2Repository, walletConnectSessionsRepository = walletConnectSessionsRepository, + tokenDetailsFeatureToggles = tokenDetailsFeatureToggles, ), ), ) diff --git a/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt b/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt index f45d14c864..7f1e93ecf1 100644 --- a/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt +++ b/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt @@ -167,7 +167,18 @@ private fun fragmentFactory(screen: AppScreen): Fragment { } } - AppScreen.WalletDetails -> WalletDetailsFragment() + AppScreen.WalletDetails -> { + val featureToggles = store.state.daggerGraphState.get( + getDependency = DaggerGraphState::tokenDetailsFeatureToggles, + ) + if (featureToggles.isRedesignedScreenEnabled) { + store.state.daggerGraphState + .get(getDependency = DaggerGraphState::tokenDetailsRouter) + .getEntryFragment() + } else { + WalletDetailsFragment() + } + } AppScreen.WalletConnectSessions -> WalletConnectFragment() AppScreen.QrScan -> QrScanFragment() AppScreen.ReferralProgram -> ReferralFragment() diff --git a/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphAction.kt b/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphAction.kt index 5fab5032f5..e83ed33f3a 100644 --- a/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphAction.kt +++ b/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphAction.kt @@ -2,6 +2,7 @@ package com.tangem.tap.proxy.redux import com.tangem.domain.card.ScanCardUseCase import com.tangem.features.tester.api.TesterRouter +import com.tangem.features.tokendetails.navigation.TokenDetailsRouter import com.tangem.features.wallet.navigation.WalletRouter import com.tangem.tap.domain.walletconnect2.domain.WalletConnectInteractor import org.rekotlin.Action @@ -13,5 +14,6 @@ sealed interface DaggerGraphAction : Action { val scanCardUseCase: ScanCardUseCase, val walletRouter: WalletRouter, val walletConnectInteractor: WalletConnectInteractor, + val tokenDetailsRouter: TokenDetailsRouter, ) : DaggerGraphAction } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphReducer.kt b/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphReducer.kt index bdc38a631c..bdd590be4d 100644 --- a/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphReducer.kt +++ b/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphReducer.kt @@ -17,6 +17,7 @@ object DaggerGraphReducer { scanCardUseCase = action.scanCardUseCase, walletRouter = action.walletRouter, walletConnectInteractor = action.walletConnectInteractor, + tokenDetailsRouter = action.tokenDetailsRouter, ) } } diff --git a/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphState.kt b/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphState.kt index a741e4dfd4..84409d4e36 100644 --- a/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphState.kt +++ b/app/src/main/java/com/tangem/tap/proxy/redux/DaggerGraphState.kt @@ -4,6 +4,8 @@ import com.tangem.datasource.asset.AssetReader import com.tangem.datasource.connection.NetworkConnectionManager import com.tangem.domain.card.ScanCardUseCase import com.tangem.features.tester.api.TesterRouter +import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles +import com.tangem.features.tokendetails.navigation.TokenDetailsRouter import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles import com.tangem.features.wallet.navigation.WalletRouter import com.tangem.tap.domain.walletconnect2.domain.WalletConnectInteractor @@ -23,6 +25,8 @@ data class DaggerGraphState( val walletConnectRepository: WalletConnectRepository? = null, val walletConnectSessionsRepository: WalletConnectSessionsRepository? = null, val walletConnectInteractor: WalletConnectInteractor? = null, + val tokenDetailsFeatureToggles: TokenDetailsFeatureToggles? = null, + val tokenDetailsRouter: TokenDetailsRouter? = null, ) : StateType { inline fun get(getDependency: DaggerGraphState.() -> T?): T { diff --git a/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json b/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json index 9a45d3070f..5dc4db710d 100644 --- a/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json +++ b/core/featuretoggles/src/main/assets/configs/feature_toggles_config.json @@ -18,5 +18,9 @@ { "name": "1INCH_LEARN_2_EARN_ENABLED", "version": "undefined" + }, + { + "name": "REDESIGNED_TOKEN_DETAIL_SCREEN_ENABLED", + "version": "undefined" } -] \ No newline at end of file +] diff --git a/features/tokendetails/api/.gitignore b/features/tokendetails/api/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/features/tokendetails/api/.gitignore @@ -0,0 +1 @@ +/build diff --git a/features/tokendetails/api/build.gradle.kts b/features/tokendetails/api/build.gradle.kts new file mode 100644 index 0000000000..b7c1f22eeb --- /dev/null +++ b/features/tokendetails/api/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + id("configuration") +} + +android { + namespace = "com.tangem.features.tokendetails.api" +} + +dependencies { + /** AndroidX */ + implementation(deps.androidx.fragment.ktx) +} \ No newline at end of file diff --git a/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/featuretoggles/TokenDetailsFeatureToggles.kt b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/featuretoggles/TokenDetailsFeatureToggles.kt new file mode 100644 index 0000000000..751dabea32 --- /dev/null +++ b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/featuretoggles/TokenDetailsFeatureToggles.kt @@ -0,0 +1,5 @@ +package com.tangem.features.tokendetails.featuretoggles + +interface TokenDetailsFeatureToggles { + val isRedesignedScreenEnabled: Boolean +} \ No newline at end of file diff --git a/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsRouter.kt b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsRouter.kt new file mode 100644 index 0000000000..a361d75438 --- /dev/null +++ b/features/tokendetails/api/src/main/kotlin/com/tangem/features/tokendetails/navigation/TokenDetailsRouter.kt @@ -0,0 +1,8 @@ +package com.tangem.features.tokendetails.navigation + +import androidx.fragment.app.Fragment + +interface TokenDetailsRouter { + + fun getEntryFragment(): Fragment +} \ No newline at end of file diff --git a/features/tokendetails/impl/.gitignore b/features/tokendetails/impl/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/features/tokendetails/impl/.gitignore @@ -0,0 +1 @@ +/build diff --git a/features/tokendetails/impl/build.gradle.kts b/features/tokendetails/impl/build.gradle.kts new file mode 100644 index 0000000000..aa624c46ac --- /dev/null +++ b/features/tokendetails/impl/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) + id("configuration") +} + +android { + namespace = "com.tangem.features.tokendetails.impl" +} + + +dependencies { + /** AndroidX */ + implementation(deps.androidx.activity.compose) + + /** Compose */ + implementation(deps.compose.material) + implementation(deps.compose.foundation) + implementation(deps.compose.material3) + implementation(deps.compose.navigation) + implementation(deps.compose.navigation.hilt) + implementation(deps.compose.ui) + implementation(deps.compose.ui.tooling) + implementation(deps.compose.accompanist.systemUiController) + + /** DI */ + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) + + /** Core modules */ + implementation(projects.core.featuretoggles) + implementation(projects.core.ui) + + /** Feature Apis */ + implementation(projects.features.tokendetails.api) +} \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsFeatureTogglesModule.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsFeatureTogglesModule.kt new file mode 100644 index 0000000000..767b02d8a6 --- /dev/null +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsFeatureTogglesModule.kt @@ -0,0 +1,21 @@ +package com.tangem.feature.tokendetails.di + +import com.tangem.core.featuretoggle.manager.FeatureTogglesManager +import com.tangem.feature.tokendetails.featuretoggles.DefaultTokenDetailsFeatureToggles +import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +internal object TokenDetailsFeatureTogglesModule { + + @Provides + @Singleton + fun provideTokenDetailsFeatureToggles(featureTogglesManager: FeatureTogglesManager): TokenDetailsFeatureToggles { + return DefaultTokenDetailsFeatureToggles(featureTogglesManager = featureTogglesManager) + } +} \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsRouterModule.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsRouterModule.kt new file mode 100644 index 0000000000..47a8b90f2e --- /dev/null +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/di/TokenDetailsRouterModule.kt @@ -0,0 +1,18 @@ +package com.tangem.feature.tokendetails.di + +import com.tangem.feature.tokendetails.presentation.router.DefaultTokenDetailsRouter +import com.tangem.features.tokendetails.navigation.TokenDetailsRouter +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.android.components.ActivityComponent +import dagger.hilt.android.scopes.ActivityScoped + +@Module +@InstallIn(ActivityComponent::class) +internal object TokenDetailsRouterModule { + + @Provides + @ActivityScoped + fun provideTokenDetailsRouter(): TokenDetailsRouter = DefaultTokenDetailsRouter() +} \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/featuretoggles/DefaultTokenDetailsFeatureToggles.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/featuretoggles/DefaultTokenDetailsFeatureToggles.kt new file mode 100644 index 0000000000..2ac8bd5fde --- /dev/null +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/featuretoggles/DefaultTokenDetailsFeatureToggles.kt @@ -0,0 +1,14 @@ +package com.tangem.feature.tokendetails.featuretoggles + +import com.tangem.core.featuretoggle.manager.FeatureTogglesManager +import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles + +private const val REDESIGNED_TOKEN_DETAIL_SCREEN_ENABLED_KEY = "REDESIGNED_TOKEN_DETAIL_SCREEN_ENABLED" + +internal class DefaultTokenDetailsFeatureToggles( + private val featureTogglesManager: FeatureTogglesManager, +) : TokenDetailsFeatureToggles { + + override val isRedesignedScreenEnabled: Boolean + get() = featureTogglesManager.isFeatureEnabled(name = REDESIGNED_TOKEN_DETAIL_SCREEN_ENABLED_KEY) +} \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/router/DefaultTokenDetailsRouter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/router/DefaultTokenDetailsRouter.kt new file mode 100644 index 0000000000..6bfaf4dcaa --- /dev/null +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/router/DefaultTokenDetailsRouter.kt @@ -0,0 +1,10 @@ +package com.tangem.feature.tokendetails.presentation.router + +import androidx.fragment.app.Fragment +import com.tangem.features.tokendetails.navigation.TokenDetailsRouter + +internal class DefaultTokenDetailsRouter : TokenDetailsRouter { + + // TODO: Doston fix it in next PRs + override fun getEntryFragment(): Fragment = Fragment() +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 15b3f6a078..9f5e38d96a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -28,6 +28,8 @@ dependencyResolutionManagement { } } +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + include(":app") include(":common") @@ -61,6 +63,9 @@ include(":features:tester:impl") include(":features:wallet:api") include(":features:wallet:impl") +include(":features:tokendetails:api") +include(":features:tokendetails:impl") + include(":features:learn2earn:api") include(":features:learn2earn:impl") // endregion Feature modules From bfd2daa0b854d0ad6e13dd0d5d6c7cf03b61da2f Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 7 Jul 2023 16:55:06 +0300 Subject: [PATCH 11/19] Updated on 2026-08-14 --- features/learn2earn/impl/build.gradle.kts | 1 + .../learn2earn/analytics/Learn2earnEvents.kt | 70 ++++++++++++++ .../domain/DefaultLearn2earnInteractor.kt | 58 ++++++++---- .../learn2earn/domain/WebViewUriBuilder.kt | 42 ++------- .../learn2earn/domain/WebViewUriParser.kt | 91 +++++++++++++++++++ .../domain/api/WebViewRedirectHandler.kt | 4 +- .../domain/api/WebViewResultHandler.kt | 6 +- .../domain/di/Learn2earnDomainModule.kt | 5 +- .../learn2earn/domain/models/Promotion.kt | 2 +- .../presentation/Learn2earnViewModel.kt | 10 +- .../webView/Learn2earnWebViewActivity.kt | 2 +- .../webView/Learn2earnWebViewClient.kt | 12 +-- .../presentation/webView/WebViewViewModel.kt | 9 +- 13 files changed, 236 insertions(+), 76 deletions(-) create mode 100644 features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt create mode 100644 features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt diff --git a/features/learn2earn/impl/build.gradle.kts b/features/learn2earn/impl/build.gradle.kts index b1c4ef9a5a..26d0179187 100644 --- a/features/learn2earn/impl/build.gradle.kts +++ b/features/learn2earn/impl/build.gradle.kts @@ -10,6 +10,7 @@ plugins { dependencies { /** Core modules */ implementation(project(":common")) + implementation(project(":core:analytics")) implementation(project(":core:featuretoggles")) implementation(project(":core:datasource")) implementation(project(":core:utils")) diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt new file mode 100644 index 0000000000..e1fb409916 --- /dev/null +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt @@ -0,0 +1,70 @@ +package com.tangem.feature.learn2earn.analytics + +import com.tangem.core.analytics.AnalyticsEvent + +sealed class Learn2earnEvents( + category: String, + event: String, + params: Map = mapOf(), +) : AnalyticsEvent( + category = category, + event = event, + params = params + mapOf( + "Program Name" to "1inch", + ), +) { + + sealed class IntroductionProcess( + event: String, + params: Map = mapOf(), + ) : Learn2earnEvents( + category = "Introduction Process", + event = event, + params = params, + ) { + class ButtonLearn : IntroductionProcess("Button - Learn") + } + + sealed class MainScreen( + event: String, + params: Map = mapOf(), + ) : Learn2earnEvents( + category = "Main Screen", + event = event, + params = params, + ) { + class NoticeLear2earn(clientType: AnalyticsParam.ClientType) : MainScreen( + event = "Notice - Learn&Earn", + params = mapOf(AnalyticsParam.CLIENT_TYPE to clientType.value), + ) + + class NoticeClaimSuccess : MainScreen("Notice - Claim Successed") + } + + sealed class PromoScreen( + event: String, + params: Map = mapOf(), + ) : Learn2earnEvents( + category = "Promo Screen", + event = event, + params = params, + ) { + class ButtonBuy : PromoScreen("Button - Buy") + + class SuccessScreenOpened(clientType: AnalyticsParam.ClientType) : PromoScreen( + event = "Success Screen Opened", + params = mapOf(AnalyticsParam.CLIENT_TYPE to clientType.value), + ) + } +} + +sealed class AnalyticsParam { + sealed class ClientType(val value: String) { + object New : ClientType("New") + object Old : ClientType("Old") + } + + companion object Key { + const val CLIENT_TYPE = "Client type" + } +} \ No newline at end of file diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt index 90d279f90f..4536ec713f 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt @@ -1,6 +1,7 @@ package com.tangem.feature.learn2earn.domain import android.net.Uri +import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.datasource.api.promotion.models.AbstractPromotionResponse import com.tangem.datasource.api.promotion.models.PromotionInfoResponse import com.tangem.feature.learn2earn.data.api.Learn2earnRepository @@ -17,11 +18,12 @@ import com.tangem.lib.crypto.models.Currency /** [REDACTED_AUTHOR] */ -class DefaultLearn2earnInteractor( +internal class DefaultLearn2earnInteractor( private val featureToggleManager: Learn2earnFeatureToggleManager, private val repository: Learn2earnRepository, private val userWalletManager: UserWalletManager, private val derivationManager: DerivationManager, + private val analyticsEventHandler: AnalyticsEventHandler, dependencyProvider: Learn2earnDependencyProvider, ) : Learn2earnInteractor { @@ -29,11 +31,17 @@ class DefaultLearn2earnInteractor( private lateinit var promotion: Promotion - private val webViewUriBuilder: WebViewUriBuilder = WebViewUriBuilder( - authCredentialsProvider = dependencyProvider.getWebViewAuthCredentialsProvider(), - userCountryCodeProvider = dependencyProvider.getUserCountryCodeProvider(), - promoCodeProvider = { repository.getUserData().promoCode }, - ) + private val webViewUriBuilder: WebViewUriBuilder by lazy { + WebViewUriBuilder( + authCredentialsProvider = dependencyProvider.getWebViewAuthCredentialsProvider(), + userCountryCodeProvider = dependencyProvider.getUserCountryCodeProvider(), + promoCodeProvider = { repository.getUserData().promoCode }, + ) + } + + private val webViewUriParser: WebViewUriParser by lazy { + WebViewUriParser { repository.getProgramName() } + } override suspend fun init() { initPromotionInfo() @@ -183,27 +191,28 @@ class DefaultLearn2earnInteractor( return HeadersConverter().convert(webViewUriBuilder.getBasicAuthHeaders()) } - override fun handleRedirect(uri: Uri): RedirectConsequences { - if (webViewUriBuilder.isReadyForExistedCardAwardRedirect(uri)) { - updateUserData { it.copy(isRegisteredInPromotion = true) } - webViewResultHandler?.handleResult(WebViewResult.ReadyForAward) - return RedirectConsequences.FINISH_SESSION - } - - return if (webViewUriBuilder.isPromoCodeRedirect(uri)) { - webViewUriBuilder.extractPromoCode(uri)?.let { code -> + override fun handleRedirect(uri: Uri): WebViewAction { + val result = webViewUriParser.parse(uri) + when (result) { + is WebViewResult.PromoCode -> { updateUserData { it.copy( - promoCode = code, + promoCode = result.promoCode, isRegisteredInPromotion = true, ) } - webViewResultHandler?.handleResult(WebViewResult.PromoCodeReceived) } - RedirectConsequences.NOTHING - } else { - RedirectConsequences.PROCEED + WebViewResult.ReadyForAward -> { + updateUserData { it.copy(isRegisteredInPromotion = true) } + } + is WebViewResult.AnalyticsEvent -> { + analyticsEventHandler.send(result.event) + } + else -> Unit } + webViewResultHandler?.handleResult(result) + + return result.toWebViewAction() } private fun promotionIsActive(): Boolean { @@ -285,4 +294,13 @@ private fun Promotion.PromotionInfo.getData(promoCode: String?): PromotionInfoRe } else { oldCard } +} + +private fun WebViewResult.toWebViewAction(): WebViewAction { + return when (this) { + WebViewResult.Empty -> WebViewAction.PROCEED + WebViewResult.ReadyForAward -> WebViewAction.FINISH_SESSION + is WebViewResult.AnalyticsEvent -> WebViewAction.NOTHING + is WebViewResult.PromoCode -> WebViewAction.NOTHING + } } \ No newline at end of file diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriBuilder.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriBuilder.kt index 5af98601aa..0b2f6f6450 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriBuilder.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriBuilder.kt @@ -39,41 +39,15 @@ internal class WebViewUriBuilder( } } - fun isPromoCodeRedirect(uri: Uri): Boolean { - return uri.toString().contains(SUFFIX_CODE_CREATED) - } - - fun isReadyForExistedCardAwardRedirect(uri: Uri): Boolean { - return uri.toString().endsWith(SUFFIX_READY_FOR_AWARD) - } - - fun extractPromoCode(uri: Uri): String? { - val url = uri.toString() - - return if (isPromoCodeRedirect(uri)) { - val replaceString = makeWebViewUriBuilder().build().toString() + SUFFIX_CODE_CREATED - val code = url.replace(replaceString, "") - code - } else { - null - } - } - - private fun makeWebViewUriBuilder(): Uri.Builder { - val builder = Uri.Builder() - builder.scheme(SCHEME) - + private fun makeWebViewUriBuilder(): Uri.Builder = Uri.Builder().apply { + scheme(SCHEME) if (BuildConfig.DEBUG) { - builder.authority(DEV_BASE_URL) - builder.appendPath(userCountryCodeProvider.invoke()) - builder.appendPath(DEV_PATH_PROMOTION) + authority(DEV_BASE_URL) } else { - builder.authority(BASE_URL) - builder.appendPath(userCountryCodeProvider.invoke()) - builder.appendPath(PATH_PROMOTION) + authority(BASE_URL) } - - return builder + appendPath(userCountryCodeProvider.invoke()) + appendPath(PATH_PROMOTION) } private companion object { @@ -86,9 +60,5 @@ internal class WebViewUriBuilder( const val QUERY_EXISTED_CARD = "existed-card" const val DEV_BASE_URL = "devweb.tangem.com" - const val DEV_PATH_PROMOTION = "promotion-test" - - const val SUFFIX_CODE_CREATED = "/code-created?code=" - const val SUFFIX_READY_FOR_AWARD = "/ready-for-existed-card-award" } } \ No newline at end of file diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt new file mode 100644 index 0000000000..4d13b73fa5 --- /dev/null +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt @@ -0,0 +1,91 @@ +package com.tangem.feature.learn2earn.domain + +import android.net.Uri +import com.tangem.feature.learn2earn.analytics.AnalyticsParam +import com.tangem.feature.learn2earn.analytics.Learn2earnEvents +import com.tangem.feature.learn2earn.analytics.Learn2earnEvents.PromoScreen +import com.tangem.feature.learn2earn.domain.api.WebViewResult + +/** +[REDACTED_AUTHOR] + */ +internal class WebViewUriParser( + private val programNameProvider: () -> String, +) { + + fun parse(uri: Uri): WebViewResult = when { + isAnalyticsRedirect(uri) -> { + val event = extractAnalyticsEvent(uri) + if (event == null) { + WebViewResult.Empty + } else { + WebViewResult.AnalyticsEvent(event) + } + } + isPromoCodeRedirect(uri) -> { + val promoCode = extractPromoCode(uri) + if (promoCode == null) { + WebViewResult.Empty + } else { + WebViewResult.PromoCode(promoCode) + } + } + isReadyForAwardRedirect(uri) -> { + WebViewResult.ReadyForAward + } + else -> WebViewResult.Empty + } + + private fun isReadyForAwardRedirect(uri: Uri): Boolean { + return uri.lastPathSegment == PATH_READY_FOR_AWARD + } + + private fun isPromoCodeRedirect(uri: Uri): Boolean { + return uri.lastPathSegment == PATH_PROMO_CODE_CREATED && + uri.queryParameterNames.contains(QUERY_PROMO_CODE) + } + + private fun extractPromoCode(uri: Uri): String? { + return if (isPromoCodeRedirect(uri)) { + uri.getQueryParameter(QUERY_PROMO_CODE) + } else { + null + } + } + + private fun isAnalyticsRedirect(uri: Uri): Boolean { + return uri.lastPathSegment == PATH_ANALYTICS && + uri.queryParameterNames.contains(QUERY_ANALYTICS_EVENT) + } + + private fun extractAnalyticsEvent(uri: Uri): Learn2earnEvents? { + if (!isAnalyticsRedirect(uri)) return null + + val programName = uri.getQueryParameter(QUERY_PROGRAM_NAME) ?: return null + if (programName != programNameProvider.invoke()) return null + + val event = uri.getQueryParameter(QUERY_ANALYTICS_EVENT) ?: return null + + val analyticsEvent = when (event) { + EVENT_PROMO_BUY -> PromoScreen.ButtonBuy() + EVENT_PROMO_SUCCESS_NEW_USER -> PromoScreen.SuccessScreenOpened(AnalyticsParam.ClientType.New) + EVENT_PROMO_SUCCESS_OLD_USER -> PromoScreen.SuccessScreenOpened(AnalyticsParam.ClientType.Old) + else -> null + } + return analyticsEvent + } + + private companion object { + const val PATH_PROMO_CODE_CREATED = "code-created" + const val PATH_READY_FOR_AWARD = "ready-for-existed-card-award" + const val PATH_ANALYTICS = "analytics" + + const val QUERY_PROMO_CODE = "code" + const val QUERY_ANALYTICS_EVENT = "event" + const val QUERY_PROGRAM_NAME = "programName" + + const val EVENT_PROMO_BUY = "promotion-buy" + const val EVENT_PROMO_SUCCESS_NEW_USER = "promotion-success-new-user" + const val EVENT_PROMO_SUCCESS_OLD_USER = "promotion-success-old-user" + } +} \ No newline at end of file diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewRedirectHandler.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewRedirectHandler.kt index efca9c182a..6f2fe55945 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewRedirectHandler.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewRedirectHandler.kt @@ -9,10 +9,10 @@ import android.net.Uri [REDACTED_AUTHOR] */ interface WebViewRedirectHandler { - fun handleRedirect(uri: Uri): RedirectConsequences + fun handleRedirect(uri: Uri): WebViewAction } -enum class RedirectConsequences { +enum class WebViewAction { NOTHING, PROCEED, FINISH_SESSION, diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt index 08a749f327..a3458c09e4 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt @@ -1,5 +1,7 @@ package com.tangem.feature.learn2earn.domain.api +import com.tangem.feature.learn2earn.analytics.Learn2earnEvents + /** * Handler that helps determine a result of the Learn2earnWebViewActivity webView actions. * @@ -10,6 +12,8 @@ interface WebViewResultHandler { } sealed class WebViewResult { - object PromoCodeReceived : WebViewResult() + object Empty : WebViewResult() + data class PromoCode(val promoCode: String) : WebViewResult() object ReadyForAward : WebViewResult() + data class AnalyticsEvent(val event: Learn2earnEvents) : WebViewResult() } \ No newline at end of file diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/di/Learn2earnDomainModule.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/di/Learn2earnDomainModule.kt index 7f48ea304a..72c05a6953 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/di/Learn2earnDomainModule.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/di/Learn2earnDomainModule.kt @@ -1,6 +1,7 @@ package com.tangem.feature.learn2earn.domain.di import android.content.Context +import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.featuretoggle.manager.FeatureTogglesManager import com.tangem.feature.learn2earn.data.api.Learn2earnRepository import com.tangem.feature.learn2earn.data.toggles.DefaultLearn2earnFeatureToggleManager @@ -21,7 +22,7 @@ import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) -class Learn2earnDomainModule { +internal class Learn2earnDomainModule { @Provides @Singleton @@ -42,6 +43,7 @@ class Learn2earnDomainModule { repository: Learn2earnRepository, dependencyProvider: Learn2earnDependencyProvider, userWalletManager: UserWalletManager, + analyticsEventHandler: AnalyticsEventHandler, derivationManager: DerivationManager, ): Learn2earnInteractor { return DefaultLearn2earnInteractor( @@ -49,6 +51,7 @@ class Learn2earnDomainModule { repository = repository, userWalletManager = userWalletManager, derivationManager = derivationManager, + analyticsEventHandler = analyticsEventHandler, dependencyProvider = dependencyProvider, ) } diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/models/Promotion.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/models/Promotion.kt index 5fc46b4e11..463001cb21 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/models/Promotion.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/models/Promotion.kt @@ -5,7 +5,7 @@ import com.tangem.datasource.api.promotion.models.PromotionInfoResponse /** [REDACTED_AUTHOR] */ -data class Promotion( +internal data class Promotion( val info: PromotionInfo?, val error: PromotionError?, ) { diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt index e6d45c0b51..217f7b2f6d 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt @@ -5,6 +5,9 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.tangem.core.analytics.api.AnalyticsEventHandler +import com.tangem.feature.learn2earn.analytics.AnalyticsParam +import com.tangem.feature.learn2earn.analytics.Learn2earnEvents import com.tangem.feature.learn2earn.domain.api.Learn2earnInteractor import com.tangem.feature.learn2earn.domain.api.WebViewResult import com.tangem.feature.learn2earn.domain.api.WebViewResultHandler @@ -25,6 +28,7 @@ class Learn2earnViewModel @Inject constructor( private val interactor: Learn2earnInteractor, private val router: Learn2earnRouter, private val dispatchers: AppCoroutineDispatcherProvider, + private val analytics: AnalyticsEventHandler, ) : ViewModel() { var uiState: Learn2earnState by mutableStateOf( @@ -63,16 +67,19 @@ class Learn2earnViewModel @Inject constructor( } private fun onButtonStoryClick() { + analytics.send(Learn2earnEvents.IntroductionProcess.ButtonLearn()) router.openWebView(interactor.buildUriForNewUser(), interactor.getBasicAuthHeaders()) } private fun onButtonMainClick() { if (!interactor.isUserHadPromoCode() && !interactor.isUserRegisteredInPromotion()) { + analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.New)) subscribeToWebViewResultEvents() router.openWebView(interactor.buildUriForOldUser(), interactor.getBasicAuthHeaders()) return } + analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.Old)) viewModelScope.launch(dispatchers.io) { updateUi { uiState.updateProgress(showProgress = true) } @@ -80,6 +87,7 @@ class Learn2earnViewModel @Inject constructor( .onSuccess { requestAwardResult -> requestAwardResult.fold( onSuccess = { + analytics.send(Learn2earnEvents.MainScreen.NoticeClaimSuccess()) val onHideDialog = { uiState = uiState.updateGetBonusVisibility(isVisible = false) .hideDialog() @@ -166,7 +174,7 @@ class Learn2earnViewModel @Inject constructor( interactor.webViewResultHandler = null when (result) { WebViewResult.ReadyForAward -> updateMainScreenViews() - WebViewResult.PromoCodeReceived -> Unit + else -> Unit } } } diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewActivity.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewActivity.kt index cea693607e..7300fcdb06 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewActivity.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewActivity.kt @@ -38,7 +38,7 @@ class Learn2earnWebViewActivity : AppCompatActivity() { webView.settings.loadsImagesAutomatically = true webView.webViewClient = Learn2earnWebViewClient( - helper = viewModel, + redirectHandler = viewModel, headers = webViewData.headers, finishSessionHandler = { finish() }, ) diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewClient.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewClient.kt index 5957d80a32..7a96dbc90b 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewClient.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/Learn2earnWebViewClient.kt @@ -3,28 +3,28 @@ package com.tangem.feature.learn2earn.presentation.webView import android.webkit.WebResourceRequest import android.webkit.WebView import android.webkit.WebViewClient -import com.tangem.feature.learn2earn.domain.api.RedirectConsequences +import com.tangem.feature.learn2earn.domain.api.WebViewAction import com.tangem.feature.learn2earn.domain.api.WebViewRedirectHandler import timber.log.Timber internal class Learn2earnWebViewClient( - private val helper: WebViewRedirectHandler, + private val redirectHandler: WebViewRedirectHandler, private val headers: Map, private val finishSessionHandler: () -> Unit, ) : WebViewClient() { override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { Timber.d("url: ${request.url}") - when (helper.handleRedirect(request.url)) { - RedirectConsequences.PROCEED -> { + when (redirectHandler.handleRedirect(request.url)) { + WebViewAction.NOTHING -> Unit + WebViewAction.PROCEED -> { val mergedHeaders = headers.toMutableMap() request.requestHeaders?.let { mergedHeaders.putAll(it) } view.loadUrl(request.url.toString(), mergedHeaders) } - RedirectConsequences.FINISH_SESSION -> { + WebViewAction.FINISH_SESSION -> { finishSessionHandler.invoke() } - else -> Unit } return true } diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/WebViewViewModel.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/WebViewViewModel.kt index 3b25e78a58..f6daa6c3ef 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/WebViewViewModel.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/webView/WebViewViewModel.kt @@ -4,7 +4,6 @@ import android.content.Intent import android.net.Uri import androidx.lifecycle.ViewModel import com.tangem.feature.learn2earn.domain.HeadersConverter -import com.tangem.feature.learn2earn.domain.api.RedirectConsequences import com.tangem.feature.learn2earn.domain.api.WebViewRedirectHandler import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @@ -14,12 +13,8 @@ import javax.inject.Inject */ @HiltViewModel internal class WebViewViewModel @Inject constructor( - private val handler: WebViewRedirectHandler, -) : ViewModel(), WebViewRedirectHandler { - - override fun handleRedirect(uri: Uri): RedirectConsequences { - return handler.handleRedirect(uri) - } + handler: WebViewRedirectHandler, +) : ViewModel(), WebViewRedirectHandler by handler { fun extractData(intent: Intent): WebViewData { val uriString = requireNotNull(intent.getStringExtra(Learn2earnWebViewActivity.EXTRA_WEB_URI)) { From 692fd9baa7e171addd50c3c66a23ca6a205113b2 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 4 Jul 2023 19:38:51 +0300 Subject: [PATCH 12/19] Updated on 2026-08-14 --- .../learn2earn/presentation/ui/Learn2earnStoriesScreen.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt index 4793bcfbc4..d07a9cee74 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt @@ -49,9 +49,10 @@ fun Learn2earnStoriesScreen(onLearnClick: () -> Unit, modifier: Modifier = Modif SecondaryButton( modifier = Modifier .padding(horizontal = TangemTheme.dimens.size16) - .padding(bottom = TangemTheme.dimens.size84) + .padding(bottom = TangemTheme.dimens.size36) .fillMaxWidth() - .align(Alignment.BottomCenter), + .align(Alignment.BottomCenter) + .navigationBarsPadding(), text = stringResource(id = R.string.story_learn_learn), onClick = onLearnClick, ) From d3e5f199d989043a83c9f3725a86a37b3869bbef Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 4 Jul 2023 20:08:58 +0300 Subject: [PATCH 13/19] Updated on 2026-08-14 --- .../ui/Learn2earnStoriesScreen.kt | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt index d07a9cee74..2a6babec43 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt @@ -32,20 +32,27 @@ fun Learn2earnStoriesScreen(onLearnClick: () -> Unit, modifier: Modifier = Modif .fillMaxSize() .align(Alignment.Center), ) - StoryDescription( - modifier = Modifier - .padding(horizontal = TangemTheme.dimens.size40) - .fillMaxSize(), - headerText = stringResource(id = R.string.story_learn_title), - bodyText = stringResource(id = R.string.story_learn_description), - ) - Image( - modifier = Modifier - .padding(bottom = TangemTheme.dimens.size68) - .align(Alignment.BottomCenter), - painter = painterResource(id = R.drawable.img_1inch_logo_401_378), - contentDescription = null, - ) + Column( + modifier = Modifier.fillMaxSize(), + ) { + StoryDescription( + modifier = Modifier + .padding(horizontal = TangemTheme.dimens.size40) + .weight(weight = 1f), + headerText = stringResource(id = R.string.story_learn_title), + bodyText = stringResource(id = R.string.story_learn_description), + ) + Image( + modifier = Modifier + .fillMaxWidth() + .padding(bottom = TangemTheme.dimens.size16) + .navigationBarsPadding() + .weight(weight = 1.2f), + painter = painterResource(id = R.drawable.img_1inch_logo_401_378), + contentDescription = null, + ) + } + SecondaryButton( modifier = Modifier .padding(horizontal = TangemTheme.dimens.size16) From 51eefcb45d325f26175e5691af9221730e931fdc Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 4 Jul 2023 21:48:45 +0300 Subject: [PATCH 14/19] Updated on 2026-08-14 --- app/src/main/AndroidManifest.xml | 2 +- .../src/main/res/layout/activity_web_view.xml | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b115140383..53d4be3c7f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -141,7 +141,7 @@ + android:theme="@style/AppTheme" /> @@ -10,21 +10,29 @@ android:id="@+id/app_bar" style="@style/Widget.MaterialComponents.Toolbar.Surface" android:layout_width="match_parent" - app:liftOnScroll="true" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + app:elevation="0dp"> - + app:layout_behavior="@string/appbar_scrolling_view_behavior"> + + + + + \ No newline at end of file From ca11e494259dabb78277e99d2d63d374bfa089f0 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 6 Jul 2023 17:35:27 +0300 Subject: [PATCH 15/19] Updated on 2026-08-14 --- core/res/src/main/res/values-ru/strings.xml | 18 ++++++++---------- core/res/src/main/res/values/strings.xml | 14 ++++++-------- .../presentation/ui/Learn2earnStoriesScreen.kt | 2 +- .../presentation/ui/state/Learn2earnState.kt | 4 ++-- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 7ec3cf5896..797b9dea53 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -68,6 +68,7 @@ Обменять Посмотреть историю транзакций Обозреватель + Учись и получай бонусы! Нравится Основная сеть Нет @@ -160,21 +161,19 @@ Приложите карту Внутренняя ошибка: не удается найти менеджер кошельков Вы обновили данные биометрии, отсканируйте свою карту для входа - Вы завершили обучение и можете получить свои токены 1inch - Получите бонус + Вы успешно прошли все уроки и теперь можете получить 1INCH токены - Пройдите обучение и получите %d токен 1inch на свой кошелек - Пройдите обучение и получите %d токена 1inch на свой кошелек - Пройдите обучение и получите %d токена 1inch на свой кошелек - Пройдите обучение и получите %d токенов 1inch на свой кошелек + Пройдите 3 урока и получите %d 1INCH токен на свой кошелек + Пройдите 3 урока и получите %d 1INCH токена на свой кошелек + Пройдите 3 урока и получите %d 1INCH токена на свой кошелек + Пройдите 3 урока и получите %d 1INCH токенов на свой кошелек - Бонус за обучение Управление токенами Чтобы защитить свои активы, мы советуем вам выполнить эту процедуру Бэкап кошелька не был произведен Баланс В сумме учтены не все монеты - Токены 1inch будут зачислены на адрес вашего кошелька %s в течение 24 часов + 1INCH токены будут зачислены на адрес вашего кошелька в сети %s в течение 24 часов По вашему промокоду не было покупки кошелька, а значит вы не можете получить бонус. Купите кошелек Tangem, отсканируйте его в приложении и получите бонус. Чтобы получить доступ ко всем сетям, вам необходимо отсканировать карту Отсканируйте карту @@ -355,9 +354,8 @@ Тысячи криптовалют Используйте его на ходу, в любом месте, в любое время. Без проводов и батареек. Как только понадобится крипта, просто приложите карту к телефону. Кошелек для каждого - Пройдите обучение и получите возможность купить кошелек Tangem со скидкой и токены 1inch в качестве бонуса + Пройдите 3 урока, получите скидку на покупку Tangem Wallet и 1INCH токены Пройти обучение - Получите свой бонус Занимайте Покупайте Обменивайте diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index d2dac748b6..cd659ff14e 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -66,6 +66,7 @@ Exchange Explore transaction history Explorer + Learn & Earn Like Main network No @@ -158,19 +159,17 @@ Tap the card Internal error: wallet manager not found You have updated biometrics, scan your card to enter - You have completed the training and can get your 1inch tokens - Get a bonus + You have completed all of the lessons, and are now eligible to receive your 1INCH tokens - Complete the training and get %d 1inch token on your wallet - Complete the training and get %d 1inch tokens on your wallet + Complete three lessons and receive %d 1INCH token to your wallet + Complete three lessons and receive %d 1INCH tokens to your wallet - Learn & Earn Manage tokens To protect your assets, we advise you to carry out this procedure Your wallet has not been backed up Total balance The amount does not include some of your funds - 1inch tokens will be credited to your %s wallet address within 24 hours + 1INCH tokens will be credited to your %s wallet address within 24 hours There was no purchase of a wallet using your promo code, which means you cannot receive a bonus. Buy Tangem wallet, scan it in the app, and get the bonus. To access all the networks you need to scan the card Scan your card @@ -351,9 +350,8 @@ Thousands of Currencies Use it on the go, anywhere, anytime. No wires or batteries. Just tap the card to your phone when you need your crypto. The Wallet for Everyone - Complete the training, get the opportunity to buy Tangem wallet with a discount and receive 1inch tokens on your wallet + Take three lessons, get a discount on your Tangem Wallet, and receive 1INCH tokens to your wallet Learn - Learn and get a bonus Borrow Buy Exchange diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt index 2a6babec43..b91ffaf2f5 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/Learn2earnStoriesScreen.kt @@ -39,7 +39,7 @@ fun Learn2earnStoriesScreen(onLearnClick: () -> Unit, modifier: Modifier = Modif modifier = Modifier .padding(horizontal = TangemTheme.dimens.size40) .weight(weight = 1f), - headerText = stringResource(id = R.string.story_learn_title), + headerText = stringResource(id = R.string.common_learn_and_earn), bodyText = stringResource(id = R.string.story_learn_description), ) Image( diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/state/Learn2earnState.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/state/Learn2earnState.kt index c6eb8a4d4d..4ba08f14bb 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/state/Learn2earnState.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/ui/state/Learn2earnState.kt @@ -37,12 +37,12 @@ data class MainScreenState( sealed class Description(val title: TextReference, val subtitle: TextReference) { class Learn(award: Int) : Description( - TextReference.Res(R.string.main_learn_title), + TextReference.Res(R.string.common_learn_and_earn), TextReference.PluralRes(R.plurals.main_learn_subtitle, award, WrappedList(listOf(award))), ) object GetBonus : Description( - TextReference.Res(R.string.main_get_bonus_title), + TextReference.Res(R.string.common_learn_and_earn), TextReference.Res(R.string.main_get_bonus_subtitle), ) } From ae809777c8a7c521545ccdfdd9f9662ddd9a3571 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 7 Jul 2023 19:56:37 +0400 Subject: [PATCH 16/19] Updated on 2026-08-14 --- .../com/tangem/domain/common/extensions/Blockchain.kt | 8 +++++++- gradle/dependencies.toml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt b/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt index f4084f38df..15fb408bde 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt +++ b/domain/legacy/src/main/java/com/tangem/domain/common/extensions/Blockchain.kt @@ -29,6 +29,7 @@ fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? { "bitcoin-cash/test" -> Blockchain.BitcoinCashTestnet "cardano" -> Blockchain.CardanoShelley "dogecoin" -> Blockchain.Dogecoin + "ducatus" -> Blockchain.Ducatus "litecoin" -> Blockchain.Litecoin "rootstock" -> Blockchain.RSK "stellar" -> Blockchain.Stellar @@ -86,6 +87,7 @@ fun Blockchain.toNetworkId(): String { Blockchain.Cardano -> "cardano" Blockchain.CardanoShelley -> "cardano" Blockchain.Dogecoin -> "dogecoin" + Blockchain.Ducatus -> "ducatus" Blockchain.Ethereum -> "ethereum" Blockchain.EthereumTestnet -> "ethereum/test" Blockchain.EthereumClassic -> "ethereum-classic" @@ -150,6 +152,7 @@ fun Blockchain.toCoinId(): String { Blockchain.Fantom, Blockchain.FantomTestnet -> "fantom" Blockchain.Tron, Blockchain.TronTestnet -> "tron" Blockchain.Polkadot, Blockchain.PolkadotTestnet -> "polkadot" + Blockchain.Ducatus -> "ducatus" Blockchain.Litecoin -> "litecoin" Blockchain.RSK -> "rootstock" Blockchain.Tezos -> "tezos" @@ -179,4 +182,7 @@ fun Blockchain.isSupportedInApp(): Boolean { return !excludedBlockchains.contains(this) } -private val excludedBlockchains = listOf(Blockchain.Unknown) \ No newline at end of file +private val excludedBlockchains = listOf( + Blockchain.Unknown, + Blockchain.Ducatus, +) \ No newline at end of file diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 042782007e..515c8832d2 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -78,7 +78,7 @@ walletConnectWeb3 = "1.10.0" # endregion Other libraries # region Tangem -tangemBlockchainSdk = "develop-264" +tangemBlockchainSdk = "develop-268" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "develop-266" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds From 72163c43f9c4e7a25763983d3c73fbbdf3beae98 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 7 Jul 2023 19:05:13 +0300 Subject: [PATCH 17/19] Updated on 2026-08-14 --- app/src/main/res/values-v24/bool.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-v24/bool.xml b/app/src/main/res/values-v24/bool.xml index 093ecf3bc6..d5677354f0 100644 --- a/app/src/main/res/values-v24/bool.xml +++ b/app/src/main/res/values-v24/bool.xml @@ -1,5 +1,5 @@ - false + true From 0308841aa07b9e6defc78b16feda13b4596f15fb Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 7 Jul 2023 18:39:41 +0300 Subject: [PATCH 18/19] Updated on 2026-08-14 --- .../learn2earn/analytics/Learn2earnEvents.kt | 8 ++--- .../domain/DefaultLearn2earnInteractor.kt | 30 +++++++++---------- .../learn2earn/domain/WebViewUriParser.kt | 6 ++-- .../domain/api/WebViewResultHandler.kt | 4 +-- .../presentation/Learn2earnViewModel.kt | 9 +++--- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt index e1fb409916..164fa4e793 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/analytics/Learn2earnEvents.kt @@ -2,7 +2,7 @@ package com.tangem.feature.learn2earn.analytics import com.tangem.core.analytics.AnalyticsEvent -sealed class Learn2earnEvents( +internal sealed class Learn2earnEvents( category: String, event: String, params: Map = mapOf(), @@ -58,10 +58,10 @@ sealed class Learn2earnEvents( } } -sealed class AnalyticsParam { +internal sealed class AnalyticsParam { sealed class ClientType(val value: String) { - object New : ClientType("New") - object Old : ClientType("Old") + class New : ClientType("New") + class Old : ClientType("Old") } companion object Key { diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt index 4536ec713f..402f88ee82 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/DefaultLearn2earnInteractor.kt @@ -205,10 +205,10 @@ internal class DefaultLearn2earnInteractor( WebViewResult.ReadyForAward -> { updateUserData { it.copy(isRegisteredInPromotion = true) } } - is WebViewResult.AnalyticsEvent -> { + is WebViewResult.Learn2earnAnalyticsEvent -> { analyticsEventHandler.send(result.event) } - else -> Unit + WebViewResult.Empty -> Unit } webViewResultHandler?.handleResult(result) @@ -286,21 +286,21 @@ internal class DefaultLearn2earnInteractor( repository.updateUserData(this) } } -} -private fun Promotion.PromotionInfo.getData(promoCode: String?): PromotionInfoResponse.Data { - return if (promoCode == null) { - newCard - } else { - oldCard + private fun Promotion.PromotionInfo.getData(promoCode: String?): PromotionInfoResponse.Data { + return if (promoCode == null) { + newCard + } else { + oldCard + } } -} -private fun WebViewResult.toWebViewAction(): WebViewAction { - return when (this) { - WebViewResult.Empty -> WebViewAction.PROCEED - WebViewResult.ReadyForAward -> WebViewAction.FINISH_SESSION - is WebViewResult.AnalyticsEvent -> WebViewAction.NOTHING - is WebViewResult.PromoCode -> WebViewAction.NOTHING + private fun WebViewResult.toWebViewAction(): WebViewAction { + return when (this) { + WebViewResult.Empty -> WebViewAction.PROCEED + WebViewResult.ReadyForAward -> WebViewAction.FINISH_SESSION + is WebViewResult.Learn2earnAnalyticsEvent -> WebViewAction.NOTHING + is WebViewResult.PromoCode -> WebViewAction.NOTHING + } } } \ No newline at end of file diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt index 4d13b73fa5..f8d1d18e22 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/WebViewUriParser.kt @@ -19,7 +19,7 @@ internal class WebViewUriParser( if (event == null) { WebViewResult.Empty } else { - WebViewResult.AnalyticsEvent(event) + WebViewResult.Learn2earnAnalyticsEvent(event) } } isPromoCodeRedirect(uri) -> { @@ -68,8 +68,8 @@ internal class WebViewUriParser( val analyticsEvent = when (event) { EVENT_PROMO_BUY -> PromoScreen.ButtonBuy() - EVENT_PROMO_SUCCESS_NEW_USER -> PromoScreen.SuccessScreenOpened(AnalyticsParam.ClientType.New) - EVENT_PROMO_SUCCESS_OLD_USER -> PromoScreen.SuccessScreenOpened(AnalyticsParam.ClientType.Old) + EVENT_PROMO_SUCCESS_NEW_USER -> PromoScreen.SuccessScreenOpened(AnalyticsParam.ClientType.New()) + EVENT_PROMO_SUCCESS_OLD_USER -> PromoScreen.SuccessScreenOpened(AnalyticsParam.ClientType.Old()) else -> null } return analyticsEvent diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt index a3458c09e4..6b7c851a69 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/domain/api/WebViewResultHandler.kt @@ -1,6 +1,6 @@ package com.tangem.feature.learn2earn.domain.api -import com.tangem.feature.learn2earn.analytics.Learn2earnEvents +import com.tangem.core.analytics.AnalyticsEvent /** * Handler that helps determine a result of the Learn2earnWebViewActivity webView actions. @@ -15,5 +15,5 @@ sealed class WebViewResult { object Empty : WebViewResult() data class PromoCode(val promoCode: String) : WebViewResult() object ReadyForAward : WebViewResult() - data class AnalyticsEvent(val event: Learn2earnEvents) : WebViewResult() + data class Learn2earnAnalyticsEvent(val event: AnalyticsEvent) : WebViewResult() } \ No newline at end of file diff --git a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt index 217f7b2f6d..8c3cbfb221 100644 --- a/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt +++ b/features/learn2earn/impl/src/main/java/com/tangem/feature/learn2earn/presentation/Learn2earnViewModel.kt @@ -73,13 +73,13 @@ class Learn2earnViewModel @Inject constructor( private fun onButtonMainClick() { if (!interactor.isUserHadPromoCode() && !interactor.isUserRegisteredInPromotion()) { - analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.New)) + analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.New())) subscribeToWebViewResultEvents() router.openWebView(interactor.buildUriForOldUser(), interactor.getBasicAuthHeaders()) return } - analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.Old)) + analytics.send(Learn2earnEvents.MainScreen.NoticeLear2earn(AnalyticsParam.ClientType.Old())) viewModelScope.launch(dispatchers.io) { updateUi { uiState.updateProgress(showProgress = true) } @@ -172,9 +172,8 @@ class Learn2earnViewModel @Inject constructor( interactor.webViewResultHandler = object : WebViewResultHandler { override fun handleResult(result: WebViewResult) { interactor.webViewResultHandler = null - when (result) { - WebViewResult.ReadyForAward -> updateMainScreenViews() - else -> Unit + if (result is WebViewResult.ReadyForAward) { + updateMainScreenViews() } } } From b327aef89d6db38e6ed694ffd47657ad5e4b0adb Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 7 Jul 2023 11:33:27 +0800 Subject: [PATCH 19/19] Updated on 2026-08-14 --- app/build.gradle.kts | 2 + .../main/java/com/tangem/tap/MainActivity.kt | 2 +- .../java/com/tangem/tap/TapApplication.kt | 2 +- .../common/analytics/topup/TopUpController.kt | 6 +- .../com/tangem/tap/common/extensions/Store.kt | 2 +- .../tap/common/redux/global/GlobalAction.kt | 8 +- .../tap/common/redux/global/GlobalState.kt | 2 +- .../com/tangem/tap/domain/TapWalletManager.kt | 2 +- .../domain/extensions/WalletManagerFactory.kt | 8 +- .../tap/domain/model/WalletStoreModel.kt | 4 +- .../model/builders/UserWalletBuilder.kt | 6 +- .../model/builders/UserWalletIdBuilder.kt | 6 +- .../model/builders/WalletStoreBuilder.kt | 10 +-- .../domain/tasks/product/ScanProductTask.kt | 10 +-- .../tap/domain/tokens/UserTokensRepository.kt | 2 +- .../UserWalletsListManagerExtensions.kt | 3 +- .../di/UserWalletsListManagerProvider.kt | 9 +-- .../BiometricUserWalletsListManager.kt | 6 +- .../RuntimeUserWalletsListManager.kt | 6 +- .../model/UserWalletEncryptionKey.kt | 2 +- .../model/UserWalletInformation.kt | 2 +- .../SelectedUserWalletRepository.kt | 2 +- .../repository/UserWalletsKeysRepository.kt | 2 +- .../UserWalletsPublicInformationRepository.kt | 4 +- ...erWalletsSensitiveInformationRepository.kt | 4 +- .../BiometricUserWalletsKeysRepository.kt | 9 +-- .../DefaultSelectedUserWalletRepository.kt | 2 +- ...tUserWalletsPublicInformationRepository.kt | 4 +- ...erWalletsSensitiveInformationRepository.kt | 4 +- .../tap/domain/userWalletList/utils/Mapper.kt | 4 +- .../WalletCurrenciesManager.kt | 2 +- .../di/WalletCurrenciesManagerProvider.kt | 2 +- .../DefaultWalletCurrenciesManager.kt | 8 +- .../walletStores/WalletStoresManager.kt | 4 +- .../di/WalletsStoresManagerProvider.kt | 6 +- .../DefaultWalletStoresManager.kt | 13 +--- .../DummyWalletStoresManager.kt | 4 +- .../repository/WalletAmountsRepository.kt | 2 +- .../repository/WalletStoresRepository.kt | 2 +- .../repository/di/RepositoryProvider.kt | 2 +- .../DefaultWalletAmountsRepository.kt | 6 +- .../DefaultWalletManagersRepository.kt | 15 ++-- .../DefaultWalletStoresRepository.kt | 2 +- .../utils/WalletStoreOperations.kt | 2 +- .../storage/WalletManagerStorage.kt | 2 +- .../storage/WalletStoresStorage.kt | 2 +- .../walletconnect/WalletConnectSdkHelper.kt | 2 +- .../details/redux/DetailsMiddleware.kt | 8 +- .../walletconnect/WalletConnectMiddleware.kt | 2 +- .../redux/OnboardingOtherCardsMiddleware.kt | 10 +-- .../redux/OnboardingWalletMiddleware.kt | 2 +- .../saveWallet/redux/SaveWalletMiddleware.kt | 9 +-- .../tap/features/wallet/models/Currency.kt | 2 +- .../tap/features/wallet/redux/WalletAction.kt | 6 +- .../tap/features/wallet/redux/WalletState.kt | 2 +- .../middlewares/MultiWalletMiddleware.kt | 2 +- .../tap/features/wallet/ui/WalletViewModel.kt | 2 +- .../tap/features/wallet/ui/test/TestWallet.kt | 2 +- .../walletSelector/redux/UserWalletModel.kt | 2 +- .../redux/WalletSelectorAction.kt | 4 +- .../redux/WalletSelectorMiddleware.kt | 4 +- .../redux/WalletSelectorReducer.kt | 2 +- .../redux/WalletSelectorState.kt | 2 +- .../ui/WalletSelectorScreenState.kt | 2 +- .../ui/WalletSelectorViewModel.kt | 2 +- .../walletSelector/ui/components/MockData.kt | 2 +- .../WallectSelectorScreenContent.kt | 2 +- .../ui/components/WalletItem.kt | 13 +--- .../walletSelector/ui/model/UserWalletItem.kt | 2 +- .../com/tangem/tap/proxy/AppStateHolder.kt | 2 +- .../tangem/tap/proxy/DerivationManagerImpl.kt | 2 +- .../tap/proxy/TransactionManagerImpl.kt | 2 +- .../tangem/tap/proxy/UserWalletManagerImpl.kt | 2 +- .../domain/common}/BlockchainNetwork.kt | 4 +- .../tangem/domain/common/util/UserWalletId.kt | 34 -------- domain/wallets/.gitignore | 1 + domain/wallets/build.gradle.kts | 26 +++++++ domain/wallets/models/.gitignore | 1 + domain/wallets/models/build.gradle.kts | 14 ++++ .../domain/wallets/models}/UserWallet.kt | 3 +- .../domain/wallets/models/UserWalletId.kt | 13 ++++ .../wallets/legacy}/UserWalletsListManager.kt | 78 ++++++++----------- .../legacy}/WalletManagersRepository.kt | 9 ++- settings.gradle.kts | 2 + 84 files changed, 222 insertions(+), 266 deletions(-) rename {app/src/main/java/com/tangem/tap/domain/tokens/models => domain/legacy/src/main/java/com/tangem/domain/common}/BlockchainNetwork.kt (97%) delete mode 100644 domain/legacy/src/main/java/com/tangem/domain/common/util/UserWalletId.kt create mode 100644 domain/wallets/.gitignore create mode 100644 domain/wallets/build.gradle.kts create mode 100644 domain/wallets/models/.gitignore create mode 100644 domain/wallets/models/build.gradle.kts rename {app/src/main/java/com/tangem/tap/domain/model => domain/wallets/models/src/main/java/com/tangem/domain/wallets/models}/UserWallet.kt (93%) create mode 100644 domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt rename {app/src/main/java/com/tangem/tap/domain/userWalletList => domain/wallets/src/main/java/com/tangem/domain/wallets/legacy}/UserWalletsListManager.kt (67%) rename {app/src/main/java/com/tangem/tap/domain/walletStores/repository => domain/wallets/src/main/java/com/tangem/domain/wallets/legacy}/WalletManagersRepository.kt (75%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1f144358fa..53f77b0fa6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -26,6 +26,8 @@ dependencies { implementation(project(":domain:models")) implementation(project(":domain:core")) implementation(project(":domain:card")) + implementation(project(":domain:wallets")) + implementation(project(":domain:wallets:models")) implementation(project(":common")) implementation(project(":core:analytics")) implementation(project(":core:featuretoggles")) diff --git a/app/src/main/java/com/tangem/tap/MainActivity.kt b/app/src/main/java/com/tangem/tap/MainActivity.kt index de2272f1f5..c3036b82e2 100644 --- a/app/src/main/java/com/tangem/tap/MainActivity.kt +++ b/app/src/main/java/com/tangem/tap/MainActivity.kt @@ -12,6 +12,7 @@ import by.kirich1409.viewbindingdelegate.viewBinding import com.google.android.material.snackbar.Snackbar import com.tangem.TangemSdk import com.tangem.domain.card.ScanCardUseCase +import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.features.tester.api.TesterRouter import com.tangem.features.tokendetails.navigation.TokenDetailsRouter import com.tangem.features.wallet.navigation.WalletRouter @@ -30,7 +31,6 @@ import com.tangem.tap.common.shop.googlepay.GooglePayService import com.tangem.tap.common.shop.googlepay.GooglePayService.Companion.LOAD_PAYMENT_DATA_REQUEST_CODE import com.tangem.tap.common.shop.googlepay.GooglePayUtil.createPaymentsClient import com.tangem.tap.domain.TangemSdkManager -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation import com.tangem.tap.domain.userWalletList.di.provideRuntimeImplementation import com.tangem.tap.domain.walletconnect2.domain.WalletConnectInteractor diff --git a/app/src/main/java/com/tangem/tap/TapApplication.kt b/app/src/main/java/com/tangem/tap/TapApplication.kt index 4288c782e7..63dfcc0729 100644 --- a/app/src/main/java/com/tangem/tap/TapApplication.kt +++ b/app/src/main/java/com/tangem/tap/TapApplication.kt @@ -21,6 +21,7 @@ import com.tangem.datasource.config.models.Config import com.tangem.datasource.connection.NetworkConnectionManager import com.tangem.domain.DomainLayer import com.tangem.domain.common.LogConfig +import com.tangem.domain.wallets.legacy.WalletManagersRepository import com.tangem.feature.learn2earn.domain.api.Learn2earnInteractor import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles @@ -48,7 +49,6 @@ import com.tangem.tap.domain.walletCurrencies.di.provideDefaultImplementation import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.di.provideDefaultImplementation import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository -import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.di.provideDefaultImplementation import com.tangem.tap.domain.walletconnect.WalletConnectRepository diff --git a/app/src/main/java/com/tangem/tap/common/analytics/topup/TopUpController.kt b/app/src/main/java/com/tangem/tap/common/analytics/topup/TopUpController.kt index 97edaae4c1..bdd315bc3d 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/topup/TopUpController.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/topup/TopUpController.kt @@ -5,19 +5,19 @@ import com.tangem.common.extensions.isZero import com.tangem.core.analytics.Analytics import com.tangem.data.source.preferences.model.DataSourceTopupInfo import com.tangem.data.source.preferences.storage.ToppedUpWalletStorage +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.CardTypesResolver -import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.analytics.converters.TopUpEventConverter import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.extensions.copy import com.tangem.tap.domain.model.TotalFiatBalance -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.builders.UserWalletIdBuilder -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.features.wallet.models.Currency diff --git a/app/src/main/java/com/tangem/tap/common/extensions/Store.kt b/app/src/main/java/com/tangem/tap/common/extensions/Store.kt index 8b5eafb76f..08bfdbd3f3 100644 --- a/app/src/main/java/com/tangem/tap/common/extensions/Store.kt +++ b/app/src/main/java/com/tangem/tap/common/extensions/Store.kt @@ -1,12 +1,12 @@ package com.tangem.tap.common.extensions import com.tangem.domain.common.extensions.withMainContext +import com.tangem.domain.wallets.models.UserWallet import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.StateDialog import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.TapError -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.scope import com.tangem.tap.store import kotlinx.coroutines.Dispatchers diff --git a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt index d599f9c378..2d75cf1723 100644 --- a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt +++ b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt @@ -7,19 +7,15 @@ import com.tangem.common.core.TangemError import com.tangem.datasource.config.ConfigManager import com.tangem.datasource.config.models.ChatConfig import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.tap.common.analytics.topup.TopUpController import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.feedback.FeedbackData import com.tangem.tap.common.feedback.FeedbackManager -import com.tangem.tap.common.redux.DebugErrorAction -import com.tangem.tap.common.redux.ErrorAction -import com.tangem.tap.common.redux.NotificationAction -import com.tangem.tap.common.redux.StateDialog -import com.tangem.tap.common.redux.ToastNotificationAction +import com.tangem.tap.common.redux.* import com.tangem.tap.domain.TapError import com.tangem.tap.domain.configurable.warningMessage.WarningMessage import com.tangem.tap.domain.configurable.warningMessage.WarningMessagesManager -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.features.details.redux.SecurityOption import org.rekotlin.Action diff --git a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt index 91c1ae14b7..1e5a3cfce0 100644 --- a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt +++ b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt @@ -2,13 +2,13 @@ package com.tangem.tap.common.redux.global import com.tangem.datasource.config.ConfigManager import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.tap.common.analytics.topup.TopUpController import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.feedback.FeedbackManager import com.tangem.tap.common.redux.StateDialog import com.tangem.tap.domain.TapWalletManager import com.tangem.tap.domain.configurable.warningMessage.WarningMessagesManager -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.features.onboarding.OnboardingManager import com.tangem.tap.network.exchangeServices.CurrencyExchangeManager import org.rekotlin.StateType 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 4e39b73bbe..23ee5bb963 100644 --- a/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/TapWalletManager.kt @@ -11,6 +11,7 @@ import com.tangem.datasource.config.ConfigManager import com.tangem.domain.common.extensions.withMainContext import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.models.UserWallet import com.tangem.operations.attestation.Attestation import com.tangem.tap.* import com.tangem.tap.common.analytics.events.Basic @@ -18,7 +19,6 @@ import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.common.extensions.dispatchWithMain import com.tangem.tap.common.extensions.setContext import com.tangem.tap.common.redux.global.GlobalAction -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.walletStores.WalletStoresError import com.tangem.tap.features.details.redux.walletconnect.WalletConnectAction import com.tangem.tap.features.disclaimer.createDisclaimer diff --git a/app/src/main/java/com/tangem/tap/domain/extensions/WalletManagerFactory.kt b/app/src/main/java/com/tangem/tap/domain/extensions/WalletManagerFactory.kt index a9de7cb47a..c622163be0 100644 --- a/app/src/main/java/com/tangem/tap/domain/extensions/WalletManagerFactory.kt +++ b/app/src/main/java/com/tangem/tap/domain/extensions/WalletManagerFactory.kt @@ -1,20 +1,16 @@ package com.tangem.tap.domain.extensions -import com.tangem.blockchain.common.Blockchain -import com.tangem.blockchain.common.DerivationParams -import com.tangem.blockchain.common.DerivationStyle -import com.tangem.blockchain.common.WalletManager -import com.tangem.blockchain.common.WalletManagerFactory +import com.tangem.blockchain.common.* import com.tangem.common.card.EllipticCurve import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.toMapKey import com.tangem.crypto.hdWallet.DerivationPath +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.TapWorkarounds.isTestCard import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.wallet.models.Currency fun WalletManagerFactory.makeWalletManagerForApp( diff --git a/app/src/main/java/com/tangem/tap/domain/model/WalletStoreModel.kt b/app/src/main/java/com/tangem/tap/domain/model/WalletStoreModel.kt index 2dad9e1303..99282954dc 100644 --- a/app/src/main/java/com/tangem/tap/domain/model/WalletStoreModel.kt +++ b/app/src/main/java/com/tangem/tap/domain/model/WalletStoreModel.kt @@ -3,9 +3,9 @@ package com.tangem.tap.domain.model import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.WalletManager import com.tangem.crypto.hdWallet.DerivationPath -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.common.BlockchainNetwork +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.WalletStoreModel.WalletRent -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.wallet.models.Currency import java.math.BigDecimal diff --git a/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletBuilder.kt b/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletBuilder.kt index d4e6cbd1fc..7fa72a04fa 100644 --- a/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletBuilder.kt +++ b/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletBuilder.kt @@ -1,11 +1,11 @@ package com.tangem.tap.domain.model.builders +import com.tangem.domain.common.TapWorkarounds.isStart2Coin +import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ProductType import com.tangem.domain.models.scan.ScanResponse -import com.tangem.domain.common.TapWorkarounds.isStart2Coin -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet import com.tangem.tap.domain.userWalletList.GetCardImageUseCase class UserWalletBuilder( diff --git a/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletIdBuilder.kt b/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletIdBuilder.kt index 64f5f8156d..30b4ef4407 100644 --- a/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletIdBuilder.kt +++ b/app/src/main/java/com/tangem/tap/domain/model/builders/UserWalletIdBuilder.kt @@ -3,12 +3,12 @@ package com.tangem.tap.domain.model.builders import com.tangem.common.extensions.calculateSha256 import com.tangem.common.extensions.hexToBytes import com.tangem.crypto.Secp256k1 +import com.tangem.domain.common.TapWorkarounds.isTangemTwins +import com.tangem.domain.common.extensions.calculateHmacSha256 import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ProductType import com.tangem.domain.models.scan.ScanResponse -import com.tangem.domain.common.TapWorkarounds.isTangemTwins -import com.tangem.domain.common.extensions.calculateHmacSha256 -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId class UserWalletIdBuilder private constructor( private val publicKey: ByteArray?, diff --git a/app/src/main/java/com/tangem/tap/domain/model/builders/WalletStoreBuilder.kt b/app/src/main/java/com/tangem/tap/domain/model/builders/WalletStoreBuilder.kt index e7d01ecdb6..81532e5bb9 100644 --- a/app/src/main/java/com/tangem/tap/domain/model/builders/WalletStoreBuilder.kt +++ b/app/src/main/java/com/tangem/tap/domain/model/builders/WalletStoreBuilder.kt @@ -1,18 +1,14 @@ package com.tangem.tap.domain.model.builders import com.tangem.blockchain.blockchains.polkadot.ExistentialDepositProvider -import com.tangem.blockchain.common.Blockchain -import com.tangem.blockchain.common.DerivationStyle -import com.tangem.blockchain.common.Token -import com.tangem.blockchain.common.Wallet -import com.tangem.blockchain.common.WalletManager +import com.tangem.blockchain.common.* import com.tangem.crypto.hdWallet.DerivationPath +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletStoreModel -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.redux.reducers.createAddressesData import java.math.BigDecimal diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt index 69a78dfb46..663e931472 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt @@ -8,16 +8,12 @@ import com.tangem.common.core.CardSessionRunnable import com.tangem.common.core.TangemError import com.tangem.common.core.TangemSdkError import com.tangem.common.deserialization.WalletDataDeserializer -import com.tangem.common.extensions.ByteArrayKey -import com.tangem.common.extensions.guard -import com.tangem.common.extensions.hexToBytes -import com.tangem.common.extensions.toByteArray -import com.tangem.common.extensions.toHexString -import com.tangem.common.extensions.toMapKey +import com.tangem.common.extensions.* import com.tangem.common.tlv.Tlv import com.tangem.common.tlv.TlvDecoder import com.tangem.crypto.CryptoUtils import com.tangem.crypto.hdWallet.DerivationPath +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.TapWorkarounds.isExcluded import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease import com.tangem.domain.common.TapWorkarounds.isStart2Coin @@ -36,10 +32,10 @@ import com.tangem.operations.issuerAndUserData.ReadIssuerDataCommand import com.tangem.tap.domain.TapSdkError import com.tangem.tap.domain.extensions.getPrimaryCurve import com.tangem.tap.domain.tokens.UserTokensRepository -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.preferencesStorage import com.tangem.tap.scope import kotlinx.coroutines.launch +import kotlin.collections.set class ScanProductTask( val card: Card? = null, diff --git a/app/src/main/java/com/tangem/tap/domain/tokens/UserTokensRepository.kt b/app/src/main/java/com/tangem/tap/domain/tokens/UserTokensRepository.kt index ff7517ff1a..c4c01684bf 100644 --- a/app/src/main/java/com/tangem/tap/domain/tokens/UserTokensRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/tokens/UserTokensRepository.kt @@ -8,10 +8,10 @@ import com.tangem.datasource.api.tangemTech.TangemTechService import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.connection.NetworkConnectionManager import com.tangem.datasource.files.AndroidFileReader +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.models.scan.CardDTO import com.tangem.tap.domain.model.builders.UserWalletIdBuilder import com.tangem.tap.domain.tokens.converters.CurrencyConverter -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.demo.DemoHelper import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.toBlockchainNetworks diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/UserWalletsListManagerExtensions.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/UserWalletsListManagerExtensions.kt index b795c7df78..8086bded7c 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/UserWalletsListManagerExtensions.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/UserWalletsListManagerExtensions.kt @@ -1,7 +1,8 @@ package com.tangem.tap.domain.userWalletList import com.tangem.common.CompletionResult -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.legacy.UserWalletsListManager +import com.tangem.domain.wallets.models.UserWallet import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/di/UserWalletsListManagerProvider.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/di/UserWalletsListManagerProvider.kt index 71255de6a0..5f02cd1258 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/di/UserWalletsListManagerProvider.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/di/UserWalletsListManagerProvider.kt @@ -5,22 +5,17 @@ import com.squareup.moshi.Moshi import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.tangem.common.json.TangemSdkAdapter import com.tangem.common.services.secure.SecureStorage +import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.sdk.storage.AndroidSecureStorage import com.tangem.sdk.storage.createEncryptedSharedPreferences import com.tangem.tap.domain.TangemSdkManager -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.domain.userWalletList.implementation.BiometricUserWalletsListManager import com.tangem.tap.domain.userWalletList.implementation.RuntimeUserWalletsListManager import com.tangem.tap.domain.userWalletList.repository.implementation.BiometricUserWalletsKeysRepository import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultSelectedUserWalletRepository import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultUserWalletsPublicInformationRepository import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultUserWalletsSensitiveInformationRepository -import com.tangem.tap.domain.userWalletList.utils.json.ByteArrayKeyAdapter -import com.tangem.tap.domain.userWalletList.utils.json.CardBackupStatusAdapter -import com.tangem.tap.domain.userWalletList.utils.json.DerivationPathAdapterWithMigration -import com.tangem.tap.domain.userWalletList.utils.json.ExtendedPublicKeysMapAdapter -import com.tangem.tap.domain.userWalletList.utils.json.ScanResponseDerivedKeysMapAdapter -import com.tangem.tap.domain.userWalletList.utils.json.WalletDerivedKeysMapAdapter +import com.tangem.tap.domain.userWalletList.utils.json.* private const val USER_WALLETS_STORAGE_NAME = "user_wallets_storage" diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt index 568d16fc28..18ec89cb9c 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt @@ -2,10 +2,10 @@ package com.tangem.tap.domain.userWalletList.implementation import com.tangem.common.* import com.tangem.common.extensions.guard -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.legacy.UserWalletsListManager +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.UserWalletsListError -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.repository.SelectedUserWalletRepository import com.tangem.tap.domain.userWalletList.repository.UserWalletsKeysRepository diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt index cfcd68bc57..d1cd26b6ff 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt @@ -2,10 +2,10 @@ package com.tangem.tap.domain.userWalletList.implementation import com.tangem.common.CompletionResult import com.tangem.common.catching -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.legacy.UserWalletsListManager +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.UserWalletsListError -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.* diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletEncryptionKey.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletEncryptionKey.kt index df0f473bae..d17ee7c4a3 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletEncryptionKey.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletEncryptionKey.kt @@ -1,7 +1,7 @@ package com.tangem.tap.domain.userWalletList.model import com.squareup.moshi.JsonClass -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId @JsonClass(generateAdapter = true) internal data class UserWalletEncryptionKey( diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt index d81f8ebafc..fe064832d6 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt @@ -3,7 +3,7 @@ package com.tangem.tap.domain.userWalletList.model import com.squareup.moshi.JsonClass import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId @JsonClass(generateAdapter = true) internal data class UserWalletSensitiveInformation( diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/SelectedUserWalletRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/SelectedUserWalletRepository.kt index aee7766d49..61c2a2eec4 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/SelectedUserWalletRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/SelectedUserWalletRepository.kt @@ -1,6 +1,6 @@ package com.tangem.tap.domain.userWalletList.repository -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId internal interface SelectedUserWalletRepository { fun get(): UserWalletId? diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsKeysRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsKeysRepository.kt index 99b62dc99d..08c509a16c 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsKeysRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsKeysRepository.kt @@ -1,7 +1,7 @@ package com.tangem.tap.domain.userWalletList.repository import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey internal interface UserWalletsKeysRepository { diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsPublicInformationRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsPublicInformationRepository.kt index 8765a6b804..6b40cf721e 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsPublicInformationRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsPublicInformationRepository.kt @@ -1,8 +1,8 @@ package com.tangem.tap.domain.userWalletList.repository import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation internal interface UserWalletsPublicInformationRepository { diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsSensitiveInformationRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsSensitiveInformationRepository.kt index fdae3e64a0..15d9abbee4 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsSensitiveInformationRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletsSensitiveInformationRepository.kt @@ -1,8 +1,8 @@ package com.tangem.tap.domain.userWalletList.repository import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt index affeeeef57..b8c9ce2bc5 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt @@ -3,17 +3,12 @@ package com.tangem.tap.domain.userWalletList.repository.implementation import com.squareup.moshi.JsonAdapter import com.squareup.moshi.Moshi import com.squareup.moshi.Types -import com.tangem.common.CompletionResult +import com.tangem.common.* import com.tangem.common.biometric.BiometricManager import com.tangem.common.biometric.BiometricStorage import com.tangem.common.core.TangemSdkError -import com.tangem.common.doOnFailure -import com.tangem.common.flatMapOnFailure -import com.tangem.common.fold -import com.tangem.common.map -import com.tangem.common.mapFailure import com.tangem.common.services.secure.SecureStorage -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.UserWalletsListError import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.repository.UserWalletsKeysRepository diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultSelectedUserWalletRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultSelectedUserWalletRepository.kt index 6efa84fc70..e30816c98c 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultSelectedUserWalletRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultSelectedUserWalletRepository.kt @@ -1,7 +1,7 @@ package com.tangem.tap.domain.userWalletList.repository.implementation import com.tangem.common.services.secure.SecureStorage -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.repository.SelectedUserWalletRepository internal class DefaultSelectedUserWalletRepository( diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt index ab64d4a5fb..cadd73b606 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt @@ -7,9 +7,9 @@ import com.tangem.common.CompletionResult import com.tangem.common.catching import com.tangem.common.flatMap import com.tangem.common.services.secure.SecureStorage -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.extensions.replaceByOrAdd -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation import com.tangem.tap.domain.userWalletList.repository.UserWalletsPublicInformationRepository import com.tangem.tap.domain.userWalletList.utils.publicInformation diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt index 631d8d13c6..8c67c90889 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt @@ -7,9 +7,9 @@ import com.squareup.moshi.Types import com.tangem.common.CompletionResult import com.tangem.common.catching import com.tangem.common.services.secure.SecureStorage -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.extensions.filterNotNull -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation import com.tangem.tap.domain.userWalletList.repository.UserWalletsSensitiveInformationRepository diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt index 4c7784a50a..4116cde096 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt @@ -1,7 +1,7 @@ package com.tangem.tap.domain.userWalletList.utils -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation diff --git a/app/src/main/java/com/tangem/tap/domain/walletCurrencies/WalletCurrenciesManager.kt b/app/src/main/java/com/tangem/tap/domain/walletCurrencies/WalletCurrenciesManager.kt index f56949a1be..413550b22e 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletCurrencies/WalletCurrenciesManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletCurrencies/WalletCurrenciesManager.kt @@ -1,7 +1,7 @@ package com.tangem.tap.domain.walletCurrencies import com.tangem.common.CompletionResult -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet import com.tangem.tap.features.wallet.models.Currency interface WalletCurrenciesManager { diff --git a/app/src/main/java/com/tangem/tap/domain/walletCurrencies/di/WalletCurrenciesManagerProvider.kt b/app/src/main/java/com/tangem/tap/domain/walletCurrencies/di/WalletCurrenciesManagerProvider.kt index 0c6bfccf02..bf2d47611e 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletCurrencies/di/WalletCurrenciesManagerProvider.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletCurrencies/di/WalletCurrenciesManagerProvider.kt @@ -1,11 +1,11 @@ package com.tangem.tap.domain.walletCurrencies.di +import com.tangem.domain.wallets.legacy.WalletManagersRepository import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager import com.tangem.tap.domain.walletCurrencies.implementation.DefaultWalletCurrenciesManager import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository -import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository fun WalletCurrenciesManager.Companion.provideDefaultImplementation( diff --git a/app/src/main/java/com/tangem/tap/domain/walletCurrencies/implementation/DefaultWalletCurrenciesManager.kt b/app/src/main/java/com/tangem/tap/domain/walletCurrencies/implementation/DefaultWalletCurrenciesManager.kt index 0bbd76b7bc..07e8b8ccf6 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletCurrencies/implementation/DefaultWalletCurrenciesManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletCurrencies/implementation/DefaultWalletCurrenciesManager.kt @@ -2,17 +2,17 @@ package com.tangem.tap.domain.walletCurrencies.implementation import com.tangem.blockchain.common.DerivationStyle import com.tangem.common.* +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.TapWorkarounds.derivationStyle -import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.models.scan.CardDTO +import com.tangem.domain.wallets.legacy.WalletManagersRepository +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.entities.FiatCurrency -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.builders.WalletStoreBuilder import com.tangem.tap.domain.tokens.UserTokensRepository -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository -import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.toBlockchainNetworks diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/WalletStoresManager.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/WalletStoresManager.kt index 867e75e174..10d89c17eb 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/WalletStoresManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/WalletStoresManager.kt @@ -2,8 +2,8 @@ package com.tangem.tap.domain.walletStores import com.tangem.blockchain.common.address.AddressType import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.features.wallet.models.Currency import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/di/WalletsStoresManagerProvider.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/di/WalletsStoresManagerProvider.kt index d2a4789fb0..d913969cac 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/di/WalletsStoresManagerProvider.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/di/WalletsStoresManagerProvider.kt @@ -1,12 +1,12 @@ package com.tangem.tap.domain.walletStores.di -import com.tangem.tap.domain.walletStores.WalletStoresManager -import com.tangem.tap.domain.walletStores.implementation.DummyWalletStoresManager +import com.tangem.domain.wallets.legacy.WalletManagersRepository import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.domain.tokens.UserTokensRepository +import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.implementation.DefaultWalletStoresManager +import com.tangem.tap.domain.walletStores.implementation.DummyWalletStoresManager import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository -import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository fun WalletStoresManager.Companion.provideDummyImplementation(): WalletStoresManager { diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DefaultWalletStoresManager.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DefaultWalletStoresManager.kt index 6081a25788..f2af46b082 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DefaultWalletStoresManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DefaultWalletStoresManager.kt @@ -2,22 +2,17 @@ package com.tangem.tap.domain.walletStores.implementation import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.address.AddressType -import com.tangem.common.CompletionResult -import com.tangem.common.doOnSuccess -import com.tangem.common.flatMap -import com.tangem.common.flatMapOnFailure -import com.tangem.common.fold -import com.tangem.common.map -import com.tangem.domain.common.util.UserWalletId +import com.tangem.common.* +import com.tangem.domain.wallets.legacy.WalletManagersRepository +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.entities.FiatCurrency -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.builders.WalletStoreBuilder import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.walletStores.WalletStoresError import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository -import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.implementation.utils.updateSelectedAddress import com.tangem.tap.features.wallet.models.Currency diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DummyWalletStoresManager.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DummyWalletStoresManager.kt index 98fa34d296..9b6ab8abbb 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DummyWalletStoresManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/implementation/DummyWalletStoresManager.kt @@ -2,8 +2,8 @@ package com.tangem.tap.domain.walletStores.implementation import com.tangem.blockchain.common.address.AddressType import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.features.wallet.models.Currency diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletAmountsRepository.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletAmountsRepository.kt index 924bbb5191..c25635dd50 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletAmountsRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletAmountsRepository.kt @@ -1,8 +1,8 @@ package com.tangem.tap.domain.walletStores.repository import com.tangem.common.CompletionResult +import com.tangem.domain.wallets.models.UserWallet import com.tangem.tap.common.entities.FiatCurrency -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.WalletStoreModel interface WalletAmountsRepository { diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletStoresRepository.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletStoresRepository.kt index ad80694e1e..6007fcb2c3 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletStoresRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletStoresRepository.kt @@ -1,7 +1,7 @@ package com.tangem.tap.domain.walletStores.repository import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.features.wallet.models.Currency import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/di/RepositoryProvider.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/di/RepositoryProvider.kt index d89d4ea6aa..769a1e0219 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/di/RepositoryProvider.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/di/RepositoryProvider.kt @@ -2,8 +2,8 @@ package com.tangem.tap.domain.walletStores.repository.di import com.tangem.blockchain.common.WalletManagerFactory import com.tangem.datasource.api.tangemTech.TangemTechService +import com.tangem.domain.wallets.legacy.WalletManagersRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository -import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.implementation.DefaultWalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.implementation.DefaultWalletManagersRepository diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletAmountsRepository.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletAmountsRepository.kt index 22dd64bff1..b89be4b97f 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletAmountsRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletAmountsRepository.kt @@ -10,13 +10,13 @@ import com.tangem.blockchain.extensions.Result.Success import com.tangem.common.* import com.tangem.common.core.TangemError import com.tangem.datasource.api.tangemTech.TangemTechApi -import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.common.util.hasDerivation import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.TestActions import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.extensions.replaceByOrAdd -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.walletStores.WalletStoresError import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository @@ -169,7 +169,7 @@ internal class DefaultWalletAmountsRepository( walletStores.map { walletStore -> async { - // TODO: Find wallet manager via [com.tangem.tap.domain.walletStores.repository.WalletManagersRepository] + // TODO: Find wallet manager via [com.tangem.domain.wallets.legacy.WalletManagersRepository] val walletManager = walletStore.walletManager fetchAmountsForWalletStore(userWalletId, scanResponse, walletStore, walletManager) } diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletManagersRepository.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletManagersRepository.kt index b2d8167a7e..7a51a18e10 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletManagersRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletManagersRepository.kt @@ -1,27 +1,22 @@ package com.tangem.tap.domain.walletStores.repository.implementation -import com.tangem.blockchain.common.Amount -import com.tangem.blockchain.common.Blockchain -import com.tangem.blockchain.common.DerivationParams -import com.tangem.blockchain.common.DerivationStyle -import com.tangem.blockchain.common.WalletManager -import com.tangem.blockchain.common.WalletManagerFactory +import com.tangem.blockchain.common.* import com.tangem.common.CompletionResult import com.tangem.common.catching import com.tangem.common.doOnSuccess import com.tangem.common.mapFailure import com.tangem.crypto.hdWallet.DerivationPath +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.TapWorkarounds.isTestCard import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.legacy.WalletManagersRepository +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.extensions.makeWalletManagerForApp -import com.tangem.tap.domain.model.UserWallet -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.domain.walletStores.WalletStoresError -import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository import com.tangem.tap.domain.walletStores.storage.WalletManagerStorage import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.firstOrNull diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletStoresRepository.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletStoresRepository.kt index 89997208ba..fb78960bb1 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletStoresRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/DefaultWalletStoresRepository.kt @@ -2,7 +2,7 @@ package com.tangem.tap.domain.walletStores.repository.implementation import com.tangem.common.CompletionResult import com.tangem.common.catching -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.implementation.utils.isSameWalletStore diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletStoreOperations.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletStoreOperations.kt index 069f77fe4b..bc6c07563d 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletStoreOperations.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletStoreOperations.kt @@ -3,7 +3,7 @@ package com.tangem.tap.domain.walletStores.repository.implementation.utils import com.tangem.blockchain.common.Wallet import com.tangem.blockchain.common.address.AddressType import com.tangem.common.core.TangemError -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.features.wallet.models.Currency import timber.log.Timber diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletManagerStorage.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletManagerStorage.kt index 866711e543..3d492d01da 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletManagerStorage.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletManagerStorage.kt @@ -1,7 +1,7 @@ package com.tangem.tap.domain.walletStores.storage import com.tangem.blockchain.common.WalletManager -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharedFlow diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletStoresStorage.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletStoresStorage.kt index 932abce88b..883783db86 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletStoresStorage.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/storage/WalletStoresStorage.kt @@ -1,6 +1,6 @@ package com.tangem.tap.domain.walletStores.storage -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.WalletStoreModel import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableSharedFlow diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectSdkHelper.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectSdkHelper.kt index dc3169c18c..134a915fbd 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectSdkHelper.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect/WalletConnectSdkHelper.kt @@ -16,6 +16,7 @@ import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.toDecompressedPublicKey import com.tangem.common.extensions.toHexString import com.tangem.core.analytics.Analytics +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.operations.sign.SignHashCommand import com.tangem.tap.common.analytics.events.AnalyticsParam @@ -24,7 +25,6 @@ import com.tangem.tap.common.analytics.events.Basic.TransactionSent.MemoType import com.tangem.tap.common.analytics.events.WalletConnect import com.tangem.tap.common.extensions.safeUpdate import com.tangem.tap.common.extensions.toFormattedString -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.domain.walletconnect.BnbHelper.toWCBinanceTradeOrder import com.tangem.tap.domain.walletconnect.BnbHelper.toWCBinanceTransferOrder import com.tangem.tap.domain.walletconnect2.domain.WcEthereumSignMessage diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt index acc0130ea9..2aad9e3c8a 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt @@ -10,6 +10,7 @@ import com.tangem.core.analytics.Analytics import com.tangem.domain.common.TapWorkarounds.isTangemTwins import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.tap.* import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.Settings @@ -25,7 +26,6 @@ import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.model.builders.UserWalletBuilder import com.tangem.tap.domain.model.builders.UserWalletIdBuilder import com.tangem.tap.domain.scanCard.ScanCardProcessor -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation import com.tangem.tap.domain.userWalletList.di.provideRuntimeImplementation import com.tangem.tap.domain.userWalletList.isLockedSync @@ -33,13 +33,7 @@ import com.tangem.tap.features.demo.DemoHelper import com.tangem.tap.features.onboarding.products.twins.redux.CreateTwinWalletMode import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsAction import com.tangem.tap.features.wallet.redux.WalletAction -import com.tangem.tap.foregroundActivityObserver -import com.tangem.tap.preferencesStorage -import com.tangem.tap.scope -import com.tangem.tap.store import com.tangem.tap.tangemSdkManager -import com.tangem.tap.userWalletsListManager -import com.tangem.tap.walletStoresManager import com.tangem.wallet.R import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay 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 b69de63a66..400735bc8f 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 @@ -4,6 +4,7 @@ import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.DerivationStyle import com.tangem.blockchain.common.WalletManager import com.tangem.common.extensions.guard +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.toNetworkId @@ -16,7 +17,6 @@ import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.NavigationAction -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.domain.walletconnect.BnbHelper import com.tangem.tap.domain.walletconnect.WalletConnectManager import com.tangem.tap.domain.walletconnect.WalletConnectNetworkUtils diff --git a/app/src/main/java/com/tangem/tap/features/onboarding/products/otherCards/redux/OnboardingOtherCardsMiddleware.kt b/app/src/main/java/com/tangem/tap/features/onboarding/products/otherCards/redux/OnboardingOtherCardsMiddleware.kt index ba7983eaa5..00a9d94af5 100644 --- a/app/src/main/java/com/tangem/tap/features/onboarding/products/otherCards/redux/OnboardingOtherCardsMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/onboarding/products/otherCards/redux/OnboardingOtherCardsMiddleware.kt @@ -3,20 +3,16 @@ package com.tangem.tap.features.onboarding.products.otherCards.redux import com.tangem.blockchain.common.Blockchain import com.tangem.common.CompletionResult import com.tangem.core.analytics.Analytics -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.extensions.withMainContext -import com.tangem.tap.DELAY_SDK_DIALOG_CLOSE +import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.tap.* import com.tangem.tap.common.analytics.events.Onboarding import com.tangem.tap.common.postUi import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.global.GlobalAction -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.onboarding.OnboardingHelper import com.tangem.tap.features.wallet.models.toCurrencies -import com.tangem.tap.scope -import com.tangem.tap.store -import com.tangem.tap.tangemSdkManager -import com.tangem.tap.userTokensRepository import kotlinx.coroutines.delay import kotlinx.coroutines.launch import org.rekotlin.Action diff --git a/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/redux/OnboardingWalletMiddleware.kt b/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/redux/OnboardingWalletMiddleware.kt index 2f4be5416d..d80e71ab99 100644 --- a/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/redux/OnboardingWalletMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/redux/OnboardingWalletMiddleware.kt @@ -6,6 +6,7 @@ import com.tangem.common.CompletionResult import com.tangem.common.core.TangemSdkError import com.tangem.common.extensions.ifNotNull import com.tangem.core.analytics.Analytics +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.extensions.withMainContext import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.models.scan.CardDTO @@ -23,7 +24,6 @@ import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.tasks.product.CreateProductWalletTaskResponse -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.demo.DemoHelper import com.tangem.tap.features.home.redux.HomeAction import com.tangem.tap.features.onboarding.OnboardingDialog diff --git a/app/src/main/java/com/tangem/tap/features/saveWallet/redux/SaveWalletMiddleware.kt b/app/src/main/java/com/tangem/tap/features/saveWallet/redux/SaveWalletMiddleware.kt index ec2223b2bd..953dbfaa6c 100644 --- a/app/src/main/java/com/tangem/tap/features/saveWallet/redux/SaveWalletMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/saveWallet/redux/SaveWalletMiddleware.kt @@ -7,6 +7,8 @@ import com.tangem.common.doOnSuccess import com.tangem.common.extensions.guard import com.tangem.common.flatMap import com.tangem.core.analytics.Analytics +import com.tangem.domain.wallets.legacy.UserWalletsListManager +import com.tangem.tap.* import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.MainScreen import com.tangem.tap.common.analytics.events.Onboarding @@ -17,16 +19,9 @@ import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.model.builders.UserWalletBuilder -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation import com.tangem.tap.domain.userWalletList.isLockable import com.tangem.tap.features.wallet.redux.WalletAction -import com.tangem.tap.foregroundActivityObserver -import com.tangem.tap.preferencesStorage -import com.tangem.tap.scope -import com.tangem.tap.store -import com.tangem.tap.tangemSdkManager -import com.tangem.tap.userWalletsListManager import kotlinx.coroutines.launch import org.rekotlin.Middleware import timber.log.Timber diff --git a/app/src/main/java/com/tangem/tap/features/wallet/models/Currency.kt b/app/src/main/java/com/tangem/tap/features/wallet/models/Currency.kt index 71cef96432..4b82889e22 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/models/Currency.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/models/Currency.kt @@ -2,11 +2,11 @@ package com.tangem.tap.features.wallet.models import com.tangem.blockchain.common.DerivationStyle import com.tangem.datasource.api.tangemTech.models.UserTokensResponse +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.toCoinId import com.tangem.domain.features.addCustomToken.CustomCurrency import com.tangem.tap.common.redux.global.CryptoCurrencyName -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.blockchain.common.Blockchain as SdkBlockchain import com.tangem.blockchain.common.Token as SdkToken diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt index 8db98a4ee0..3f73a94c11 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt @@ -4,17 +4,17 @@ import android.content.Context import com.tangem.blockchain.common.Amount import com.tangem.blockchain.common.address.AddressType import com.tangem.core.analytics.AnalyticsEvent -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.models.scan.CardDTO +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.redux.NotificationAction import com.tangem.tap.domain.TapError import com.tangem.tap.domain.configurable.warningMessage.WarningMessage import com.tangem.tap.domain.model.TotalFiatBalance -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletStoreModel -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.redux.models.WalletDialog import com.tangem.wallet.R diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletState.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletState.kt index 9c1feed6b4..2135a4ab7d 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletState.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletState.kt @@ -4,6 +4,7 @@ import android.graphics.Bitmap import com.tangem.blockchain.common.AmountType import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.WalletManager +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.util.cardTypesResolver import com.tangem.tap.common.entities.Button import com.tangem.tap.common.redux.global.CryptoCurrencyName @@ -12,7 +13,6 @@ import com.tangem.tap.domain.configurable.warningMessage.WarningMessage import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletStoreModel -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsState import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.store 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 d86a41c389..b0e0356891 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 @@ -4,6 +4,7 @@ import com.tangem.common.doOnSuccess import com.tangem.common.extensions.guard import com.tangem.common.flatMap import com.tangem.core.analytics.Analytics +import com.tangem.domain.wallets.models.UserWallet import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.Token.ButtonRemoveToken import com.tangem.tap.common.extensions.addContext @@ -14,7 +15,6 @@ import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.TapError -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.scanCard.ScanCardProcessor import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletState diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletViewModel.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletViewModel.kt index 95f80ebca8..b94cc9de26 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletViewModel.kt @@ -6,12 +6,12 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.tap.common.analytics.converters.ParamCardCurrencyConverter import com.tangem.tap.common.analytics.events.Basic import com.tangem.tap.common.analytics.events.MainScreen import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.domain.model.TotalFiatBalance -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.ui.analytics.WalletAnalyticsEventsMapper import com.tangem.tap.store diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/test/TestWallet.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/test/TestWallet.kt index 5b3dab3e8b..188cf35d91 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/test/TestWallet.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/test/TestWallet.kt @@ -5,10 +5,10 @@ import com.tangem.blockchain.common.AmountType import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.WalletManager import com.tangem.common.extensions.guard +import com.tangem.domain.common.BlockchainNetwork import com.tangem.tap.common.TestAction import com.tangem.tap.common.TestActions import com.tangem.tap.common.extensions.dispatchDebugErrorNotification -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.store import java.math.BigDecimal diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/UserWalletModel.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/UserWalletModel.kt index b381b423c3..d1300ffa43 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/UserWalletModel.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/UserWalletModel.kt @@ -1,6 +1,6 @@ package com.tangem.tap.features.walletSelector.redux -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.domain.model.TotalFiatBalance data class UserWalletModel( diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorAction.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorAction.kt index e997860d4e..9acb28b1d6 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorAction.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorAction.kt @@ -1,9 +1,9 @@ package com.tangem.tap.features.walletSelector.redux import com.tangem.common.core.TangemError -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.entities.FiatCurrency -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.WalletStoreModel import org.rekotlin.Action diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorMiddleware.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorMiddleware.kt index 3528a61c7a..61b8a2566c 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorMiddleware.kt @@ -3,8 +3,9 @@ package com.tangem.tap.features.walletSelector.redux import com.tangem.common.* import com.tangem.common.core.TangemSdkError import com.tangem.core.analytics.Analytics -import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.* import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.Basic @@ -16,7 +17,6 @@ import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.model.TotalFiatBalance -import com.tangem.tap.domain.model.UserWallet import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.builders.UserWalletBuilder import com.tangem.tap.domain.model.builders.UserWalletIdBuilder diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorReducer.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorReducer.kt index 2a8ace7ad3..13daba6567 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorReducer.kt @@ -2,9 +2,9 @@ package com.tangem.tap.features.walletSelector.redux import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.models.scan.CardDTO +import com.tangem.domain.wallets.models.UserWallet import com.tangem.tap.common.redux.AppState import com.tangem.tap.domain.model.TotalFiatBalance -import com.tangem.tap.domain.model.UserWallet import org.rekotlin.Action internal object WalletSelectorReducer { diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorState.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorState.kt index 797cc04593..49e1f753a3 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorState.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/redux/WalletSelectorState.kt @@ -1,7 +1,7 @@ package com.tangem.tap.features.walletSelector.redux import com.tangem.common.core.TangemError -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.entities.FiatCurrency import org.rekotlin.StateType diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorScreenState.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorScreenState.kt index b2da2e5b5f..796c2eac3f 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorScreenState.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorScreenState.kt @@ -1,7 +1,7 @@ package com.tangem.tap.features.walletSelector.ui import androidx.compose.runtime.Immutable -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.features.details.ui.cardsettings.TextReference import com.tangem.tap.features.walletSelector.ui.model.DialogModel import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt index c6339f9cd8..6fb9347118 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.tangem.common.core.TangemError import com.tangem.core.analytics.Analytics -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.analytics.events.MyWallets import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.domain.userWalletList.UserWalletsListError diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/MockData.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/MockData.kt index c404c8890a..0099f47c84 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/MockData.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/MockData.kt @@ -1,6 +1,6 @@ package com.tangem.tap.features.walletSelector.ui.components -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.features.walletSelector.ui.WalletSelectorScreenState import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.SingleCurrencyUserWalletItem diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WallectSelectorScreenContent.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WallectSelectorScreenContent.kt index f0dd6b139b..472a4322ec 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WallectSelectorScreenContent.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WallectSelectorScreenContent.kt @@ -25,7 +25,7 @@ import com.tangem.core.ui.components.SecondaryButtonIconEnd import com.tangem.core.ui.components.SpacerWMax import com.tangem.core.ui.components.atoms.Hand import com.tangem.core.ui.res.TangemTheme -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.features.walletSelector.ui.WalletSelectorScreenState import com.tangem.wallet.R diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt index 03d505e048..305cfa6545 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt @@ -4,16 +4,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.heightIn -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.Divider import androidx.compose.material.Icon @@ -39,7 +30,7 @@ import com.tangem.core.ui.components.SpacerH2 import com.tangem.core.ui.components.SpacerW6 import com.tangem.core.ui.components.SpacerW8 import com.tangem.core.ui.res.TangemTheme -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.common.extensions.cardImageData import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.SingleCurrencyUserWalletItem diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/model/UserWalletItem.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/model/UserWalletItem.kt index 7013362085..e5e3033115 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/model/UserWalletItem.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/model/UserWalletItem.kt @@ -1,6 +1,6 @@ package com.tangem.tap.features.walletSelector.ui.model -import com.tangem.domain.common.util.UserWalletId +import com.tangem.domain.wallets.models.UserWalletId import com.tangem.tap.features.wallet.redux.utils.UNKNOWN_AMOUNT_SIGN internal sealed interface UserWalletItem { diff --git a/app/src/main/java/com/tangem/tap/proxy/AppStateHolder.kt b/app/src/main/java/com/tangem/tap/proxy/AppStateHolder.kt index 35c2d83718..0235d9d10e 100644 --- a/app/src/main/java/com/tangem/tap/proxy/AppStateHolder.kt +++ b/app/src/main/java/com/tangem/tap/proxy/AppStateHolder.kt @@ -3,11 +3,11 @@ package com.tangem.tap.proxy import com.tangem.TangemSdk import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse +import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.redux.AppState import com.tangem.tap.domain.TangemSdkManager import com.tangem.tap.domain.tokens.UserTokensRepository -import com.tangem.tap.domain.userWalletList.UserWalletsListManager import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.features.wallet.redux.WalletState import org.rekotlin.Store diff --git a/app/src/main/java/com/tangem/tap/proxy/DerivationManagerImpl.kt b/app/src/main/java/com/tangem/tap/proxy/DerivationManagerImpl.kt index c673ac8577..e24eae21c2 100644 --- a/app/src/main/java/com/tangem/tap/proxy/DerivationManagerImpl.kt +++ b/app/src/main/java/com/tangem/tap/proxy/DerivationManagerImpl.kt @@ -9,6 +9,7 @@ import com.tangem.common.core.TangemSdkError import com.tangem.common.extensions.ByteArrayKey import com.tangem.common.extensions.toMapKey import com.tangem.crypto.hdWallet.DerivationPath +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.util.hasDerivation @@ -23,7 +24,6 @@ import com.tangem.tap.common.extensions.dispatchDebugErrorNotification import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.domain.TapError -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.scope import kotlinx.coroutines.delay import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/tangem/tap/proxy/TransactionManagerImpl.kt b/app/src/main/java/com/tangem/tap/proxy/TransactionManagerImpl.kt index 7bdd3744b4..e6090dd5f0 100644 --- a/app/src/main/java/com/tangem/tap/proxy/TransactionManagerImpl.kt +++ b/app/src/main/java/com/tangem/tap/proxy/TransactionManagerImpl.kt @@ -12,6 +12,7 @@ import com.tangem.blockchain.extensions.isNetworkError import com.tangem.common.core.TangemSdkError import com.tangem.common.extensions.hexToBytes import com.tangem.core.analytics.api.AnalyticsEventHandler +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.lib.crypto.TransactionManager import com.tangem.lib.crypto.models.* @@ -21,7 +22,6 @@ import com.tangem.tap.common.analytics.events.Basic import com.tangem.tap.common.analytics.events.Basic.TransactionSent.MemoType import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.domain.TangemSigner -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.tangemSdk import java.math.BigDecimal import java.math.BigInteger diff --git a/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt b/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt index fba11b855a..1938886ede 100644 --- a/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt +++ b/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt @@ -6,6 +6,7 @@ import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.WalletManager import com.tangem.common.doOnFailure import com.tangem.common.extensions.guard +import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.toCoinId import com.tangem.domain.common.extensions.toNetworkId @@ -17,7 +18,6 @@ import com.tangem.lib.crypto.models.ProxyAmount import com.tangem.lib.crypto.models.ProxyFiatCurrency import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.domain.model.builders.UserWalletIdBuilder -import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.userWalletsListManager import com.tangem.tap.walletCurrenciesManager diff --git a/app/src/main/java/com/tangem/tap/domain/tokens/models/BlockchainNetwork.kt b/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt similarity index 97% rename from app/src/main/java/com/tangem/tap/domain/tokens/models/BlockchainNetwork.kt rename to domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt index 32cfbc4bec..212bd764be 100644 --- a/app/src/main/java/com/tangem/tap/domain/tokens/models/BlockchainNetwork.kt +++ b/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt @@ -1,12 +1,12 @@ -package com.tangem.tap.domain.tokens.models +package com.tangem.domain.common import com.squareup.moshi.JsonClass import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.WalletManager import com.tangem.common.extensions.calculateHashCode -import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.common.TapWorkarounds.derivationStyle +import com.tangem.domain.models.scan.CardDTO @JsonClass(generateAdapter = true) data class BlockchainNetwork( diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/util/UserWalletId.kt b/domain/legacy/src/main/java/com/tangem/domain/common/util/UserWalletId.kt deleted file mode 100644 index 17c22839fd..0000000000 --- a/domain/legacy/src/main/java/com/tangem/domain/common/util/UserWalletId.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.tangem.domain.common.util - -import com.tangem.common.extensions.hexToBytes -import com.tangem.common.extensions.toHexString - -class UserWalletId( - val stringValue: String, -) { - val value = stringValue.hexToBytes() - - constructor(value: ByteArray?) : this( - stringValue = value?.toHexString() ?: "", - ) - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is UserWalletId) return false - - if (stringValue != other.stringValue) return false - - return true - } - - override fun hashCode(): Int { - return stringValue.hashCode() - } - - @Suppress("MagicNumber") - override fun toString(): String { - return with(stringValue) { - "UserWalletId(${take(3)}...${takeLast(3)})" - } - } -} \ No newline at end of file diff --git a/domain/wallets/.gitignore b/domain/wallets/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/domain/wallets/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/domain/wallets/build.gradle.kts b/domain/wallets/build.gradle.kts new file mode 100644 index 0000000000..bbcf863dc9 --- /dev/null +++ b/domain/wallets/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + id("configuration") +} + +android { + namespace = "com.tangem.domain.wallets" +} + +dependencies { + + // region Domain modules + implementation(project(":domain:legacy")) + implementation(project(":domain:wallets:models")) + // endregion + + // region Tangem libraries + implementation(deps.tangem.blockchain) // android-library + implementation(deps.tangem.card.core) + // endregion + + // region Other libraries + implementation(deps.kotlin.coroutines) + // endregion +} \ No newline at end of file diff --git a/domain/wallets/models/.gitignore b/domain/wallets/models/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/domain/wallets/models/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/domain/wallets/models/build.gradle.kts b/domain/wallets/models/build.gradle.kts new file mode 100644 index 0000000000..537d724d84 --- /dev/null +++ b/domain/wallets/models/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + alias(deps.plugins.kotlin.jvm) + id("configuration") +} + +dependencies { + // region Tangem libraries + implementation(deps.tangem.card.core) + // endregion + + // region Domain modules + implementation(project(":domain:models")) + // endregion +} \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/domain/model/UserWallet.kt b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWallet.kt similarity index 93% rename from app/src/main/java/com/tangem/tap/domain/model/UserWallet.kt rename to domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWallet.kt index d58a3e7122..af407822fb 100644 --- a/app/src/main/java/com/tangem/tap/domain/model/UserWallet.kt +++ b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWallet.kt @@ -1,7 +1,6 @@ -package com.tangem.tap.domain.model +package com.tangem.domain.wallets.models import com.tangem.domain.models.scan.ScanResponse -import com.tangem.domain.common.util.UserWalletId /** * Represents user's wallet which stored in app persistence diff --git a/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt new file mode 100644 index 0000000000..791c3a1059 --- /dev/null +++ b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt @@ -0,0 +1,13 @@ +package com.tangem.domain.wallets.models + +import com.tangem.common.extensions.hexToBytes +import com.tangem.common.extensions.toHexString + +data class UserWalletId(val stringValue: String) { + + val value = stringValue.hexToBytes() + + constructor(value: ByteArray?) : this(stringValue = value?.toHexString() ?: "") + + override fun toString() = "UserWalletId(${stringValue.take(n = 3)}...${stringValue.takeLast(n = 3)})" +} \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/UserWalletsListManager.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt similarity index 67% rename from app/src/main/java/com/tangem/tap/domain/userWalletList/UserWalletsListManager.kt rename to domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt index 249ac0d0f4..ff4e805ad1 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/UserWalletsListManager.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt @@ -1,34 +1,25 @@ -package com.tangem.tap.domain.userWalletList +package com.tangem.domain.wallets.legacy import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId import kotlinx.coroutines.flow.Flow interface UserWalletsListManager { - /** - * [Flow] with all saved [UserWallet]s updates - * */ + + /** [Flow] with all saved [UserWallet]s updates */ val userWallets: Flow> - /** - * [Flow] with selected [UserWallet] updates - * */ + /** [Flow] with selected [UserWallet] updates */ val selectedUserWallet: Flow - /** - * Selected [UserWallet] - * */ + /** Selected [UserWallet] */ val selectedUserWalletSync: UserWallet? - /** - * Indicates that the [UserWalletsListManager] contains at least one saved [UserWallet] - * */ + /** Indicates that the [UserWalletsListManager] contains at least one saved [UserWallet] */ val hasUserWallets: Boolean - /** - * Count of saved user wallets - */ + /** Count of saved user wallets */ val walletsCount: Int /** @@ -36,78 +27,79 @@ interface UserWalletsListManager { * * @param userWalletId [UserWalletId] of [UserWallet] which must be selected * - * @return [CompletionResult.Success] with selected [UserWallet] - * or [CompletionResult.Failure] with [NoSuchElementException] if [UserWallet] with [userWalletId] not found - * */ + * @return [CompletionResult.Success] with selected [UserWallet] or [CompletionResult.Failure] with + * [NoSuchElementException] if [UserWallet] with [userWalletId] not found + */ suspend fun select(userWalletId: UserWalletId): CompletionResult /** * Save provided user wallet and set it as selected + * * @param userWallet [UserWallet] to save * @param canOverride If false, then terminate with [UserWalletsListError.WalletAlreadySaved] when user tries * to save an already saved card + * * @return [CompletionResult] of operation */ suspend fun save(userWallet: UserWallet, canOverride: Boolean = false): CompletionResult /** - * Same as [save] but not change selected user wallet ID - * and not terminate with [UserWalletsListError.WalletAlreadySaved] if [UserWallet] already saved + * Same as [save] but not change selected user wallet ID and not terminate with + * [UserWalletsListError.WalletAlreadySaved] if [UserWallet] already saved. + * Can terminate with [NoSuchElementException] if unable to find [UserWallet] with provided [UserWalletId]. * - * Can terminate with [NoSuchElementException] if unable to find [UserWallet] with provided [UserWalletId] * @param userWalletId update [UserWallet] with that [UserWalletId] * @param update lambda that receives stored [UserWallet] and returns updated [UserWallet] - * @return [CompletionResult.Success] with updated [UserWallet] - * or [CompletionResult.Failure] with [NoSuchElementException] if [UserWallet] with [userWalletId] not found - * */ + * + * @return [CompletionResult.Success] with updated [UserWallet] or [CompletionResult.Failure] with + * [NoSuchElementException] if [UserWallet] with [userWalletId] not found + */ suspend fun update( userWalletId: UserWalletId, update: suspend (UserWallet) -> UserWallet, ): CompletionResult /** - * Delete saved [UserWallet]s with provided [UserWalletId]s - * - * Sets [isLocked] as true if [userWallets] is empty or if all [userWallets] are locked + * Delete saved [UserWallet]s with provided [UserWalletId]s. + * Sets [isLocked] as true if [userWallets] is empty or if all [userWallets] are locked. * * @param userWalletIds [UserWalletId]s of [UserWallet]s which must be deleted * * @return [CompletionResult] of operation - * */ + */ suspend fun delete(userWalletIds: List): CompletionResult /** * Clear all saved [UserWallet]s and set [isLocked] as true * * @return [CompletionResult] of operation - * */ + */ suspend fun clear(): CompletionResult /** * Get [UserWallet] with provided [UserWalletId] * - * @return [CompletionResult.Success] with found [UserWallet] - * or [CompletionResult.Failure] with [NoSuchElementException] if [UserWallet] with [userWalletId] not found - * */ + * @return [CompletionResult.Success] with found [UserWallet] or [CompletionResult.Failure] with + * [NoSuchElementException] if [UserWallet] with [userWalletId] not found + */ suspend fun get(userWalletId: UserWalletId): CompletionResult interface Lockable : UserWalletsListManager { + /** * Indicates that all [UserWallet]s is locked * * @see [isLockedSync] * @see [UserWallet.isLocked] - * */ + */ val isLocked: Flow /** - * Indicates that all [UserWallet]s is locked - * - * Sync version + * Indicates that all [UserWallet]s is locked. Sync version. * * @see [isLocked] * @see [UserWallet.isLocked] - * */ + */ val isLockedSync: Boolean /** @@ -115,12 +107,10 @@ interface UserWalletsListManager { * * @return [CompletionResult] of operation, with selected [UserWallet] * or null if there is no selected [UserWallet] - * */ + */ suspend fun unlock(): CompletionResult - /** - * Remove [UserWallet]s from [userWallets] and set [isLocked] as true - * */ + /** Remove [UserWallet]s from [userWallets] and set [isLocked] as true */ fun lock() } diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletManagersRepository.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/WalletManagersRepository.kt similarity index 75% rename from app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletManagersRepository.kt rename to domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/WalletManagersRepository.kt index c49f863277..10eb7a6669 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/WalletManagersRepository.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/WalletManagersRepository.kt @@ -1,13 +1,14 @@ -package com.tangem.tap.domain.walletStores.repository +package com.tangem.domain.wallets.legacy import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.WalletManager import com.tangem.common.CompletionResult -import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.domain.model.UserWallet -import com.tangem.tap.domain.tokens.models.BlockchainNetwork +import com.tangem.domain.common.BlockchainNetwork +import com.tangem.domain.wallets.models.UserWallet +import com.tangem.domain.wallets.models.UserWalletId interface WalletManagersRepository { + suspend fun findOrMakeMultiCurrencyWalletManager( userWallet: UserWallet, blockchainNetwork: BlockchainNetwork, diff --git a/settings.gradle.kts b/settings.gradle.kts index 9f5e38d96a..1f7397e4f8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -77,6 +77,8 @@ include(":domain:legacy") include(":domain:core") include(":domain:card") +include(":domain:wallets") +include(":domain:wallets:models") // endregion Domain modules // region Data modules