Updated on 2026-08-14
This commit is contained in:
parent
f1039e9d96
commit
4faf6e9cb0
15 changed files with 8 additions and 84 deletions
|
|
@ -185,7 +185,6 @@ abstract class BaseTestCase : TestCase(
|
||||||
"SWAP_REDESIGN_ENABLED" to false,
|
"SWAP_REDESIGN_ENABLED" to false,
|
||||||
"ACCOUNTS_FEATURE_ENABLED" to true,
|
"ACCOUNTS_FEATURE_ENABLED" to true,
|
||||||
"MAIN_SCREEN_QR_SCANNING_ENABLED" to true,
|
"MAIN_SCREEN_QR_SCANNING_ENABLED" to true,
|
||||||
"ADD_AND_MANAGE_TOKENS_ENABLED" to true,
|
|
||||||
"ASSETS_DISCOVERY_ENABLED" to true,
|
"ASSETS_DISCOVERY_ENABLED" to true,
|
||||||
"VISA_ONBOARDING_ENABLED" to true,
|
"VISA_ONBOARDING_ENABLED" to true,
|
||||||
// Version-gated toggles released in versions <= 6.0 — forced on so tests run against the actual
|
// Version-gated toggles released in versions <= 6.0 — forced on so tests run against the actual
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,6 @@
|
||||||
"name": "HEDERA_ERC20_ENABLED",
|
"name": "HEDERA_ERC20_ENABLED",
|
||||||
"version": "5.37"
|
"version": "5.37"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "ADD_AND_MANAGE_TOKENS_ENABLED",
|
|
||||||
"version": "5.38"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "WALLET_CONNECT_BITCOIN_ENABLED",
|
"name": "WALLET_CONNECT_BITCOIN_ENABLED",
|
||||||
"version": "undefined"
|
"version": "undefined"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ internal class FeatureTogglesNamingConventionTest {
|
||||||
/** Toggles created before the AND_/TWI_ naming convention. Do NOT add new entries. */
|
/** Toggles created before the AND_/TWI_ naming convention. Do NOT add new entries. */
|
||||||
val EXCLUDED_TOGGLES_LIST = setOf(
|
val EXCLUDED_TOGGLES_LIST = setOf(
|
||||||
"ADDRESS_SYNC_ENABLED",
|
"ADDRESS_SYNC_ENABLED",
|
||||||
"ADD_AND_MANAGE_TOKENS_ENABLED",
|
|
||||||
"APP_REDESIGN_ENABLED",
|
"APP_REDESIGN_ENABLED",
|
||||||
"ASSETS_DISCOVERY_ENABLED",
|
"ASSETS_DISCOVERY_ENABLED",
|
||||||
"DYNAMIC_ADDRESSES_ENABLED",
|
"DYNAMIC_ADDRESSES_ENABLED",
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ package com.tangem.features.wallet.featuretoggles
|
||||||
*/
|
*/
|
||||||
interface WalletFeatureToggles {
|
interface WalletFeatureToggles {
|
||||||
|
|
||||||
val isAddAndManageTokensEnabled: Boolean
|
|
||||||
|
|
||||||
val isAddFundsStage1Enabled: Boolean
|
val isAddFundsStage1Enabled: Boolean
|
||||||
|
|
||||||
val isManageFundsEnabled: Boolean
|
val isManageFundsEnabled: Boolean
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import com.tangem.feature.wallet.presentation.wallet.state.transformers.CloseBot
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.transformers.OpenBottomSheetTransformer
|
import com.tangem.feature.wallet.presentation.wallet.state.transformers.OpenBottomSheetTransformer
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.MultiWalletCurrencyActionsConverter
|
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.MultiWalletCurrencyActionsConverter
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSender
|
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSender
|
||||||
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
|
|
||||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||||
import kotlinx.collections.immutable.toPersistentList
|
import kotlinx.collections.immutable.toPersistentList
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
|
@ -114,7 +113,6 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
|
||||||
private val yieldSupplySetShouldShowMainPromoUseCase: YieldSupplySetShouldShowMainPromoUseCase,
|
private val yieldSupplySetShouldShowMainPromoUseCase: YieldSupplySetShouldShowMainPromoUseCase,
|
||||||
private val tokenListAnalyticsSender: TokenListAnalyticsSender,
|
private val tokenListAnalyticsSender: TokenListAnalyticsSender,
|
||||||
private val uiMessageSender: UiMessageSender,
|
private val uiMessageSender: UiMessageSender,
|
||||||
private val walletFeatureToggles: WalletFeatureToggles,
|
|
||||||
) : BaseWalletClickIntents(), WalletContentClickIntents {
|
) : BaseWalletClickIntents(), WalletContentClickIntents {
|
||||||
|
|
||||||
override fun onDetailsClick() {
|
override fun onDetailsClick() {
|
||||||
|
|
@ -123,12 +121,8 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
|
||||||
|
|
||||||
override fun onOrganizeTokensClick() {
|
override fun onOrganizeTokensClick() {
|
||||||
val userWalletId = stateHolder.getSelectedWalletId()
|
val userWalletId = stateHolder.getSelectedWalletId()
|
||||||
if (walletFeatureToggles.isAddAndManageTokensEnabled) {
|
|
||||||
analyticsEventHandler.send(PortfolioAnalyticsEvent.ButtonAddManage())
|
analyticsEventHandler.send(PortfolioAnalyticsEvent.ButtonAddManage())
|
||||||
router.openAddAndManageBottomSheet(userWalletId = userWalletId)
|
router.openAddAndManageBottomSheet(userWalletId = userWalletId)
|
||||||
} else {
|
|
||||||
router.openOrganizeTokensScreen(userWalletId = userWalletId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDismissMarketsTooltip() {
|
override fun onDismissMarketsTooltip() {
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ internal class DefaultWalletFeatureToggles @Inject constructor(
|
||||||
private val featureToggles: FeatureTogglesManager,
|
private val featureToggles: FeatureTogglesManager,
|
||||||
) : WalletFeatureToggles {
|
) : WalletFeatureToggles {
|
||||||
|
|
||||||
override val isAddAndManageTokensEnabled: Boolean
|
|
||||||
get() = featureToggles.isFeatureEnabled(FeatureToggles.ADD_AND_MANAGE_TOKENS_ENABLED)
|
|
||||||
|
|
||||||
override val isAddFundsStage1Enabled: Boolean
|
override val isAddFundsStage1Enabled: Boolean
|
||||||
get() = featureToggles.isFeatureEnabled(FeatureToggles.AND_15310_ADD_FUNDS_STAGE1)
|
get() = featureToggles.isFeatureEnabled(FeatureToggles.AND_15310_ADD_FUNDS_STAGE1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ internal class SetTokenListTransformer(
|
||||||
private val shouldShowMainPromo: Boolean,
|
private val shouldShowMainPromo: Boolean,
|
||||||
private val isAccountsModeEnabled: Boolean,
|
private val isAccountsModeEnabled: Boolean,
|
||||||
private val isRedesignEnabled: Boolean,
|
private val isRedesignEnabled: Boolean,
|
||||||
private val isAddAndManageTokensEnabled: Boolean,
|
|
||||||
private val isMultipleCardsEnabled: Boolean,
|
private val isMultipleCardsEnabled: Boolean,
|
||||||
) : WalletStateTransformer(userWallet.walletId) {
|
) : WalletStateTransformer(userWallet.walletId) {
|
||||||
|
|
||||||
|
|
@ -123,7 +122,6 @@ internal class SetTokenListTransformer(
|
||||||
yieldModuleApyMap = yieldSupplyApyMap,
|
yieldModuleApyMap = yieldSupplyApyMap,
|
||||||
stakingAvailabilityMap = stakingAvailabilityMap,
|
stakingAvailabilityMap = stakingAvailabilityMap,
|
||||||
shouldShowMainPromo = shouldShowMainPromo,
|
shouldShowMainPromo = shouldShowMainPromo,
|
||||||
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
|
|
||||||
).convert(value = this)
|
).convert(value = this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,7 +165,6 @@ internal class SetTokenListTransformer(
|
||||||
shouldShowMainPromo = shouldShowMainPromo,
|
shouldShowMainPromo = shouldShowMainPromo,
|
||||||
isAccountsModeEnabled = isAccountsModeEnabled,
|
isAccountsModeEnabled = isAccountsModeEnabled,
|
||||||
expandedAccounts = params.expandedAccounts,
|
expandedAccounts = params.expandedAccounts,
|
||||||
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
|
|
||||||
).convert(value = params.accountList)
|
).convert(value = params.accountList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ import com.tangem.core.ui.components.tokenlist.state.PortfolioTokensListItemUM
|
||||||
import com.tangem.core.ui.components.tokenlist.state.TokensListItemUM
|
import com.tangem.core.ui.components.tokenlist.state.TokensListItemUM
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.domain.account.models.AccountStatusList
|
import com.tangem.domain.account.models.AccountStatusList
|
||||||
import com.tangem.domain.account.models.hasMultiCurrencyAccount
|
|
||||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||||
import com.tangem.domain.card.common.util.cardTypesResolver
|
import com.tangem.domain.card.common.util.cardTypesResolver
|
||||||
import com.tangem.domain.models.TotalFiatBalance
|
import com.tangem.domain.models.TotalFiatBalance
|
||||||
|
|
@ -42,7 +41,6 @@ internal class TokenListStateConverter(
|
||||||
private val yieldModuleApyMap: Map<String, BigDecimal>,
|
private val yieldModuleApyMap: Map<String, BigDecimal>,
|
||||||
private val stakingAvailabilityMap: Map<CryptoCurrency, StakingAvailability>,
|
private val stakingAvailabilityMap: Map<CryptoCurrency, StakingAvailability>,
|
||||||
shouldShowMainPromo: Boolean,
|
shouldShowMainPromo: Boolean,
|
||||||
private val isAddAndManageTokensEnabled: Boolean,
|
|
||||||
) : Converter<WalletTokensListState, WalletTokensListState> {
|
) : Converter<WalletTokensListState, WalletTokensListState> {
|
||||||
|
|
||||||
private val yieldSupplyPromoBannerConverter = YieldSupplyPromoBannerConverter(
|
private val yieldSupplyPromoBannerConverter = YieldSupplyPromoBannerConverter(
|
||||||
|
|
@ -170,8 +168,7 @@ internal class TokenListStateConverter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOrganizeTokensButtonStateV2(accountList: AccountStatusList): WalletOrganizeTokensButtonConfig? {
|
private fun getOrganizeTokensButtonStateV2(accountList: AccountStatusList): WalletOrganizeTokensButtonConfig? {
|
||||||
val shouldShowOrganizeIfOldButton = accountList.hasMultiCurrencyAccount() || isAddAndManageTokensEnabled
|
return if (!isSingleCurrencyWalletWithToken()) {
|
||||||
return if (shouldShowOrganizeIfOldButton && !isSingleCurrencyWalletWithToken()) {
|
|
||||||
WalletOrganizeTokensButtonConfig(
|
WalletOrganizeTokensButtonConfig(
|
||||||
textRes = organizeButtonTextRes(),
|
textRes = organizeButtonTextRes(),
|
||||||
iconRes = organizeButtonIconRes(),
|
iconRes = organizeButtonIconRes(),
|
||||||
|
|
@ -183,17 +180,9 @@ internal class TokenListStateConverter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun organizeButtonTextRes(): Int = if (isAddAndManageTokensEnabled) {
|
private fun organizeButtonTextRes(): Int = R.string.main_add_and_manage_tokens
|
||||||
R.string.main_add_and_manage_tokens
|
|
||||||
} else {
|
|
||||||
R.string.organize_tokens_title
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun organizeButtonIconRes(): Int = if (isAddAndManageTokensEnabled) {
|
private fun organizeButtonIconRes(): Int = R.drawable.ic_filter_default_24
|
||||||
R.drawable.ic_filter_default_24
|
|
||||||
} else {
|
|
||||||
R.drawable.ic_filter_24
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isSingleCurrencyWalletWithToken(): Boolean {
|
private fun isSingleCurrencyWalletWithToken(): Boolean {
|
||||||
return selectedWallet is UserWallet.Cold &&
|
return selectedWallet is UserWallet.Cold &&
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ internal class WalletTokensListUMConverter(
|
||||||
private val isAccountsModeEnabled: Boolean,
|
private val isAccountsModeEnabled: Boolean,
|
||||||
private val expandedAccounts: Set<AccountId>,
|
private val expandedAccounts: Set<AccountId>,
|
||||||
private val stakingAvailabilityMap: Map<CryptoCurrency, StakingAvailability>,
|
private val stakingAvailabilityMap: Map<CryptoCurrency, StakingAvailability>,
|
||||||
private val isAddAndManageTokensEnabled: Boolean,
|
|
||||||
shouldShowMainPromo: Boolean,
|
shouldShowMainPromo: Boolean,
|
||||||
) : Converter<AccountStatusList, WalletTokensListUM> {
|
) : Converter<AccountStatusList, WalletTokensListUM> {
|
||||||
|
|
||||||
|
|
@ -161,16 +160,8 @@ internal class WalletTokensListUMConverter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOrganizeButtonUM(accountList: AccountStatusList): TangemButtonUM? {
|
private fun getOrganizeButtonUM(accountList: AccountStatusList): TangemButtonUM? {
|
||||||
val textRes = if (isAddAndManageTokensEnabled) {
|
val textRes = R.string.main_add_and_manage_tokens
|
||||||
R.string.main_add_and_manage_tokens
|
val iconRes = R.drawable.ic_filter_default_24
|
||||||
} else {
|
|
||||||
R.string.organize_tokens_title
|
|
||||||
}
|
|
||||||
val iconRes = if (isAddAndManageTokensEnabled) {
|
|
||||||
R.drawable.ic_filter_default_24
|
|
||||||
} else {
|
|
||||||
R.drawable.ic_filter_24
|
|
||||||
}
|
|
||||||
return if (accountList.flattenCurrencies().isNotEmpty() && !selectedWallet.isSingleWalletWithToken()) {
|
return if (accountList.flattenCurrencies().isNotEmpty() && !selectedWallet.isSingleWalletWithToken()) {
|
||||||
TangemButtonUM(
|
TangemButtonUM(
|
||||||
text = resourceReference(textRes),
|
text = resourceReference(textRes),
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||||
import com.tangem.feature.wallet.presentation.account.AccountDependencies
|
import com.tangem.feature.wallet.presentation.account.AccountDependencies
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
||||||
import com.tangem.features.tangempay.TangemPayFeatureToggles
|
import com.tangem.features.tangempay.TangemPayFeatureToggles
|
||||||
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
|
|
||||||
import com.tangem.utils.coroutines.combine7
|
import com.tangem.utils.coroutines.combine7
|
||||||
import com.tangem.utils.logging.TangemLogger
|
import com.tangem.utils.logging.TangemLogger
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
|
|
@ -39,13 +38,9 @@ internal class AccountListSubscriber @AssistedInject constructor(
|
||||||
private val stakingAvailabilityListUseCase: StakingAvailabilityListUseCase,
|
private val stakingAvailabilityListUseCase: StakingAvailabilityListUseCase,
|
||||||
private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase,
|
private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase,
|
||||||
private val designFeatureToggles: DesignFeatureToggles,
|
private val designFeatureToggles: DesignFeatureToggles,
|
||||||
private val walletFeatureToggles: WalletFeatureToggles,
|
|
||||||
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
|
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
|
||||||
) : BasicAccountListSubscriber() {
|
) : BasicAccountListSubscriber() {
|
||||||
|
|
||||||
override val isAddAndManageTokensEnabled: Boolean
|
|
||||||
get() = walletFeatureToggles.isAddAndManageTokensEnabled
|
|
||||||
|
|
||||||
override fun create(coroutineScope: CoroutineScope): Flow<*> {
|
override fun create(coroutineScope: CoroutineScope): Flow<*> {
|
||||||
val walletId = userWallet.walletId.stringValue
|
val walletId = userWallet.walletId.stringValue
|
||||||
TangemLogger.i("$TAG[$walletId]: create() called, building combine7")
|
TangemLogger.i("$TAG[$walletId]: create() called, building combine7")
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ internal abstract class BasicAccountListSubscriber : BasicWalletSubscriber() {
|
||||||
abstract val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase
|
abstract val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase
|
||||||
abstract val stateController: WalletStateController
|
abstract val stateController: WalletStateController
|
||||||
abstract val clickIntents: WalletClickIntents
|
abstract val clickIntents: WalletClickIntents
|
||||||
abstract val isAddAndManageTokensEnabled: Boolean
|
|
||||||
|
|
||||||
override val singleAccountStatusListSupplier: SingleAccountStatusListSupplier
|
override val singleAccountStatusListSupplier: SingleAccountStatusListSupplier
|
||||||
get() = accountDependencies.singleAccountStatusListSupplier
|
get() = accountDependencies.singleAccountStatusListSupplier
|
||||||
|
|
@ -107,7 +106,6 @@ internal abstract class BasicAccountListSubscriber : BasicWalletSubscriber() {
|
||||||
shouldShowMainPromo = shouldShowMainPromo,
|
shouldShowMainPromo = shouldShowMainPromo,
|
||||||
isAccountsModeEnabled = isAccountMode,
|
isAccountsModeEnabled = isAccountMode,
|
||||||
isRedesignEnabled = true,
|
isRedesignEnabled = true,
|
||||||
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
|
|
||||||
isMultipleCardsEnabled = isMultipleCardsEnabled,
|
isMultipleCardsEnabled = isMultipleCardsEnabled,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
@ -172,7 +170,6 @@ internal abstract class BasicAccountListSubscriber : BasicWalletSubscriber() {
|
||||||
shouldShowMainPromo = shouldShowMainPromo,
|
shouldShowMainPromo = shouldShowMainPromo,
|
||||||
isAccountsModeEnabled = false,
|
isAccountsModeEnabled = false,
|
||||||
isRedesignEnabled = false,
|
isRedesignEnabled = false,
|
||||||
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
|
|
||||||
isMultipleCardsEnabled = false,
|
isMultipleCardsEnabled = false,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||||
import com.tangem.feature.wallet.presentation.account.AccountDependencies
|
import com.tangem.feature.wallet.presentation.account.AccountDependencies
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
||||||
import com.tangem.features.tangempay.TangemPayFeatureToggles
|
import com.tangem.features.tangempay.TangemPayFeatureToggles
|
||||||
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
|
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
|
|
@ -22,13 +21,9 @@ internal class SingleWalletSubscriber @AssistedInject constructor(
|
||||||
override val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase,
|
override val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase,
|
||||||
override val stateController: WalletStateController,
|
override val stateController: WalletStateController,
|
||||||
override val clickIntents: WalletClickIntents,
|
override val clickIntents: WalletClickIntents,
|
||||||
private val walletFeatureToggles: WalletFeatureToggles,
|
|
||||||
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
|
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
|
||||||
) : BasicAccountListSubscriber() {
|
) : BasicAccountListSubscriber() {
|
||||||
|
|
||||||
override val isAddAndManageTokensEnabled: Boolean
|
|
||||||
get() = walletFeatureToggles.isAddAndManageTokensEnabled
|
|
||||||
|
|
||||||
override fun create(coroutineScope: CoroutineScope): Flow<Unit> = combine(
|
override fun create(coroutineScope: CoroutineScope): Flow<Unit> = combine(
|
||||||
flow = getAccountStatusListFlow(),
|
flow = getAccountStatusListFlow(),
|
||||||
flow2 = getAppCurrencyFlow(),
|
flow2 = getAppCurrencyFlow(),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import com.tangem.domain.models.wallet.UserWallet
|
||||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||||
import com.tangem.feature.wallet.presentation.account.AccountDependencies
|
import com.tangem.feature.wallet.presentation.account.AccountDependencies
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
||||||
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
|
|
||||||
import com.tangem.utils.annotations.RemoveWithToggle
|
import com.tangem.utils.annotations.RemoveWithToggle
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedFactory
|
import dagger.assisted.AssistedFactory
|
||||||
|
|
@ -22,12 +21,8 @@ internal class SingleWalletWithTokenSubscriberLegacy @AssistedInject constructor
|
||||||
override val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase,
|
override val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase,
|
||||||
override val stateController: WalletStateController,
|
override val stateController: WalletStateController,
|
||||||
override val clickIntents: WalletClickIntents,
|
override val clickIntents: WalletClickIntents,
|
||||||
private val walletFeatureToggles: WalletFeatureToggles,
|
|
||||||
) : BasicAccountListSubscriber() {
|
) : BasicAccountListSubscriber() {
|
||||||
|
|
||||||
override val isAddAndManageTokensEnabled: Boolean
|
|
||||||
get() = walletFeatureToggles.isAddAndManageTokensEnabled
|
|
||||||
|
|
||||||
override fun create(coroutineScope: CoroutineScope): Flow<Unit> = combine(
|
override fun create(coroutineScope: CoroutineScope): Flow<Unit> = combine(
|
||||||
flow = getAccountStatusListFlow(),
|
flow = getAccountStatusListFlow(),
|
||||||
flow2 = getAppCurrencyFlow(),
|
flow2 = getAppCurrencyFlow(),
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ class SetTokenListTransformerTest {
|
||||||
shouldShowMainPromo = false,
|
shouldShowMainPromo = false,
|
||||||
isAccountsModeEnabled = false,
|
isAccountsModeEnabled = false,
|
||||||
isRedesignEnabled = true,
|
isRedesignEnabled = true,
|
||||||
isAddAndManageTokensEnabled = false,
|
|
||||||
isMultipleCardsEnabled = false,
|
isMultipleCardsEnabled = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import com.tangem.core.analytics.models.AnalyticsEvent
|
||||||
import com.tangem.domain.models.wallet.UserWalletId
|
import com.tangem.domain.models.wallet.UserWalletId
|
||||||
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
|
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
|
||||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
||||||
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
|
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import io.mockk.slot
|
import io.mockk.slot
|
||||||
|
|
@ -21,7 +20,6 @@ internal class WalletContentClickIntentsAnalyticsTest {
|
||||||
|
|
||||||
private val stateHolder: WalletStateController = mockk(relaxed = true)
|
private val stateHolder: WalletStateController = mockk(relaxed = true)
|
||||||
private val analyticsEventHandler: AnalyticsEventHandler = mockk(relaxed = true)
|
private val analyticsEventHandler: AnalyticsEventHandler = mockk(relaxed = true)
|
||||||
private val walletFeatureToggles: WalletFeatureToggles = mockk(relaxed = true)
|
|
||||||
private val router: InnerWalletRouter = mockk(relaxed = true)
|
private val router: InnerWalletRouter = mockk(relaxed = true)
|
||||||
|
|
||||||
private val userWalletId = UserWalletId(stringValue = "0123456789ABCDEF")
|
private val userWalletId = UserWalletId(stringValue = "0123456789ABCDEF")
|
||||||
|
|
@ -45,16 +43,14 @@ internal class WalletContentClickIntentsAnalyticsTest {
|
||||||
yieldSupplySetShouldShowMainPromoUseCase = mockk(relaxed = true),
|
yieldSupplySetShouldShowMainPromoUseCase = mockk(relaxed = true),
|
||||||
tokenListAnalyticsSender = mockk(relaxed = true),
|
tokenListAnalyticsSender = mockk(relaxed = true),
|
||||||
uiMessageSender = mockk(relaxed = true),
|
uiMessageSender = mockk(relaxed = true),
|
||||||
walletFeatureToggles = walletFeatureToggles,
|
|
||||||
)
|
)
|
||||||
implementor.initialize(router = router, coroutineScope = TestScope())
|
implementor.initialize(router = router, coroutineScope = TestScope())
|
||||||
return implementor
|
return implementor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `GIVEN add and manage toggle enabled WHEN onOrganizeTokensClick THEN sends ButtonAddManage event and opens bottom sheet`() =
|
fun `WHEN onOrganizeTokensClick THEN sends ButtonAddManage event and opens bottom sheet`() =
|
||||||
runTest {
|
runTest {
|
||||||
every { walletFeatureToggles.isAddAndManageTokensEnabled } returns true
|
|
||||||
val implementor = createImplementor()
|
val implementor = createImplementor()
|
||||||
val captured = slot<AnalyticsEvent>()
|
val captured = slot<AnalyticsEvent>()
|
||||||
|
|
||||||
|
|
@ -67,17 +63,4 @@ internal class WalletContentClickIntentsAnalyticsTest {
|
||||||
verify(exactly = 1) { router.openAddAndManageBottomSheet(userWalletId = userWalletId) }
|
verify(exactly = 1) { router.openAddAndManageBottomSheet(userWalletId = userWalletId) }
|
||||||
verify(exactly = 0) { router.openOrganizeTokensScreen(any()) }
|
verify(exactly = 0) { router.openOrganizeTokensScreen(any()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `GIVEN add and manage toggle disabled WHEN onOrganizeTokensClick THEN does not send analytics and opens organize screen`() =
|
|
||||||
runTest {
|
|
||||||
every { walletFeatureToggles.isAddAndManageTokensEnabled } returns false
|
|
||||||
val implementor = createImplementor()
|
|
||||||
|
|
||||||
implementor.onOrganizeTokensClick()
|
|
||||||
|
|
||||||
verify(exactly = 0) { analyticsEventHandler.send(any<AnalyticsEvent>()) }
|
|
||||||
verify(exactly = 1) { router.openOrganizeTokensScreen(userWalletId = userWalletId) }
|
|
||||||
verify(exactly = 0) { router.openAddAndManageBottomSheet(any()) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue