Skip to content

Commit 4ff5b37

Browse files
committed
fix: routing fee ui text
1 parent 7d16b0a commit 4ff5b37

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -367,26 +367,21 @@ private fun OnChainDescription(
367367
tint = fee.color,
368368
modifier = Modifier.size(16.dp)
369369
)
370-
when (val stateFee = uiState.fee) {
371-
is SendFee.OnChain -> {
372-
if (stateFee.value > 0) {
373-
val feeText = let {
374-
val prefix = stringResource(fee.title)
375-
val value = rememberMoneyText(stateFee.value)
376-
"$prefix ($value)"
377-
}
378-
BodySSB(
379-
text = feeText.withAccent(accentColor = Colors.White),
380-
maxLines = 1,
381-
overflow = TextOverflow.MiddleEllipsis,
382-
)
383-
} else {
384-
CircularProgressIndicator(Modifier.size(14.dp), Colors.White64, 2.dp)
370+
(uiState.fee as? SendFee.OnChain)?.value
371+
?.takeIf { it > 0 }
372+
?.let { feeSat ->
373+
val feeText = let {
374+
val prefix = stringResource(fee.title)
375+
val value = rememberMoneyText(feeSat, showSymbol = true)
376+
"$prefix ($value)"
385377
}
378+
BodySSB(
379+
text = feeText.withAccent(accentColor = Colors.White),
380+
maxLines = 1,
381+
overflow = TextOverflow.MiddleEllipsis,
382+
)
386383
}
387-
388-
else -> CircularProgressIndicator(Modifier.size(14.dp), Colors.White64, 2.dp)
389-
}
384+
?: CircularProgressIndicator(Modifier.size(14.dp), Colors.White64, 2.dp)
390385
Icon(
391386
painterResource(R.drawable.ic_pencil_simple),
392387
contentDescription = null,
@@ -484,20 +479,20 @@ private fun LightningDescription(
484479
tint = Colors.Purple,
485480
modifier = Modifier.size(16.dp)
486481
)
487-
when (val fee = uiState.fee) {
488-
is SendFee.Lightning -> {
489-
val feeText = if (fee.value > 0) rememberMoneyText(fee.value) else null
482+
(uiState.fee as? SendFee.Lightning)?.value
483+
?.takeIf { it > 0 }
484+
?.let { feeSat ->
485+
val feeText = let {
486+
val prefix = stringResource(R.string.fee__instant__title)
487+
val value = rememberMoneyText(feeSat, showSymbol = true)
488+
"$prefix$value)"
489+
}
490490
BodySSB(
491-
text = if (feeText != null) {
492-
"${stringResource(R.string.fee__instant__title)} ($feeText)"
493-
} else {
494-
stringResource(R.string.fee__instant__title)
495-
}
491+
text = feeText.withAccent(accentColor = Colors.White),
492+
maxLines = 1,
493+
overflow = TextOverflow.MiddleEllipsis,
496494
)
497-
}
498-
499-
else -> BodySSB(text = stringResource(R.string.fee__instant__title))
500-
}
495+
} ?: BodySSB(text = stringResource(R.string.fee__instant__title))
501496
}
502497
Spacer(modifier = Modifier.weight(1f))
503498
HorizontalDivider(modifier = Modifier.padding(vertical = 16.dp))
@@ -572,7 +567,7 @@ private fun PreviewOnChain() {
572567
uiState = sendUiState().copy(
573568
selectedTags = listOf("car", "house", "uber"),
574569
fee = SendFee.OnChain(1_234),
575-
speed = TransactionSpeed.Fast,
570+
speed = TransactionSpeed.Medium,
576571
),
577572
isLoading = false,
578573
showBiometrics = false,

0 commit comments

Comments
 (0)