Skip to content

Commit 1f2f730

Browse files
authored
Merge pull request #673 from code-payments/style/withdrawal-receipt-string-resources
chore(withdrawal): always show token "amount in" on receipt regardless of token type
2 parents 31e4fe6 + 645ec0a commit 1f2f730

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

apps/flipcash/core/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,4 +628,8 @@
628628
<string name="description_withdrawUsdfAsUsdc">Your USDF will be converted 1:1 to Solana USDC on withdrawal</string>
629629
<string name="displayName_solanaUsdc">Solana USDC</string>
630630
<string name="displayName_usdc">USDC</string>
631+
<string name="label_withdrawalAmount">Withdrawal amount</string>
632+
<string name="label_lessFee">Less fee</string>
633+
<string name="label_netAmount">Net amount</string>
634+
<string name="label_amountInToken">Amount in %1$s</string>
631635
</resources>

apps/flipcash/features/withdrawal/src/main/kotlin/com/flipcash/app/withdrawal/internal/components/TransactionReceipt.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import androidx.compose.foundation.layout.Column
77
import androidx.compose.foundation.layout.PaddingValues
88
import androidx.compose.foundation.layout.fillMaxWidth
99
import androidx.compose.foundation.layout.padding
10-
import androidx.compose.material.Text
10+
import androidx.compose.material3.Text
1111
import androidx.compose.runtime.Composable
1212
import androidx.compose.runtime.CompositionLocalProvider
1313
import androidx.compose.runtime.derivedStateOf
@@ -126,14 +126,14 @@ private fun LineItems(
126126
) {
127127
ReceiptLineItem(
128128
modifier = Modifier.fillMaxWidth(),
129-
label = AnnotatedString("Withdrawal amount"),
129+
label = AnnotatedString(stringResource(R.string.label_withdrawalAmount)),
130130
amount = tokenWithBalance.balance.formatted()
131131
)
132132

133133
if (fee != null) {
134134
ReceiptLineItem(
135135
modifier = Modifier.fillMaxWidth(),
136-
label = AnnotatedString("Less fee"),
136+
label = AnnotatedString(stringResource(R.string.label_lessFee)),
137137
amount = fee.formatted(extraPrefix = "-"),
138138
)
139139

@@ -143,20 +143,20 @@ private fun LineItems(
143143

144144
ReceiptLineItem(
145145
modifier = Modifier.fillMaxWidth(),
146-
label = AnnotatedString("Net amount"),
146+
label = AnnotatedString(stringResource(R.string.label_netAmount)),
147147
amount = netAmount
148148
)
149149
}
150150

151-
if (tokenWithBalance.token.address != Mint.usdf) {
152-
val exchange = LocalExchange.current
153-
ReceiptLineItem(
154-
modifier = Modifier.fillMaxWidth(),
155-
label = AnnotatedString("Amount in ${tokenWithBalance.displayName}"),
156-
amount = transferAmount.convertingToUsdIfNeeded(exchange.entryRate)
157-
.estimatedTokenAmountIn(tokenWithBalance.token, fractionDigits = 2),
158-
)
159-
}
151+
val exchange = LocalExchange.current
152+
ReceiptLineItem(
153+
modifier = Modifier.fillMaxWidth(),
154+
label = AnnotatedString(
155+
stringResource(R.string.label_amountInToken, tokenWithBalance.displayName)
156+
),
157+
amount = transferAmount.convertingToUsdIfNeeded(exchange.entryRate)
158+
.estimatedTokenAmountIn(tokenWithBalance.token, fractionDigits = 2),
159+
)
160160
}
161161
}
162162

apps/flipcash/features/withdrawal/src/main/kotlin/com/flipcash/app/withdrawal/internal/confirmation/WithdrawalConfirmationScreen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private fun WithdrawalConfirmationScreenContent(
7474
tokenWithBalance = TokenWithBalance(
7575
state.token!!.token,
7676
balance = state.amountEntryState.selectedAmount.localFiat.nativeAmount,
77+
displayName = state.token.displayName
7778
),
7879
destination = state.destinationState.textFieldState.text.toString(),
7980
fee = state.feeInEntryCurrency,

0 commit comments

Comments
 (0)