Skip to content

Commit 66adb33

Browse files
committed
chore(withdraw): localize token balances in select screen
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent d69acb6 commit 66adb33

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

apps/flipcash/features/withdrawal/src/main/kotlin/com/flipcash/app/withdrawal/WithdrawalViewModel.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,19 @@ internal class WithdrawalViewModel @Inject constructor(
240240
exchange.observePreferredRate(),
241241
) { tokens, balance, rate ->
242242
val token = tokens.find { it.address == tokenAddress } ?: return@combine null
243+
val tokenName = when (token.address) {
244+
Mint.usdc -> {
245+
resources.getString(R.string.displayName_usdc)
246+
}
247+
Mint.usdf -> {
248+
resources.getString(R.string.displayName_usdf)
249+
}
250+
else -> token.name
251+
}
243252
TokenWithBalance(
244253
token = token,
245254
balance = balance.convertingTo(rate),
246-
displayName = if (token.address == Mint.usdf) {
247-
resources.getString(R.string.displayName_usdc)
248-
} else {
249-
token.name
250-
}
255+
displayName = tokenName,
251256
)
252257
}
253258
}.filterNotNull()

apps/flipcash/shared/tokens/src/main/kotlin/com/flipcash/app/tokens/ui/SelectTokenViewModel.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ class SelectTokenViewModel @Inject constructor(
101101
combine(
102102
stateFlow,
103103
tokenCoordinator.tokenBalances,
104-
when (purpose) {
105-
TokenPurpose.Withdraw -> flowOf(exchange.rateForUsd())
106-
else -> exchange.observePreferredRate()
107-
}
104+
exchange.observePreferredRate()
108105
) { state, balances, rate ->
109106
dispatchEvent(Event.OnRateChanged(rate))
110107
balances

0 commit comments

Comments
 (0)