diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml index afc248155a..f753b2c756 100644 --- a/core/res/src/main/res/values-ja/strings.xml +++ b/core/res/src/main/res/values-ja/strings.xml @@ -90,6 +90,7 @@ %1$s ネットワークのトークンは、ファームウェアの制限により、このカードまたはリングではサポートされていません。 カードまたはリングのスキャンに問題がありますか? このカードはこのアプリでは使用できません。 + まずアクセスコードを設定してから、生体認証を有効にしてください %1$sを使用してウォレットのロックを解除し、取引の署名などの機密性の高い操作を承認してください。ハードウェアウォレットの場合は、署名にカードまたはリングが必要です。 デフォルト手数料 デフォルト手数料を有効にすると、取引手数料が自動的に設定され、送金時に手数料ページを表示する必要がなくなります。必要に応じて、いつでもこのページに戻ることができます。 diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml index 07f0ff53e5..4c5084da0c 100644 --- a/core/res/src/main/res/values-ru/strings.xml +++ b/core/res/src/main/res/values-ru/strings.xml @@ -1851,9 +1851,12 @@ Режим доходности Включение режима доходности Режим доходности - Доход включен - Доход выключен - Доход - пополнение + Режим доходности включен + %1$s отправлено в Aave + Режим доходности выключен + %1$s выведено из Aave + Перевод в Aave + %1$sотправлено в Aave Автоматически Внесите немного %1$s %2$s, чтобы покрыть комиссию сети за транзакции. Невозможно покрыть комиссию в %s diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index 5f5daffaf8..5971b8288b 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -1985,9 +1985,12 @@ Yield Mode Enabling Yield Mode Yield Mode - Yield Mode on - Yield Mode off - Yield Mode top-up + Yield Mode enabled + %1$s supplied to Aave + Yield Mode disabled + %1$s withdrawn from Aave + Supply to Aave + %1$s supplied to Aave Automatic Add some %1$s %2$s to cover the network fee for transactions. Unable to cover %s fee diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt index 761db501ac..53ec6c23b8 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt @@ -240,6 +240,8 @@ private fun Subtitle(state: TransactionState, modifier: Modifier = Modifier) { textAlign = TextAlign.Start, color = TangemTheme.colors.text.tertiary, style = TangemTheme.typography.caption2, + maxLines = 1, + overflow = TextOverflow.Ellipsis, ) } is TransactionState.Loading -> { diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/converter/TxHistoryItemToTransactionStateConverter.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/converter/TxHistoryItemToTransactionStateConverter.kt index c575a8070d..0fc75e0d67 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/converter/TxHistoryItemToTransactionStateConverter.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/converter/TxHistoryItemToTransactionStateConverter.kt @@ -27,7 +27,7 @@ internal class TxHistoryItemToTransactionStateConverter( txHash = value.txHash, amount = value.getAmount(), time = value.timestampInMillis.toTimeFormat(), - status = value.status.tiUiStatus(), + status = value.status.toUiStatus(), direction = value.extractDirection(), iconRes = value.extractIcon(), title = value.extractTitle(), @@ -41,21 +41,21 @@ internal class TxHistoryItemToTransactionStateConverter( R.drawable.ic_close_24 } else { when (type) { - is TxInfo.TransactionType.Approve -> R.drawable.ic_doc_24 - is TxInfo.TransactionType.Staking.Stake, - is TxInfo.TransactionType.Staking.Vote, - is TxInfo.TransactionType.Staking.Restake, + is TransactionType.Approve -> R.drawable.ic_doc_24 + is TransactionType.Staking.Stake, + is TransactionType.Staking.Vote, + is TransactionType.Staking.Restake, -> R.drawable.ic_transaction_history_staking_24 - is TxInfo.TransactionType.Staking.ClaimRewards, + is TransactionType.Staking.ClaimRewards, -> R.drawable.ic_transaction_history_claim_rewards_24 - is TxInfo.TransactionType.Staking.Unstake, - is TxInfo.TransactionType.Staking.Withdraw, + is TransactionType.Staking.Unstake, + is TransactionType.Staking.Withdraw, -> R.drawable.ic_transaction_history_unstaking_24 - is TxInfo.TransactionType.Operation, - is TxInfo.TransactionType.Swap, - is TxInfo.TransactionType.Transfer, - is TxInfo.TransactionType.YieldSupply, - is TxInfo.TransactionType.UnknownOperation, + is TransactionType.Operation, + is TransactionType.Swap, + is TransactionType.Transfer, + is TransactionType.YieldSupply, + is TransactionType.UnknownOperation, -> if (isOutgoing) R.drawable.ic_arrow_up_24 else R.drawable.ic_arrow_down_24 } } @@ -78,43 +78,67 @@ internal class TxHistoryItemToTransactionStateConverter( is TransactionType.UnknownOperation -> resourceReference(R.string.transaction_history_operation) } - private fun TxInfo.extractSubtitle(): TextReference = when (val interactionAddress = interactionAddressType) { - is TxInfo.InteractionAddressType.Contract -> resourceReference( - id = R.string.transaction_history_contract_address, - formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), - ) - is TxInfo.InteractionAddressType.Multiple -> resourceReference( - id = if (isOutgoing) { - R.string.transaction_history_transaction_to_address - } else { - R.string.transaction_history_transaction_from_address - }, - formatArgs = wrappedList(resourceReference(R.string.transaction_history_multiple_addresses)), - ) - is TxInfo.InteractionAddressType.User -> resourceReference( - id = if (isOutgoing) { - R.string.transaction_history_transaction_to_address - } else { - R.string.transaction_history_transaction_from_address - }, - formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), - ) - is TxInfo.InteractionAddressType.Validator -> resourceReference( - id = R.string.transaction_history_transaction_validator, - formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), - ) - null -> { - TextReference.EMPTY + private fun TxInfo.extractSubtitle(): TextReference { + return when (this.type) { + is TransactionType.YieldSupply.Enter -> { + val amount = amount.format { crypto(symbol = currency.symbol, decimals = currency.decimals) } + resourceReference(R.string.yield_module_transaction_enter_subtitle, wrappedList(amount)) + } + is TransactionType.YieldSupply.Topup, + -> { + val amount = amount.format { crypto(symbol = currency.symbol, decimals = currency.decimals) } + resourceReference(R.string.yield_module_transaction_topup_subtitle, wrappedList(amount)) + } + is TransactionType.YieldSupply.Exit -> { + val amount = amount.format { crypto(symbol = currency.symbol, decimals = currency.decimals) } + resourceReference(R.string.yield_module_transaction_exit_subtitle, wrappedList(amount)) + } + else -> extractSubtitleByAddressType() } } + private fun TxInfo.extractSubtitleByAddressType(): TextReference = + when (val interactionAddress = interactionAddressType) { + is TxInfo.InteractionAddressType.Contract -> resourceReference( + id = R.string.transaction_history_contract_address, + formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), + ) + is TxInfo.InteractionAddressType.Multiple -> resourceReference( + id = if (isOutgoing) { + R.string.transaction_history_transaction_to_address + } else { + R.string.transaction_history_transaction_from_address + }, + formatArgs = wrappedList(resourceReference(R.string.transaction_history_multiple_addresses)), + ) + is TxInfo.InteractionAddressType.User -> resourceReference( + id = if (isOutgoing) { + R.string.transaction_history_transaction_to_address + } else { + R.string.transaction_history_transaction_from_address + }, + formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), + ) + is TxInfo.InteractionAddressType.Validator -> resourceReference( + id = R.string.transaction_history_transaction_validator, + formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), + ) + null -> { + TextReference.EMPTY + } + } + private fun TxInfo.extractDirection() = if (isOutgoing) TransactionState.Content.Direction.OUTGOING else TransactionState.Content.Direction.INCOMING + @Suppress("ComplexCondition") private fun TxInfo.getAmount(): String { - if (type is TxInfo.TransactionType.Staking.Vote || - type == TxInfo.TransactionType.Staking.ClaimRewards || - type == TxInfo.TransactionType.Staking.Withdraw + if (type is TransactionType.Staking.Vote || + type == TransactionType.Staking.ClaimRewards || + type == TransactionType.Staking.Withdraw || + type == TransactionType.YieldSupply.Enter || + type == TransactionType.YieldSupply.Exit || + type == TransactionType.YieldSupply.Topup ) { return "" } @@ -126,7 +150,7 @@ internal class TxHistoryItemToTransactionStateConverter( return prefix + amount.format { crypto(symbol = currency.symbol, decimals = currency.decimals) } } - private fun TxInfo.TransactionStatus.tiUiStatus() = when (this) { + private fun TxInfo.TransactionStatus.toUiStatus() = when (this) { TxInfo.TransactionStatus.Confirmed -> TransactionState.Content.Status.Confirmed TxInfo.TransactionStatus.Failed -> TransactionState.Content.Status.Failed TxInfo.TransactionStatus.Unconfirmed -> TransactionState.Content.Status.Unconfirmed diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TxHistoryItemStateConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TxHistoryItemStateConverter.kt index be2bd415fe..db435626e8 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TxHistoryItemStateConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TxHistoryItemStateConverter.kt @@ -10,7 +10,8 @@ import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.format import com.tangem.core.ui.utils.toTimeFormat import com.tangem.domain.models.network.TxInfo -import com.tangem.domain.models.network.TxInfo.* +import com.tangem.domain.models.network.TxInfo.TransactionStatus +import com.tangem.domain.models.network.TxInfo.TransactionType import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents import com.tangem.feature.wallet.impl.R import com.tangem.utils.StringsSigns.MINUS @@ -85,36 +86,56 @@ internal class TxHistoryItemStateConverter( is TransactionType.UnknownOperation -> resourceReference(R.string.transaction_history_operation) } - private fun TxInfo.extractSubtitle(): TextReference = when (val interactionAddress = interactionAddressType) { - is InteractionAddressType.Contract -> resourceReference( - id = R.string.transaction_history_contract_address, - formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), - ) - is InteractionAddressType.Multiple -> resourceReference( - id = if (isOutgoing) { - R.string.transaction_history_transaction_to_address - } else { - R.string.transaction_history_transaction_from_address - }, - formatArgs = wrappedList(resourceReference(R.string.transaction_history_multiple_addresses)), - ) - is InteractionAddressType.User -> resourceReference( - id = if (isOutgoing) { - R.string.transaction_history_transaction_to_address - } else { - R.string.transaction_history_transaction_from_address - }, - formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), - ) - is InteractionAddressType.Validator -> resourceReference( - id = R.string.transaction_history_transaction_validator, - formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), - ) - null -> { - TextReference.EMPTY + private fun TxInfo.extractSubtitle(): TextReference { + return when (this.type) { + is TransactionType.YieldSupply.Enter -> { + val amount = amount.format { crypto(symbol = symbol, decimals = decimals) } + resourceReference(R.string.yield_module_transaction_enter_subtitle, wrappedList(amount)) + } + is TransactionType.YieldSupply.Topup, + -> { + val amount = amount.format { crypto(symbol = symbol, decimals = decimals) } + resourceReference(R.string.yield_module_transaction_topup_subtitle, wrappedList(amount)) + } + is TransactionType.YieldSupply.Exit -> { + val amount = amount.format { crypto(symbol = symbol, decimals = decimals) } + resourceReference(R.string.yield_module_transaction_exit_subtitle, wrappedList(amount)) + } + else -> extractSubtitleByAddressType() } } + private fun TxInfo.extractSubtitleByAddressType(): TextReference = + when (val interactionAddress = interactionAddressType) { + is TxInfo.InteractionAddressType.Contract -> resourceReference( + id = R.string.transaction_history_contract_address, + formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), + ) + is TxInfo.InteractionAddressType.Multiple -> resourceReference( + id = if (isOutgoing) { + R.string.transaction_history_transaction_to_address + } else { + R.string.transaction_history_transaction_from_address + }, + formatArgs = wrappedList(resourceReference(R.string.transaction_history_multiple_addresses)), + ) + is TxInfo.InteractionAddressType.User -> resourceReference( + id = if (isOutgoing) { + R.string.transaction_history_transaction_to_address + } else { + R.string.transaction_history_transaction_from_address + }, + formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), + ) + is TxInfo.InteractionAddressType.Validator -> resourceReference( + id = R.string.transaction_history_transaction_validator, + formatArgs = wrappedList(interactionAddress.address.toBriefAddressFormat()), + ) + null -> { + TextReference.EMPTY + } + } + private fun TxInfo.extractDirection() = if (isOutgoing) TransactionState.Content.Direction.OUTGOING else TransactionState.Content.Direction.INCOMING @@ -124,10 +145,14 @@ internal class TxHistoryItemStateConverter( TransactionStatus.Unconfirmed -> TransactionState.Content.Status.Unconfirmed } + @Suppress("ComplexCondition") private fun TxInfo.getAmount(): String { if (type is TransactionType.Staking.Vote || type == TransactionType.Staking.ClaimRewards || - type == TransactionType.Staking.Withdraw + type == TransactionType.Staking.Withdraw || + type == TransactionType.YieldSupply.Enter || + type == TransactionType.YieldSupply.Exit || + type == TransactionType.YieldSupply.Topup ) { return "" }