Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-23 18:04:31 +04:00
parent ad65a62b3f
commit 97a13da0d7
19 changed files with 176 additions and 56 deletions

View file

@ -12,6 +12,7 @@ import com.tangem.core.analytics.models.event.AssetsDiscoveryAnalyticsEvent
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.navigation.review.ReviewManager
import com.tangem.core.navigation.url.AppStoreOpener
import com.tangem.domain.assetsdiscovery.usecase.AcknowledgeAssetsDiscoveryCompletionUseCase
import com.tangem.domain.card.SetCardWasScannedUseCase
import com.tangem.domain.common.wallets.UserWalletsListRepository
@ -73,6 +74,8 @@ internal interface WalletWarningsClickIntents {
fun onSupportClick()
fun onSoftUpdateClick()
fun onBackupErrorClick()
fun onNoteMigrationButtonClick(url: String)
@ -111,6 +114,7 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
private val dispatchers: CoroutineDispatcherProvider,
private val getWalletMetaInfoUseCase: GetWalletMetaInfoUseCase,
private val sendFeedbackEmailUseCase: SendFeedbackEmailUseCase,
private val appStoreOpener: AppStoreOpener,
private val multiNetworkStatusFetcher: MultiNetworkStatusFetcher,
private val multiQuoteStatusFetcher: MultiQuoteStatusFetcher,
private val multiStakingBalanceFetcher: MultiStakingBalanceFetcher,
@ -248,6 +252,10 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
}
}
override fun onSoftUpdateClick() {
appStoreOpener.openStorePage()
}
override fun onBackupErrorClick() {
val userWallet = getSelectedUserWallet() ?: return

View file

@ -145,6 +145,7 @@ internal class WalletWarningsAnalyticsSender @Inject constructor(
WalletNotificationUM.TangemPayUnreachable,
is WalletNotificationUM.YieldBoostPromo,
is WalletNotificationUM.AssetsDiscoveryCompleted,
is WalletNotificationUM.SoftUpdateAvailable,
-> null
}
}

View file

@ -5,6 +5,8 @@ import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.ui.ds.message.TangemMessageEffect
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.domain.account.status.producer.SingleAccountStatusListProducer
import com.tangem.domain.appupdate.model.AppUpdateState
import com.tangem.domain.appupdate.usecase.GetAppUpdateStateUseCase
import com.tangem.domain.assetsdiscovery.model.AssetsDiscoveryProgress
import com.tangem.domain.assetsdiscovery.usecase.ObserveAssetsDiscoveryUseCase
import com.tangem.domain.card.CardTypesResolver
@ -49,6 +51,7 @@ internal class GetWalletNotificationsFactory @Inject constructor(
private val getAccessCodeSkippedUseCase: GetAccessCodeSkippedUseCase,
private val hasSingleWalletSignedHashesUseCase: HasSingleWalletSignedHashesUseCase,
private val observeAssetsDiscoveryUseCase: ObserveAssetsDiscoveryUseCase,
private val getAppUpdateStateUseCase: GetAppUpdateStateUseCase,
) {
fun create(userWallet: UserWallet, clickIntents: WalletClickIntents): Flow<ImmutableList<WalletNotificationUM>> {
val cardTypesResolver = (userWallet as? UserWallet.Cold)?.scanResponse?.cardTypesResolver
@ -68,7 +71,8 @@ internal class GetWalletNotificationsFactory @Inject constructor(
flow2 = isNeedToBackupUseCase(userWallet.walletId).distinctUntilChanged(),
flow3 = getAccessCodeSkippedUseCase(userWallet.walletId).distinctUntilChanged(),
flow4 = assetsDiscoveryProgressFlow,
) { accountList, isNeedToBackup, shouldAccessCodeSkipped, assetsDiscoveryProgress ->
flow5 = getAppUpdateStateUseCase.getBannerStateFlow(),
) { accountList, isNeedToBackup, shouldAccessCodeSkipped, assetsDiscoveryProgress, appUpdateState ->
val totalFiatBalance = accountList.totalFiatBalance
val flattenCurrencies = accountList.flattenCurrencies()
@ -126,10 +130,22 @@ internal class GetWalletNotificationsFactory @Inject constructor(
walletClickIntents = clickIntents,
)
}
addSoftUpdateBanner(appUpdateState, clickIntents)
}.sortedBy { it.type.ordinal }.toImmutableList()
}
}
private fun MutableList<WalletNotificationUM>.addSoftUpdateBanner(
appUpdateState: AppUpdateState,
clickIntents: WalletClickIntents,
) {
addIf(
element = WalletNotificationUM.SoftUpdateAvailable(onUpdateClick = clickIntents::onSoftUpdateClick),
condition = appUpdateState == AppUpdateState.OptionalUpdate,
)
}
private fun MutableList<WalletNotificationUM>.addUsedOutdatedDataNotification(totalFiatBalance: TotalFiatBalance) {
addIf(
element = WalletNotificationUM.UsedOutdatedData,

View file

@ -352,6 +352,27 @@ internal sealed class WalletNotificationUM(val messageUM: TangemMessageUM, val t
),
type = WalletNotificationType.Warning,
)
data class SoftUpdateAvailable(val onUpdateClick: () -> Unit) : WalletNotificationUM(
messageUM = TangemMessageUM(
id = "SoftUpdateAvailableNotification",
title = resourceReference(id = CoreResR.string.force_update_banner_title),
subtitle = resourceReference(id = CoreResR.string.force_update_banner_message),
iconUM = TangemIconUM.Icon(
iconRes = R.drawable.ic_attention_default_24,
tintReference = { TangemTheme.colors2.graphic.status.attention },
),
messageEffect = TangemMessageEffect.Warning,
buttonsUM = persistentListOf(
TangemMessageButtonUM(
text = resourceReference(id = CoreResR.string.force_update_action),
type = TangemButtonType.Primary,
onClick = onUpdateClick,
),
),
),
type = WalletNotificationType.Warning,
)
// endregion
// region Promo