[#1425] Improve Balances widget loader logic
- Closes #1425 - Changelog update
This commit is contained in:
parent
a1cf59f9b2
commit
09febc6ff1
|
@ -13,6 +13,9 @@ directly impact users rather than highlighting other key architectural updates.*
|
||||||
- Delete Zashi feature has been added. It's accessible from the Advanced settings screen. It removes the wallet
|
- Delete Zashi feature has been added. It's accessible from the Advanced settings screen. It removes the wallet
|
||||||
secrets from Zashi and resets its state.
|
secrets from Zashi and resets its state.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- We've improved the visibility logic of the little loader that is part of the Balances widget
|
||||||
|
|
||||||
## [1.0 (638)] - 2024-04-26
|
## [1.0 (638)] - 2024-04-26
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -31,6 +31,7 @@ import co.electriccoin.zcash.ui.common.model.OnboardingState
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
import co.electriccoin.zcash.ui.common.model.WalletRestoringState
|
||||||
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
|
||||||
import co.electriccoin.zcash.ui.common.model.hasChangePending
|
import co.electriccoin.zcash.ui.common.model.hasChangePending
|
||||||
|
import co.electriccoin.zcash.ui.common.model.hasValuePending
|
||||||
import co.electriccoin.zcash.ui.common.model.spendableBalance
|
import co.electriccoin.zcash.ui.common.model.spendableBalance
|
||||||
import co.electriccoin.zcash.ui.common.model.totalBalance
|
import co.electriccoin.zcash.ui.common.model.totalBalance
|
||||||
import co.electriccoin.zcash.ui.preference.EncryptedPreferenceKeys
|
import co.electriccoin.zcash.ui.preference.EncryptedPreferenceKeys
|
||||||
|
@ -251,13 +252,12 @@ class WalletViewModel(application: Application) : AndroidViewModel(application)
|
||||||
.map { snapshot ->
|
.map { snapshot ->
|
||||||
when {
|
when {
|
||||||
// Show the loader only under these conditions:
|
// Show the loader only under these conditions:
|
||||||
// - Available balance is currently zero
|
// - Available balance is currently zero AND total balance is non-zero
|
||||||
// - Wallet has some ChangePending in progress
|
// - And wallet has some ChangePending or ValuePending in progress
|
||||||
// - And Total balance is non-zero
|
|
||||||
(
|
(
|
||||||
snapshot.spendableBalance().value == 0L &&
|
snapshot.spendableBalance().value == 0L &&
|
||||||
snapshot.hasChangePending() &&
|
snapshot.totalBalance().value > 0L &&
|
||||||
snapshot.totalBalance().value > 0L
|
(snapshot.hasChangePending() || snapshot.hasValuePending())
|
||||||
) -> {
|
) -> {
|
||||||
BalanceState.Loading(
|
BalanceState.Loading(
|
||||||
totalBalance = snapshot.totalBalance()
|
totalBalance = snapshot.totalBalance()
|
||||||
|
|
Loading…
Reference in New Issue