Updated on 2026-08-14

This commit is contained in:
Tangem 2024-07-31 12:24:03 +05:00
parent dcc3bb6c97
commit d42a9d5b46
5 changed files with 51 additions and 40 deletions

View file

@ -13,6 +13,9 @@
<string name="alert_manage_tokens_unsupported_blockchain_by_card_message">The selected does not support the %1$s network</string>
<string name="alert_manage_tokens_unsupported_curve_message">To activate the %1$s blockchain\'s cryptographic encryption, you\'ll need to reset the wallet to factory settings. Please withdraw your funds before doing so to ensure that you don\'t lose them, and then complete the reset process. Access to the current wallet will not be possible after the reset.</string>
<string name="alert_manage_tokens_unsupported_message">Tokens in %1$s network are not supported by this card due to firmware limitation.</string>
<string name="alert_negative_app_rate_sent_message">Thank you for your feedback. We will respond as soon as possible</string>
<string name="alert_negative_app_rate_sent_title">Your suggestions were sent</string>
<string name="alert_troubleshooting_scan_card_message">Please try to tap the card exactly as shown in the animation or read our simple guide, or request support. If the problem persists, please request support.</string>
<string name="alert_troubleshooting_scan_card_title">Are you having difficulty scanning your card?</string>
<string name="alert_unsupported_card">This card is not designed to work with this app</string>
<string name="app_settings_default_fee">Default Fee</string>
@ -28,6 +31,8 @@
<string name="app_settings_theme_mode_dark">Dark</string>
<string name="app_settings_theme_mode_light">Light</string>
<string name="app_settings_theme_mode_system">System default</string>
<string name="app_settings_theme_selection_footer">If system is selected, the app will auto-adjust based on your device\'s system settings</string>
<string name="app_settings_theme_selection_system_short">System</string>
<string name="app_settings_theme_selector_title">Theme</string>
<string name="app_settings_title">App settings</string>
<string name="balance_hidden_description">To hide or show your balances, simply flip your device screen down, or switch it off in Settings</string>
@ -39,7 +44,7 @@
<string name="biometric_lockout_warning_title">Too many attempts</string>
<string name="biometric_unavailable_warning">You have disabled biometric authentication on your phone and will not be able to save wallets in the app. To save wallets, please enable the biometric authentication function in your phone settings.</string>
<string name="button_start_backup_process">Start backup process</string>
<string name="buy_token_description">From your fiat card or bank account</string>
<string name="buy_token_description">With your bank card or bank account</string>
<plurals name="card_label_card_count">
<item quantity="one">%d card</item>
<item quantity="other">%d cards</item>
@ -95,6 +100,7 @@
</plurals>
<string name="common_delete">Delete</string>
<string name="common_disabled">Disabled</string>
<string name="common_disconnect">Disconnect</string>
<string name="common_done">Done</string>
<string name="common_enable">Enable</string>
<string name="common_enabled">Enabled</string>
@ -110,6 +116,7 @@
<string name="common_fee_selector_title">Speed and fee</string>
<string name="common_generate_addresses">Get addresses</string>
<string name="common_go_to_provider">Go to provider</string>
<string name="common_go_to_token">Go to token</string>
<string name="common_import">Import</string>
<string name="common_later">Later</string>
<string name="common_locked">Locked</string>
@ -130,6 +137,7 @@
<string name="common_reject">Reject</string>
<string name="common_reload">Reload</string>
<string name="common_rename">Rename</string>
<string name="common_retry">Retry</string>
<string name="common_save">Save</string>
<string name="common_save_changes">Save changes</string>
<string name="common_search">Search</string>
@ -158,6 +166,7 @@
<string name="common_unknown_error">There was an error. Please try again.</string>
<string name="common_unreachable">Unreachable</string>
<string name="common_unstake">Unstake</string>
<string name="common_warning">Warning</string>
<string name="common_yes">Yes</string>
<string name="contract_address_copied_message">Contract address copied!</string>
<string name="currency_subtitle_expanded">Available networks</string>
@ -205,6 +214,7 @@
<string name="details_row_title_flip_to_hide">Flip-to-Hide Balances</string>
<string name="details_row_title_issuer">Issuer</string>
<string name="details_row_title_signed_hashes">Signed</string>
<string name="details_security_management_warning">If you forget the code you will lose access to your funds. Code recovery is not possible.</string>
<string name="details_send_feedback">Send feedback</string>
<string name="details_title">Details</string>
<string name="disclaimer_error_loading">Check your internet connection or switch to a different network</string>
@ -225,6 +235,8 @@
<string name="express_exchange_by">Exchange by %s</string>
<string name="express_exchange_notification_failed_text">Visit providers website to refund your money</string>
<string name="express_exchange_notification_failed_title">Operation failed by provider</string>
<string name="express_exchange_notification_refund_text">The transaction amount was refunded in %1$s to your wallet due to OKX or bridge rules. %2$s</string>
<string name="express_exchange_notification_refund_title">The amount was refunded in %1$s (%2$s network)</string>
<string name="express_exchange_notification_verification_text">Visit providers website for verification</string>
<string name="express_exchange_notification_verification_title">KYC verification required by provider</string>
<string name="express_exchange_status_canceled">Canceled</string>
@ -264,7 +276,7 @@
<string name="express_token_list_empty_search">No tokens found. Please try another request</string>
<string name="express_transaction_id">ID: %s</string>
<string name="express_transaction_id_copied">Transaction ID copied</string>
<string name="exсhange_token_description">From another currency in your wallet</string>
<string name="exсhange_token_description">With another currency in your wallet</string>
<string name="feedback_data_collection_message">The following information is optional. You can erase it if you don\'t want to share it.</string>
<string name="feedback_preface_rate_negative">Tell us what functions you are missing, and we will try to help you.</string>
<string name="feedback_preface_scan_failed">Please tell us what card do you have</string>
@ -338,7 +350,7 @@
<string name="markets_available_networks">Available networks</string>
<string name="markets_common_my_portfolio">My portfolio</string>
<string name="markets_common_title">Market</string>
<string name="markets_generate_addresses_notification">To generate addresses for selected networks, you need to attach a Tangem card</string>
<string name="markets_generate_addresses_notification">To generate addresses for selected networks, you must scan your Tangem Wallet card.</string>
<string name="markets_loading_error_title">Unable to load the data…</string>
<string name="markets_quick_actions">Quick actions</string>
<string name="markets_search_result_title">Result</string>
@ -499,7 +511,7 @@
<string name="qr_scanner_camera_denied_title">Camera access denied</string>
<string name="receive_bottom_sheet_warning_message">%1$s (%2$s) on %3$s network</string>
<string name="receive_bottom_sheet_warning_message_full">Send only %s to this address. Sending any other currency will result in its irreversible loss.</string>
<string name="receive_token_description">Show QR-code or share your address</string>
<string name="receive_token_description">Show a QR-code or share your address</string>
<string name="referral_button_participate">Participate</string>
<string name="referral_error_failed_to_load_info">Failed to load the information about the referral program. Please try again later.</string>
<string name="referral_error_failed_to_load_info_with_reason">Failed to load the information about the referral program. Error code: %s. Please try again later.</string>
@ -565,6 +577,7 @@
<string name="send_date_format">%1$s, %2$s</string>
<string name="send_destination_hint_address">Address</string>
<string name="send_destination_tag_field">Destination Tag</string>
<string name="send_dismiss_message">Are you sure you want to close the send screen?</string>
<string name="send_enter_address_field">Enter address</string>
<string name="send_error_address_same_as_wallet">Address is the same as wallet address</string>
<string name="send_extras_error_invalid_destination_tag">Invalid Tag. It won\'t be added to the transaction.</string>
@ -629,7 +642,7 @@
<string name="send_total_subtitle_fiat_format">≈ %1$s (inc. fee: %2$s)</string>
<string name="send_total_subtitle_format">%s will be sent</string>
<string name="send_transaction_success">Transaction has been successfully signed and sent to the blockchain node. Wallet balance will be updated in a while</string>
<string name="send_tron_account_activation_error">%1$s is an asset in the Tron network. To calculate the fee and make a transaction you need to deposit some Tron(TRX) in your account.</string>
<string name="send_tron_account_activation_error">%1$s is an asset in the Tron network. To calculate the fee and make a transaction you need to deposit some Tron (TRX) in your account.</string>
<string name="send_validation_invalid_address">Invalid address</string>
<string name="send_wallet_balance_format">%1$s (%2$s)</string>
<string name="sent_transaction_sent_title">Transaction sent</string>
@ -661,13 +674,15 @@
<string name="staking_details_unbonding_period_info">The period you must wait after requesting to withdraw funds from staking before the tokens become available.</string>
<string name="staking_details_warmup_period">Warmup period</string>
<string name="staking_details_warmup_period_info">The allocated time for activating participation in staking.</string>
<string name="staking_initial_info_title">Stake %s</string>
<string name="staking_native">Native staking</string>
<string name="staking_notification_earn_rewards_text" formatted="false">Staking allow you to earn %1s. Your staking rewards arrive every ~%2s days.</string>
<string name="staking_notification_earn_rewards_title">Earn staking rewards</string>
<string name="staking_rewards">Rewards</string>
<string name="staking_stake_more">Stake more</string>
<string name="staking_unstaked">Unstacked</string>
<string name="staking_unstaked">Unstaked</string>
<string name="staking_unstaked_footer">Check unstaked to claim your assets</string>
<string name="staking_unstaking">Unstaking</string>
<string name="staking_validator">Validator</string>
<string name="story_awe_description">Store your crypto assets secure while keeping private keys contained in your card</string>
<string name="story_awe_title">Revolutionary Hardware Wallet</string>
@ -709,6 +724,7 @@
<string name="token_button_unavailability_reason_pending_transaction_send">Sending funds will be available once the pending transaction(s) in network %s is complete</string>
<string name="token_button_unavailability_reason_sell_unavailable">Selling %s is not available at the moment. Please check our updates.</string>
<string name="token_button_unavailability_reason_staking_unavailable">Staking %s is not available at the moment. Please check our updates.</string>
<string name="token_details_choose_address">Choose address</string>
<string name="token_details_generate_xpub">Generate XPUB</string>
<string name="token_details_hide_alert_hide">Hide</string>
<string name="token_details_hide_alert_message">You are about to hide this token from the main screen. You can add it back anytime through the manage tokens page.</string>

View file

@ -1,6 +1,7 @@
package com.tangem.features.staking.impl.presentation.state
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.staking.model.stakekit.BalanceType
import com.tangem.domain.staking.model.stakekit.PendingAction
import com.tangem.domain.staking.model.stakekit.Yield
import kotlinx.collections.immutable.ImmutableList
@ -21,7 +22,8 @@ data class BalanceGroupedState(
val items: ImmutableList<BalanceState>,
val footer: TextReference?,
val title: TextReference,
val type: BalanceGroupType,
val type: BalanceType,
val isClickable: Boolean,
)
data class BalanceState(
@ -33,10 +35,4 @@ data class BalanceState(
val rawCurrencyId: String?,
val unbondingPeriod: TextReference,
val pendingActions: ImmutableList<PendingAction>,
)
enum class BalanceGroupType {
ACTIVE,
UNSTAKED,
UNKNOWN,
}
)

View file

@ -10,7 +10,6 @@ import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.staking.model.stakekit.*
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.features.staking.impl.R
import com.tangem.features.staking.impl.presentation.state.BalanceGroupType
import com.tangem.features.staking.impl.presentation.state.BalanceGroupedState
import com.tangem.features.staking.impl.presentation.state.BalanceState
import com.tangem.features.staking.impl.presentation.state.InnerYieldBalanceState
@ -59,12 +58,14 @@ internal class YieldBalancesConverter(
.groupBy { it.type.toGroup() }
.mapNotNull { item ->
val (title, footer) = getGroupTitle(item.key)
val isClickable = getClickableType(item.key)
title?.let {
BalanceGroupedState(
items = item.value.mapBalances().toPersistentList(),
footer = footer,
title = it,
type = item.key,
isClickable = isClickable,
)
}
}
@ -111,31 +112,25 @@ internal class YieldBalancesConverter(
}
private fun BalanceType.toGroup() = when (this) {
BalanceType.PREPARING,
BalanceType.STAKED,
BalanceType.AVAILABLE,
BalanceType.LOCKED,
-> BalanceGroupType.ACTIVE
BalanceType.UNSTAKING,
BalanceType.UNLOCKING,
BalanceType.UNSTAKED,
-> BalanceGroupType.UNSTAKED
BalanceType.REWARDS,
BalanceType.UNKNOWN,
-> BalanceGroupType.UNKNOWN
-> BalanceType.UNKNOWN
else -> this
}
private fun getGroupTitle(type: BalanceGroupType) = when (type) {
BalanceGroupType.ACTIVE -> resourceReference(
R.string.staking_active,
) to resourceReference(
R.string.staking_active_footer,
)
BalanceGroupType.UNSTAKED -> resourceReference(
R.string.staking_unstaked,
) to resourceReference(
R.string.staking_unstaked_footer,
)
BalanceGroupType.UNKNOWN -> null to null
private fun getGroupTitle(type: BalanceType) = when (type) {
BalanceType.STAKED -> resourceReference(R.string.staking_active) to
resourceReference(R.string.staking_active_footer)
BalanceType.UNSTAKED -> resourceReference(R.string.staking_unstaked) to
resourceReference(R.string.staking_unstaked_footer)
BalanceType.UNSTAKING -> resourceReference(R.string.staking_unstaking) to null
else -> null to null
}
private fun getClickableType(type: BalanceType) = when (type) {
BalanceType.STAKED,
BalanceType.UNSTAKED,
-> true
else -> false
}
}

View file

@ -3,6 +3,7 @@ package com.tangem.features.staking.impl.presentation.state.previewdata
import com.tangem.core.ui.components.list.RoundedListWithDividersItemData
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.domain.staking.model.stakekit.BalanceType
import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.features.staking.impl.R
import com.tangem.features.staking.impl.presentation.state.*
@ -68,7 +69,8 @@ internal object InitialStakingStatePreview {
BalanceGroupedState(
title = stringReference("Staked"),
footer = null,
type = BalanceGroupType.ACTIVE,
type = BalanceType.STAKED,
isClickable = true,
items = persistentListOf(
BalanceState(
cryptoValue = "100",

View file

@ -31,6 +31,7 @@ import com.tangem.core.ui.extensions.*
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.utils.BigDecimalFormatter
import com.tangem.domain.staking.model.stakekit.BalanceType
import com.tangem.features.staking.impl.R
import com.tangem.features.staking.impl.presentation.state.*
import com.tangem.features.staking.impl.presentation.state.previewdata.InitialStakingStatePreview
@ -210,7 +211,7 @@ private fun ActiveStakingBlock(groups: List<BalanceGroupedState>, onClick: (Bala
) {
group.items.forEachIndexed { index, balance ->
key(balance.validator.address) {
val caption = if (group.type == BalanceGroupType.UNSTAKED) {
val caption = if (group.type == BalanceType.UNSTAKING) {
combinedReference(
resourceReference(R.string.staking_details_unbonding_period),
annotatedReference {
@ -240,13 +241,14 @@ private fun ActiveStakingBlock(groups: List<BalanceGroupedState>, onClick: (Bala
title = group.title.takeIf { index == 0 },
subtitle = stringReference(balance.validator.name),
caption = caption,
isGrayscaleImage = group.type == BalanceGroupType.UNSTAKED,
isGrayscaleImage = group.type == BalanceType.UNSTAKING,
infoTitle = balance.fiatAmount,
infoSubtitle = balance.cryptoAmount,
imageUrl = balance.validator.image.orEmpty(),
modifier = Modifier.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(),
enabled = group.isClickable,
onClick = { onClick(balance) },
),
)