Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-27 12:26:22 +05:00
parent 28501aee2e
commit be6caf0e4d
6 changed files with 7 additions and 0 deletions

View file

@ -97,6 +97,7 @@ internal sealed class SendStates {
val walletBalance: TextReference,
val tokenIconState: TokenIconState,
val segmentedButtonConfig: PersistentList<SendAmountSegmentedButtonsConfig>,
val selectedButton: Int,
val isSegmentedButtonsEnabled: Boolean,
val amountTextField: SendTextField.AmountField,
val appCurrencyCode: String,

View file

@ -38,6 +38,7 @@ internal class SendAmountCurrencyConverter(
keyboardType = KeyboardType.Number,
),
),
selectedButton = amountState.segmentedButtonConfig.indexOfFirst { it.isFiat == value },
),
)
}

View file

@ -57,6 +57,7 @@ internal class SendAmountStateConverter(
),
),
isSegmentedButtonsEnabled = !noFeeRate,
selectedButton = 0,
)
}
}

View file

@ -49,6 +49,7 @@ internal object AmountStatePreviewData {
onValuePastedTriggerDismiss = {},
),
isSegmentedButtonsEnabled = true,
selectedButton = 0,
)
val fiatAmountState = amountState.copy(

View file

@ -29,6 +29,7 @@ internal fun LazyListScope.buttons(
segmentedButtonConfig: PersistentList<SendAmountSegmentedButtonsConfig>,
clickIntents: SendClickIntents,
isSegmentedButtonsEnabled: Boolean,
selectedButton: Int,
) {
item(
key = AMOUNT_BUTTONS_KEY,
@ -48,6 +49,7 @@ internal fun LazyListScope.buttons(
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
clickIntents.onCurrencyChangeClick(it.isFiat)
},
initialSelectedItem = segmentedButtonConfig.getOrNull(selectedButton),
isEnabled = isSegmentedButtonsEnabled,
) {
SendAmountCurrencyButton(

View file

@ -36,6 +36,7 @@ internal fun SendAmountContent(
segmentedButtonConfig = amountState.segmentedButtonConfig,
clickIntents = clickIntents,
isSegmentedButtonsEnabled = amountState.isSegmentedButtonsEnabled,
selectedButton = amountState.selectedButton,
)
}
}