Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-25 17:45:06 +05:00
parent 2fd5e123a5
commit 774f25bf4a
13 changed files with 389 additions and 85 deletions

View file

@ -151,13 +151,14 @@ sealed class WalletNotification(val config: NotificationConfig) {
)
data class TangemPayRefreshNeeded(
@DrawableRes val tangemIcon: Int?,
val onRefreshClick: () -> Unit,
@DrawableRes private val tangemIcon: Int?,
private val onRefreshClick: () -> Unit,
private val buttonText: TextReference,
) : Warning(
title = resourceReference(id = R.string.tangempay_payment_account_sync_needed),
subtitle = resourceReference(id = R.string.tangempay_use_tangem_device_to_restore_payment_account),
buttonsState = ButtonsState.PrimaryButtonConfig(
text = resourceReference(id = R.string.home_button_scan),
text = buttonText,
iconResId = tangemIcon,
onClick = onRefreshClick,
),

View file

@ -1,5 +1,7 @@
package com.tangem.feature.wallet.presentation.wallet.state.transformers
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.wallet.state.model.TangemPayState
@ -8,6 +10,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
internal class TangemPayRefreshNeededStateTransformer(
userWalletId: UserWalletId,
private val userWallet: UserWallet,
private val onRefreshClick: () -> Unit,
) : WalletStateTransformer(userWalletId = userWalletId) {
@ -15,6 +18,10 @@ internal class TangemPayRefreshNeededStateTransformer(
val tangemPayState = TangemPayState.RefreshNeeded(
notification = TangemPayRefreshNeeded(
tangemIcon = R.drawable.ic_tangem_24,
buttonText = when (userWallet) {
is UserWallet.Cold -> resourceReference(id = R.string.home_button_scan)
is UserWallet.Hot -> resourceReference(id = R.string.tangempay_sync_needed_restore_access)
},
onRefreshClick = onRefreshClick,
),
)

View file

@ -46,6 +46,7 @@ internal class TangemPayMainSubscriber @AssistedInject constructor(
stateController.update(
transformer = TangemPayRefreshNeededStateTransformer(
userWalletId = userWalletId,
userWallet = userWallet,
onRefreshClick = { clickIntents.onRefreshPayToken(userWalletId) },
),
)

View file

@ -68,6 +68,7 @@ private fun TangemPayRefreshBlockPreview() {
state = TangemPayState.RefreshNeeded(
TangemPayRefreshNeeded(
tangemIcon = R.drawable.ic_tangem_24,
buttonText = resourceReference(id = R.string.tangempay_sync_needed_restore_access),
onRefreshClick = {},
),
),