Updated on 2026-08-14
This commit is contained in:
parent
5f619a56fe
commit
9a0fbcbe1b
22 changed files with 324 additions and 254 deletions
|
|
@ -127,24 +127,6 @@ class AccountCryptoPortfolioItemStateConverter(
|
|||
isFlickering = this.source.isFlickering(),
|
||||
)
|
||||
|
||||
private fun createFiatAmountState(fiatBalance: TotalFiatBalance, appCurrency: AppCurrency): FiatAmountState {
|
||||
return when (fiatBalance) {
|
||||
TotalFiatBalance.Failed,
|
||||
TotalFiatBalance.Loading,
|
||||
-> FiatAmountState.Empty
|
||||
|
||||
is TotalFiatBalance.Loaded -> FiatAmountState.Content(
|
||||
text = fiatBalance.amount.format {
|
||||
fiat(
|
||||
fiatCurrencyCode = appCurrency.code,
|
||||
fiatCurrencySymbol = appCurrency.symbol,
|
||||
)
|
||||
},
|
||||
isFlickering = fiatBalance.source == StatusSource.CACHE,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSubtitle2State(priceChangeLce: Lce<Unit, PriceChange>?): Subtitle2State? {
|
||||
return priceChangeLce?.fold(
|
||||
ifLoading = { priceChange -> priceChange?.toSubtitle2State() ?: Subtitle2State.Loading },
|
||||
|
|
@ -152,4 +134,24 @@ class AccountCryptoPortfolioItemStateConverter(
|
|||
ifContent = { priceChange -> priceChange.toSubtitle2State() },
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun createFiatAmountState(fiatBalance: TotalFiatBalance, appCurrency: AppCurrency): FiatAmountState {
|
||||
return when (fiatBalance) {
|
||||
TotalFiatBalance.Failed,
|
||||
TotalFiatBalance.Loading,
|
||||
-> FiatAmountState.Empty
|
||||
|
||||
is TotalFiatBalance.Loaded -> FiatAmountState.Content(
|
||||
text = fiatBalance.amount.format {
|
||||
fiat(
|
||||
fiatCurrencyCode = appCurrency.code,
|
||||
fiatCurrencySymbol = appCurrency.symbol,
|
||||
)
|
||||
},
|
||||
isFlickering = fiatBalance.source == StatusSource.CACHE,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue