Updated on 2026-08-14
This commit is contained in:
parent
2357aa509f
commit
c03ab1bfb2
8 changed files with 127 additions and 33 deletions
|
|
@ -10,7 +10,7 @@ data class TotalBalance(
|
|||
) {
|
||||
enum class State {
|
||||
Loading,
|
||||
Failed,
|
||||
Success
|
||||
SomeTokensFailed,
|
||||
Success,
|
||||
}
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ class OnWalletLoadedReducer {
|
|||
BalanceStatus.Unreachable,
|
||||
BalanceStatus.NoAccount,
|
||||
BalanceStatus.EmptyCard,
|
||||
BalanceStatus.UnknownBlockchain -> TotalBalance.State.Failed
|
||||
BalanceStatus.UnknownBlockchain -> TotalBalance.State.SomeTokensFailed
|
||||
BalanceStatus.Loading,
|
||||
null -> TotalBalance.State.Loading
|
||||
}
|
||||
|
|
@ -225,13 +225,13 @@ class OnWalletLoadedReducer {
|
|||
return when (this) {
|
||||
TotalBalance.State.Loading -> when (newState) {
|
||||
TotalBalance.State.Loading -> this
|
||||
TotalBalance.State.Failed,
|
||||
TotalBalance.State.SomeTokensFailed,
|
||||
TotalBalance.State.Success -> newState
|
||||
}
|
||||
TotalBalance.State.Success,
|
||||
TotalBalance.State.Failed -> when (newState) {
|
||||
TotalBalance.State.SomeTokensFailed -> when (newState) {
|
||||
TotalBalance.State.Loading,
|
||||
TotalBalance.State.Failed -> newState
|
||||
TotalBalance.State.SomeTokensFailed -> newState
|
||||
TotalBalance.State.Success -> this
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
package com.tangem.tap.features.wallet.ui.wallet
|
||||
|
||||
import android.app.Dialog
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.tangem.common.card.Card
|
||||
import com.tangem.domain.common.TapWorkarounds.derivationStyle
|
||||
import com.tangem.domain.common.TapWorkarounds.isTestCard
|
||||
import com.tangem.tap.common.extensions.formatAmountAsSpannedString
|
||||
import com.tangem.tap.common.extensions.hide
|
||||
import com.tangem.tap.common.extensions.show
|
||||
import com.tangem.tap.common.extensions.*
|
||||
import com.tangem.tap.common.redux.StateDialog
|
||||
import com.tangem.tap.common.redux.navigation.AppScreen
|
||||
import com.tangem.tap.common.redux.navigation.NavigationAction
|
||||
|
|
@ -135,10 +134,29 @@ class MultiWalletView : WalletView {
|
|||
binding: FragmentWalletBinding,
|
||||
totalBalance: TotalBalance,
|
||||
) = with(binding.lCardTotalBalance) {
|
||||
when (totalBalance.state) {
|
||||
TotalBalance.State.Loading -> {
|
||||
pbLoading.showAnimated()
|
||||
tvBalance.hideAnimated(hiddenVisibility = View.INVISIBLE)
|
||||
tvProcessing.hideAnimated()
|
||||
}
|
||||
TotalBalance.State.SomeTokensFailed -> {
|
||||
tvBalance.showAnimated()
|
||||
pbLoading.hideAnimated()
|
||||
tvProcessing.showAnimated()
|
||||
}
|
||||
TotalBalance.State.Success -> {
|
||||
tvBalance.showAnimated()
|
||||
pbLoading.hideAnimated()
|
||||
tvProcessing.hideAnimated()
|
||||
}
|
||||
}
|
||||
|
||||
tvBalance.text = totalBalance.fiatAmount.formatAmountAsSpannedString(
|
||||
currencySymbol = totalBalance.fiatCurrency.symbol
|
||||
)
|
||||
tvCurrencyName.text = totalBalance.fiatCurrency.code
|
||||
|
||||
tvCurrencyName.setOnClickListener {
|
||||
// TODO: Open app currency selector
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue