Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-24 17:11:40 +05:00
parent 14135be555
commit 2d6bce9eb3
4 changed files with 70 additions and 25 deletions

View file

@ -882,10 +882,13 @@ internal class WalletViewModel @Inject constructor(
}
override fun onTokenItemLongClick(cryptoCurrencyStatus: CryptoCurrencyStatus) {
val state = uiState as? WalletState.ContentState ?: return
val userWallet = getWallet(state.walletsListConfig.selectedWalletIndex)
val userWallet = getSelectedWallet()
viewModelScope.launch(dispatchers.io) {
getCryptoCurrencyActionsUseCase(userWallet.walletId, cryptoCurrencyStatus)
getCryptoCurrencyActionsUseCase(
userWalletId = userWallet.walletId,
cryptoCurrencyStatus = cryptoCurrencyStatus,
isSingleWalletWithTokens = userWallet.scanResponse.cardTypesResolver.isSingleWalletWithToken(),
)
.take(count = 1)
.collectLatest {
uiState = stateFactory.getStateWithTokenActionBottomSheet(it)
@ -1262,8 +1265,13 @@ internal class WalletViewModel @Inject constructor(
}
}
private fun updateButtons(userWalletId: UserWalletId, currencyStatus: CryptoCurrencyStatus) {
getCryptoCurrencyActionsUseCase(userWalletId = userWalletId, cryptoCurrencyStatus = currencyStatus)
private suspend fun updateButtons(userWalletId: UserWalletId, currencyStatus: CryptoCurrencyStatus) {
val userWallet = getSelectedWallet()
getCryptoCurrencyActionsUseCase(
userWalletId = userWalletId,
cryptoCurrencyStatus = currencyStatus,
isSingleWalletWithTokens = userWallet.scanResponse.cardTypesResolver.isSingleWalletWithToken(),
)
.conflate()
.distinctUntilChanged()
.onEach { uiState = stateFactory.getSingleCurrencyManageButtonsState(actionsState = it) }