Updated on 2026-08-14
This commit is contained in:
parent
4e63402851
commit
c43432b1ca
7 changed files with 76 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase
|
|||
import com.tangem.domain.wallets.usecase.SelectWalletUseCase
|
||||
import com.tangem.domain.yield.supply.usecase.YieldSupplyApyUpdateUseCase
|
||||
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
|
||||
import com.tangem.feature.wallet.presentation.wallet.analytics.WalletScreenAnalyticsEvent
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.OnrampStatusFactory
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletContentFetcher
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.unwrap
|
||||
|
|
@ -123,6 +124,11 @@ internal class WalletClickIntents @Inject constructor(
|
|||
router.openAddFunds(userWalletId)
|
||||
}
|
||||
|
||||
fun onAddFundsPromoClick(userWalletId: UserWalletId) {
|
||||
analyticsEventHandler.send(WalletScreenAnalyticsEvent.MainScreen.ButtonAddFundsPromo())
|
||||
router.openAddFunds(userWalletId)
|
||||
}
|
||||
|
||||
private fun refreshMultiCurrencyContent(showRefreshState: Boolean) {
|
||||
val userWallet = getSelectedWalletSyncUseCase.unwrap() ?: return
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,10 @@ sealed class WalletScreenAnalyticsEvent {
|
|||
|
||||
class BackupError : MainScreen(event = "Notice - Backup Error")
|
||||
|
||||
class NoticeAddFunds : MainScreen(event = "Notice - Add Funds")
|
||||
|
||||
class ButtonAddFundsPromo : MainScreen(event = "Button - Add Funds Promo")
|
||||
|
||||
class NotePromo : MainScreen(event = "Notice - Note Promo")
|
||||
|
||||
class NotePromoButton : MainScreen(event = "Note Promo Button")
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ internal class WalletWarningsAnalyticsSender @Inject constructor(
|
|||
)
|
||||
}
|
||||
is WalletNotificationUM.PushNotifications -> PushBanner()
|
||||
is WalletNotificationUM.AddFunds -> NoticeAddFunds()
|
||||
is WalletNotificationUM.UnlockWallets,
|
||||
is WalletNotificationUM.NoAccount,
|
||||
is WalletNotificationUM.LowSignatures,
|
||||
|
|
|
|||
|
|
@ -64,9 +64,17 @@ internal class GetWalletNotificationsFactory @Inject constructor(
|
|||
.filterIsInstance<AccountStatus.Payment>()
|
||||
.firstOrNull()
|
||||
|
||||
val isAddFundsBannerShown = isAddFundsBannerVisible(totalFiatBalance)
|
||||
|
||||
buildList {
|
||||
addUsedOutdatedDataNotification(totalFiatBalance)
|
||||
|
||||
addAddFundsBanner(
|
||||
isVisible = isAddFundsBannerShown,
|
||||
userWallet = userWallet,
|
||||
clickIntents = clickIntents,
|
||||
)
|
||||
|
||||
addCriticalNotifications(userWallet, clickIntents)
|
||||
|
||||
addFinishWalletActivationNotification(
|
||||
|
|
@ -87,7 +95,7 @@ internal class GetWalletNotificationsFactory @Inject constructor(
|
|||
userWallet = userWallet,
|
||||
cardTypesResolver = cardTypesResolver,
|
||||
flattenCurrencies = flattenCurrencies,
|
||||
isNeedToBackup = isNeedToBackup,
|
||||
isNeedToBackup = isNeedToBackup && !isAddFundsBannerShown,
|
||||
clickIntents = clickIntents,
|
||||
)
|
||||
|
||||
|
|
@ -109,6 +117,24 @@ internal class GetWalletNotificationsFactory @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun isAddFundsBannerVisible(totalFiatBalance: TotalFiatBalance): Boolean {
|
||||
val loaded = totalFiatBalance as? TotalFiatBalance.Loaded ?: return false
|
||||
return loaded.amount.orZero().signum() == 0
|
||||
}
|
||||
|
||||
private fun MutableList<WalletNotificationUM>.addAddFundsBanner(
|
||||
isVisible: Boolean,
|
||||
userWallet: UserWallet,
|
||||
clickIntents: WalletClickIntents,
|
||||
) {
|
||||
addIf(
|
||||
element = WalletNotificationUM.AddFunds(
|
||||
onClick = { clickIntents.onAddFundsPromoClick(userWallet.walletId) },
|
||||
),
|
||||
condition = isVisible,
|
||||
)
|
||||
}
|
||||
|
||||
private fun MutableList<WalletNotificationUM>.addCriticalNotifications(
|
||||
userWallet: UserWallet,
|
||||
clickIntents: WalletClickIntents,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import com.tangem.core.ui.extensions.*
|
|||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.feature.wallet.impl.R
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import com.tangem.core.res.R as CoreResR
|
||||
import com.tangem.core.ui.R as CoreUiR
|
||||
|
||||
/**
|
||||
* Wallet notification types
|
||||
|
|
@ -342,6 +344,27 @@ internal sealed class WalletNotificationUM(val messageUM: TangemMessageUM, val t
|
|||
// endregion
|
||||
|
||||
// region Promo
|
||||
data class AddFunds(val onClick: () -> Unit) : WalletNotificationUM(
|
||||
messageUM = TangemMessageUM(
|
||||
id = "AddFundsPromoNotification",
|
||||
title = resourceReference(id = CoreResR.string.main_add_funds_promo_title),
|
||||
subtitle = resourceReference(id = CoreResR.string.main_add_funds_promo_description),
|
||||
iconUM = TangemIconUM.Icon(
|
||||
iconRes = CoreUiR.drawable.ic_coins_swap_24,
|
||||
tintReference = { TangemTheme.colors2.graphic.status.accent },
|
||||
),
|
||||
messageEffect = TangemMessageEffect.None,
|
||||
buttonsUM = persistentListOf(
|
||||
TangemMessageButtonUM(
|
||||
text = resourceReference(id = CoreResR.string.common_add_funds),
|
||||
type = TangemButtonType.Secondary,
|
||||
onClick = onClick,
|
||||
),
|
||||
),
|
||||
),
|
||||
type = WalletNotificationType.Promo,
|
||||
)
|
||||
|
||||
data class NoteMigration(val onClick: () -> Unit) : WalletNotificationUM(
|
||||
messageUM = TangemMessageUM(
|
||||
id = "NoteMigrationNotification",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue