Updated on 2026-08-14
This commit is contained in:
parent
59080b682d
commit
8c3972bc43
1 changed files with 20 additions and 24 deletions
|
|
@ -914,8 +914,26 @@ internal class WalletViewModel @Inject constructor(
|
|||
|
||||
private fun getSingleCurrencyContent(index: Int) {
|
||||
val wallet = getWallet(index)
|
||||
updatePrimaryCurrencyStatus(userWalletId = wallet.walletId)
|
||||
updateNotifications(index)
|
||||
getPrimaryCurrencyStatusUpdatesUseCase(userWalletId = wallet.walletId)
|
||||
.distinctUntilChanged()
|
||||
.onEach { maybeCryptoCurrencyStatus ->
|
||||
uiState = stateFactory.getSingleCurrencyLoadedBalanceState(maybeCryptoCurrencyStatus)
|
||||
|
||||
maybeCryptoCurrencyStatus.onRight { status ->
|
||||
singleWalletCryptoCurrencyStatus = status
|
||||
|
||||
if (status.value.amount?.isZero() == false) {
|
||||
setWalletWithFundsFoundUseCase()
|
||||
}
|
||||
|
||||
updateNotifications(index)
|
||||
updateButtons(userWalletId = wallet.walletId, currencyStatus = status)
|
||||
updateTxHistory(status.currency)
|
||||
}
|
||||
}
|
||||
.flowOn(dispatchers.io)
|
||||
.launchIn(viewModelScope)
|
||||
.saveIn(marketPriceJobHolder)
|
||||
}
|
||||
|
||||
private fun updateTxHistory(currency: CryptoCurrency) {
|
||||
|
|
@ -936,28 +954,6 @@ internal class WalletViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun updatePrimaryCurrencyStatus(userWalletId: UserWalletId) {
|
||||
getPrimaryCurrencyStatusUpdatesUseCase(userWalletId = userWalletId)
|
||||
.distinctUntilChanged()
|
||||
.onEach { maybeCryptoCurrencyStatus ->
|
||||
uiState = stateFactory.getSingleCurrencyLoadedBalanceState(maybeCryptoCurrencyStatus)
|
||||
|
||||
maybeCryptoCurrencyStatus.onRight { status ->
|
||||
singleWalletCryptoCurrencyStatus = status
|
||||
|
||||
if (status.value.amount?.isZero() == false) {
|
||||
setWalletWithFundsFoundUseCase()
|
||||
}
|
||||
|
||||
updateButtons(userWalletId = userWalletId, currencyStatus = status)
|
||||
updateTxHistory(status.currency)
|
||||
}
|
||||
}
|
||||
.flowOn(dispatchers.io)
|
||||
.launchIn(viewModelScope)
|
||||
.saveIn(marketPriceJobHolder)
|
||||
}
|
||||
|
||||
private fun updateButtons(userWalletId: UserWalletId, currencyStatus: CryptoCurrencyStatus) {
|
||||
getCryptoCurrencyActionsUseCase(userWalletId = userWalletId, cryptoCurrencyStatus = currencyStatus)
|
||||
.distinctUntilChanged()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue