Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-06 13:39:30 +03:00
commit 92849d43c2
1407 changed files with 64092 additions and 11990 deletions

View file

@ -16,6 +16,7 @@ import com.tangem.core.ui.utils.parseBigDecimal
import com.tangem.datasource.local.appsflyer.AppsFlyerStore
import com.tangem.domain.account.status.usecase.IsAccountsModeEnabledUseCase
import com.tangem.domain.account.supplier.SingleAccountListSupplier
import com.tangem.domain.addressbook.usecase.SyncAddressBooksUseCase
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.apptheme.GetAppThemeModeUseCase
@ -127,6 +128,7 @@ internal class WalletModel @Inject constructor(
private val walletFeatureToggles: WalletFeatureToggles,
private val pushNotificationSettingsFeatureToggles: PushNotificationSettingsFeatureToggles,
private val startAssetsDiscoveryUseCase: StartAssetsDiscoveryUseCase,
private val syncAddressBooksUseCase: SyncAddressBooksUseCase,
val screenLifecycleProvider: ScreenLifecycleProvider,
val innerWalletRouter: InnerWalletRouter,
) : Model() {
@ -162,6 +164,7 @@ internal class WalletModel @Inject constructor(
subscribeToMainScreenQrScanning()
enableNotificationsIfNeeded()
applyPendingAssetsDiscovery()
syncAddressBooks()
clickIntents.initialize(innerWalletRouter, modelScope)
@ -877,6 +880,13 @@ internal class WalletModel @Inject constructor(
}
}
private fun syncAddressBooks() {
modelScope.launch {
syncAddressBooksUseCase()
.onLeft { TangemLogger.e("Failed to sync address books: $it") }
}
}
private fun enableNotificationsIfNeeded() {
modelScope.launch {
val isUserAllowToEnableNotifications = notificationsRepository.isUserAllowToSubscribeOnPushNotifications()

View file

@ -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.converter.MultiWalletCurrencyActionsConverter
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSender
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.flow.collectLatest
@ -114,7 +113,6 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
private val yieldSupplySetShouldShowMainPromoUseCase: YieldSupplySetShouldShowMainPromoUseCase,
private val tokenListAnalyticsSender: TokenListAnalyticsSender,
private val uiMessageSender: UiMessageSender,
private val walletFeatureToggles: WalletFeatureToggles,
) : BaseWalletClickIntents(), WalletContentClickIntents {
override fun onDetailsClick() {
@ -123,12 +121,8 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
override fun onOrganizeTokensClick() {
val userWalletId = stateHolder.getSelectedWalletId()
if (walletFeatureToggles.isAddAndManageTokensEnabled) {
analyticsEventHandler.send(PortfolioAnalyticsEvent.ButtonAddManage())
router.openAddAndManageBottomSheet(userWalletId = userWalletId)
} else {
router.openOrganizeTokensScreen(userWalletId = userWalletId)
}
analyticsEventHandler.send(PortfolioAnalyticsEvent.ButtonAddManage())
router.openAddAndManageBottomSheet(userWalletId = userWalletId)
}
override fun onDismissMarketsTooltip() {

View file

@ -9,9 +9,6 @@ internal class DefaultWalletFeatureToggles @Inject constructor(
private val featureToggles: FeatureTogglesManager,
) : WalletFeatureToggles {
override val isAddAndManageTokensEnabled: Boolean
get() = featureToggles.isFeatureEnabled(FeatureToggles.ADD_AND_MANAGE_TOKENS_ENABLED)
override val isAddFundsStage1Enabled: Boolean
get() = featureToggles.isFeatureEnabled(FeatureToggles.AND_15310_ADD_FUNDS_STAGE1)

View file

@ -39,7 +39,6 @@ import com.tangem.feature.wallet.presentation.account.AccountDependencies
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles
import com.tangem.hot.sdk.model.HotWalletId
import com.tangem.lib.crypto.BlockchainUtils
import com.tangem.utils.annotations.RemoveWithToggle
@ -70,7 +69,6 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
private val hotWalletFeatureToggles: HotWalletFeatureToggles,
private val shouldShowYieldBoostMainBannerUseCase: ShouldShowYieldBoostMainBannerUseCase,
private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase,
private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles,
private val designFeatureToggles: DesignFeatureToggles,
private val walletFeatureToggles: WalletFeatureToggles,
) {
@ -208,7 +206,6 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
clickIntents: WalletClickIntents,
) {
if (!shouldShowLocal) return
if (!yieldSupplyFeatureToggles.isYieldPromoEnabled) return
if (designFeatureToggles.isRedesignEnabled) return
val shouldShow = shouldShowYieldBoostMainBannerUseCase(userWallet.walletId).getOrNull() == true
if (!shouldShow) return

View file

@ -15,7 +15,6 @@ import com.tangem.domain.yield.supply.promo.usecase.ShouldShowYieldBoostMainBann
import com.tangem.domain.yield.supply.usecase.YieldSupplyGetShouldShowMainPromoUseCase
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotificationUM
import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles
import com.tangem.utils.extensions.addIf
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
@ -38,7 +37,6 @@ internal class GetWalletNotificationsCarouselFactory @Inject constructor(
private val notificationsRepository: NotificationsRepository,
private val shouldShowYieldBoostMainBannerUseCase: ShouldShowYieldBoostMainBannerUseCase,
private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase,
private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles,
private val singleAccountStatusListSupplier: SingleAccountStatusListSupplier,
) {
fun create(userWallet: UserWallet, clickIntents: WalletClickIntents): Flow<ImmutableList<WalletNotificationUM>> {
@ -86,7 +84,6 @@ internal class GetWalletNotificationsCarouselFactory @Inject constructor(
clickIntents: WalletClickIntents,
) {
if (!shouldShowLocal) return
if (!yieldSupplyFeatureToggles.isYieldPromoEnabled) return
val shouldShow = shouldShowYieldBoostMainBannerUseCase(userWallet.walletId).getOrNull() == true
if (!shouldShow) return
add(

View file

@ -27,7 +27,6 @@ internal class SetTokenListTransformer(
private val shouldShowMainPromo: Boolean,
private val isAccountsModeEnabled: Boolean,
private val isRedesignEnabled: Boolean,
private val isAddAndManageTokensEnabled: Boolean,
private val isMultipleCardsEnabled: Boolean,
) : WalletStateTransformer(userWallet.walletId) {
@ -123,7 +122,6 @@ internal class SetTokenListTransformer(
yieldModuleApyMap = yieldSupplyApyMap,
stakingAvailabilityMap = stakingAvailabilityMap,
shouldShowMainPromo = shouldShowMainPromo,
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
).convert(value = this)
}
@ -167,7 +165,6 @@ internal class SetTokenListTransformer(
shouldShowMainPromo = shouldShowMainPromo,
isAccountsModeEnabled = isAccountsModeEnabled,
expandedAccounts = params.expandedAccounts,
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
).convert(value = params.accountList)
}
}

View file

@ -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.extensions.resourceReference
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.card.common.util.cardTypesResolver
import com.tangem.domain.models.TotalFiatBalance
@ -42,7 +41,6 @@ internal class TokenListStateConverter(
private val yieldModuleApyMap: Map<String, BigDecimal>,
private val stakingAvailabilityMap: Map<CryptoCurrency, StakingAvailability>,
shouldShowMainPromo: Boolean,
private val isAddAndManageTokensEnabled: Boolean,
) : Converter<WalletTokensListState, WalletTokensListState> {
private val yieldSupplyPromoBannerConverter = YieldSupplyPromoBannerConverter(
@ -170,8 +168,7 @@ internal class TokenListStateConverter(
}
private fun getOrganizeTokensButtonStateV2(accountList: AccountStatusList): WalletOrganizeTokensButtonConfig? {
val shouldShowOrganizeIfOldButton = accountList.hasMultiCurrencyAccount() || isAddAndManageTokensEnabled
return if (shouldShowOrganizeIfOldButton && !isSingleCurrencyWalletWithToken()) {
return if (!isSingleCurrencyWalletWithToken()) {
WalletOrganizeTokensButtonConfig(
textRes = organizeButtonTextRes(),
iconRes = organizeButtonIconRes(),
@ -183,17 +180,9 @@ internal class TokenListStateConverter(
}
}
private fun organizeButtonTextRes(): Int = if (isAddAndManageTokensEnabled) {
R.string.main_add_and_manage_tokens
} else {
R.string.organize_tokens_title
}
private fun organizeButtonTextRes(): Int = R.string.main_add_and_manage_tokens
private fun organizeButtonIconRes(): Int = if (isAddAndManageTokensEnabled) {
R.drawable.ic_filter_default_24
} else {
R.drawable.ic_filter_24
}
private fun organizeButtonIconRes(): Int = R.drawable.ic_filter_default_24
private fun isSingleCurrencyWalletWithToken(): Boolean {
return selectedWallet is UserWallet.Cold &&

View file

@ -38,7 +38,6 @@ internal class WalletTokensListUMConverter(
private val isAccountsModeEnabled: Boolean,
private val expandedAccounts: Set<AccountId>,
private val stakingAvailabilityMap: Map<CryptoCurrency, StakingAvailability>,
private val isAddAndManageTokensEnabled: Boolean,
shouldShowMainPromo: Boolean,
) : Converter<AccountStatusList, WalletTokensListUM> {
@ -161,16 +160,8 @@ internal class WalletTokensListUMConverter(
}
private fun getOrganizeButtonUM(accountList: AccountStatusList): TangemButtonUM? {
val textRes = if (isAddAndManageTokensEnabled) {
R.string.main_add_and_manage_tokens
} else {
R.string.organize_tokens_title
}
val iconRes = if (isAddAndManageTokensEnabled) {
R.drawable.ic_filter_default_24
} else {
R.drawable.ic_filter_24
}
val textRes = R.string.main_add_and_manage_tokens
val iconRes = R.drawable.ic_filter_default_24
return if (accountList.flattenCurrencies().isNotEmpty() && !selectedWallet.isSingleCurrency()) {
TangemButtonUM(
text = resourceReference(textRes),

View file

@ -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.wallet.state.WalletStateController
import com.tangem.features.tangempay.TangemPayFeatureToggles
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
import com.tangem.utils.coroutines.combine7
import com.tangem.utils.logging.TangemLogger
import dagger.assisted.Assisted
@ -39,13 +38,9 @@ internal class AccountListSubscriber @AssistedInject constructor(
private val stakingAvailabilityListUseCase: StakingAvailabilityListUseCase,
private val yieldSupplyGetShouldShowMainPromoUseCase: YieldSupplyGetShouldShowMainPromoUseCase,
private val designFeatureToggles: DesignFeatureToggles,
private val walletFeatureToggles: WalletFeatureToggles,
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
) : BasicAccountListSubscriber() {
override val isAddAndManageTokensEnabled: Boolean
get() = walletFeatureToggles.isAddAndManageTokensEnabled
override fun create(coroutineScope: CoroutineScope): Flow<*> {
val walletId = userWallet.walletId.stringValue
TangemLogger.i("$TAG[$walletId]: create() called, building combine7")

View file

@ -34,7 +34,6 @@ internal abstract class BasicAccountListSubscriber : BasicWalletSubscriber() {
abstract val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase
abstract val stateController: WalletStateController
abstract val clickIntents: WalletClickIntents
abstract val isAddAndManageTokensEnabled: Boolean
override val singleAccountStatusListSupplier: SingleAccountStatusListSupplier
get() = accountDependencies.singleAccountStatusListSupplier
@ -107,7 +106,6 @@ internal abstract class BasicAccountListSubscriber : BasicWalletSubscriber() {
shouldShowMainPromo = shouldShowMainPromo,
isAccountsModeEnabled = isAccountMode,
isRedesignEnabled = true,
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
isMultipleCardsEnabled = isMultipleCardsEnabled,
),
)
@ -172,7 +170,6 @@ internal abstract class BasicAccountListSubscriber : BasicWalletSubscriber() {
shouldShowMainPromo = shouldShowMainPromo,
isAccountsModeEnabled = false,
isRedesignEnabled = false,
isAddAndManageTokensEnabled = isAddAndManageTokensEnabled,
isMultipleCardsEnabled = false,
),
)

View file

@ -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.wallet.state.WalletStateController
import com.tangem.features.tangempay.TangemPayFeatureToggles
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
@ -22,13 +21,9 @@ internal class SingleWalletSubscriber @AssistedInject constructor(
override val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase,
override val stateController: WalletStateController,
override val clickIntents: WalletClickIntents,
private val walletFeatureToggles: WalletFeatureToggles,
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
) : BasicAccountListSubscriber() {
override val isAddAndManageTokensEnabled: Boolean
get() = walletFeatureToggles.isAddAndManageTokensEnabled
override fun create(coroutineScope: CoroutineScope): Flow<Unit> = combine(
flow = getAccountStatusListFlow(),
flow2 = getAppCurrencyFlow(),

View file

@ -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.presentation.account.AccountDependencies
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
import com.tangem.utils.annotations.RemoveWithToggle
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
@ -22,12 +21,8 @@ internal class SingleWalletWithTokenSubscriberLegacy @AssistedInject constructor
override val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase,
override val stateController: WalletStateController,
override val clickIntents: WalletClickIntents,
private val walletFeatureToggles: WalletFeatureToggles,
) : BasicAccountListSubscriber() {
override val isAddAndManageTokensEnabled: Boolean
get() = walletFeatureToggles.isAddAndManageTokensEnabled
override fun create(coroutineScope: CoroutineScope): Flow<Unit> = combine(
flow = getAccountStatusListFlow(),
flow2 = getAppCurrencyFlow(),