Updated on 2026-08-14
This commit is contained in:
parent
2d3e5fdb7a
commit
dd0add894f
20 changed files with 118 additions and 57 deletions
|
|
@ -15,6 +15,7 @@ import com.tangem.domain.card.common.util.cardTypesResolver
|
|||
import com.tangem.domain.core.lce.Lce
|
||||
import com.tangem.domain.core.lce.LceFlow
|
||||
import com.tangem.domain.demo.IsDemoCardUseCase
|
||||
import com.tangem.domain.hotwallet.GetAccessCodeSkippedUseCase
|
||||
import com.tangem.domain.models.StatusSource
|
||||
import com.tangem.domain.models.TotalFiatBalance
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
|
|
@ -31,7 +32,6 @@ import com.tangem.domain.tokens.error.TokenListError
|
|||
import com.tangem.domain.wallets.models.SeedPhraseNotificationsStatus
|
||||
import com.tangem.domain.wallets.usecase.IsNeedToBackupUseCase
|
||||
import com.tangem.domain.wallets.usecase.SeedPhraseNotificationUseCase
|
||||
import com.tangem.domain.hotwallet.GetAccessCodeSkippedUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.WalletActivationBannerType
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.impl.R
|
||||
|
|
@ -125,7 +125,12 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
|
|||
|
||||
addVisaPresalePromoNotification(clickIntents, shouldShowVisaPromo)
|
||||
|
||||
addSepaPromoNotification(userWallet, clickIntents, shouldShowSepaBanner)
|
||||
addSepaPromoNotification(
|
||||
userWallet = userWallet,
|
||||
flattenCurrencies = flattenCurrencies,
|
||||
clickIntents = clickIntents,
|
||||
shouldShowSepaPromo = shouldShowSepaBanner,
|
||||
)
|
||||
|
||||
addInformationalNotifications(userWallet, cardTypesResolver, flattenCurrencies, clickIntents)
|
||||
|
||||
|
|
@ -293,12 +298,20 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
|
|||
|
||||
private suspend fun MutableList<WalletNotification>.addSepaPromoNotification(
|
||||
userWallet: UserWallet,
|
||||
flattenCurrencies: Lce<TokenListError, List<CryptoCurrencyStatus>>,
|
||||
clickIntents: WalletClickIntents,
|
||||
shouldShowSepaPromo: Boolean,
|
||||
) {
|
||||
val currencies = getCryptoCurrenciesUseCase(userWalletId = userWallet.walletId).getOrElse {
|
||||
Timber.e("Error on getting crypto currency list")
|
||||
return
|
||||
val currencies = if (accountDependencies.accountsFeatureToggles.isFeatureEnabled) {
|
||||
flattenCurrencies.map { statuses -> statuses.map { it.currency } }.getOrNull() ?: run {
|
||||
Timber.e("Error on getting crypto currency list")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
getCryptoCurrenciesUseCase(userWalletId = userWallet.walletId).getOrElse {
|
||||
Timber.e("Error on getting crypto currency list")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
val bitcoinCurrency = currencies.find { isBitcoin(it.network.rawId) } ?: return
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.subscribers
|
||||
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.nft.GetNFTCollectionsUseCase
|
||||
import com.tangem.domain.tokens.repository.CurrenciesRepository
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.wallets.repository.WalletsRepository
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
|
||||
|
|
@ -12,6 +12,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.*
|
||||
|
||||
@Deprecated("Use WalletNFTListSubscriberV2 instead")
|
||||
internal class WalletNFTListSubscriber(
|
||||
private val userWallet: UserWallet,
|
||||
private val stateHolder: WalletStateController,
|
||||
|
|
|
|||
|
|
@ -35,17 +35,17 @@ internal class WalletNFTListSubscriberV2 @AssistedInject constructor(
|
|||
// if NFT is enabled for this wallet and there are currencies,
|
||||
// then start observing changes from store and apply transformer if need
|
||||
if (nftEnabled && currencies.isNotEmpty()) {
|
||||
getNFTCollectionsUseCase(userWallet.walletId)
|
||||
getNFTCollectionsUseCase.invokeForAccounts(userWallet.walletId)
|
||||
.shareIn(
|
||||
scope = coroutineScope,
|
||||
started = SharingStarted.WhileSubscribed(),
|
||||
replay = 1,
|
||||
)
|
||||
.onEach {
|
||||
.onEach { walletNFTCollections ->
|
||||
stateController.update(
|
||||
SetNFTCollectionsTransformer(
|
||||
userWalletId = userWallet.walletId,
|
||||
nftCollections = it,
|
||||
nftCollections = walletNFTCollections.flattenCollections,
|
||||
onItemClick = { clickIntents.onNFTClick(userWallet) },
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue