Updated on 2026-08-14

This commit is contained in:
Tangem 2024-09-12 12:23:56 +03:00
parent 9e74c7d2eb
commit c21f0374da
2 changed files with 25 additions and 7 deletions

View file

@ -683,6 +683,7 @@
<string name="staking_notification_earn_rewards_title">Earn staking rewards</string>
<string name="staking_notification_new_validator_funds_transfer">Staking in the %1$s network with a new validator will automatically transfer all previously staked funds to this validator</string>
<string name="staking_notification_restake_rewards_text">Reinvests your earned rewards in your staked amount, increasing potential earnings.</string>
<string name="staking_notification_unlock_text">Unlock your money to withdraw it from staking process. Unlocking takes %s.</string>
<string name="staking_notification_unstake_cosmos_text">Your funds will be available for use after the 21-day unbonding period. Reward will be withdrawn along with your unstaking funds.</string>
<string name="staking_notification_unstake_text">Your funds will be available for use after the %s unbonding period.</string>
<string name="staking_notification_withdraw_text">You can now withdraw your funds, it will be available to use immediately</string>

View file

@ -11,6 +11,7 @@ import com.tangem.common.ui.notifications.NotificationsFactory.addFeeUnreachable
import com.tangem.common.ui.notifications.NotificationsFactory.addReserveAmountErrorNotification
import com.tangem.common.ui.notifications.NotificationsFactory.addTransactionLimitErrorNotification
import com.tangem.common.ui.notifications.NotificationsFactory.addValidateTransactionNotifications
import com.tangem.core.ui.extensions.pluralReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.appcurrency.model.AppCurrency
@ -222,24 +223,40 @@ internal class AddStakingNotificationsTransformer(
else -> {
val confirmationState = prevState.confirmationState as? StakingStates.ConfirmationState.Data
val pendingActionType = confirmationState?.pendingAction?.type
val (titleId, textId) = when (pendingActionType) {
val (titleReference, textReference) = when (pendingActionType) {
StakingActionType.CLAIM_REWARDS -> {
R.string.common_claim to R.string.staking_notification_claim_rewards_text
resourceReference(R.string.common_claim) to
resourceReference(R.string.staking_notification_claim_rewards_text)
}
StakingActionType.RESTAKE_REWARDS -> {
R.string.staking_restake to R.string.staking_notification_restake_rewards_text
resourceReference(R.string.staking_restake) to
resourceReference(R.string.staking_notification_restake_rewards_text)
}
StakingActionType.WITHDRAW -> {
R.string.staking_withdraw to R.string.staking_notification_withdraw_text
resourceReference(R.string.staking_withdraw) to
resourceReference(R.string.staking_notification_withdraw_text)
}
StakingActionType.UNLOCK_LOCKED -> {
val cooldownPeriodDays = yield.metadata.cooldownPeriod.days
resourceReference(R.string.staking_unlocked_locked) to resourceReference(
R.string.staking_notification_unlock_text,
wrappedList(
pluralReference(
id = R.plurals.common_days,
count = cooldownPeriodDays,
formatArgs = wrappedList(cooldownPeriodDays),
),
),
)
}
else -> null to null
}
if (titleId != null && textId != null) {
if (titleReference != null && textReference != null) {
add(
StakingNotification.Info.PendingAction(
title = resourceReference(titleId),
text = resourceReference(textId),
title = titleReference,
text = textReference,
),
)
}