Updated on 2026-08-14
This commit is contained in:
parent
21c869cb3c
commit
404c496cf2
1 changed files with 18 additions and 4 deletions
|
|
@ -646,10 +646,23 @@ internal class WalletViewModel @Inject constructor(
|
||||||
event = TokenScreenAnalyticsEvent.ButtonSend(cryptoCurrencyStatus.currency.symbol),
|
event = TokenScreenAnalyticsEvent.ButtonSend(cryptoCurrencyStatus.currency.symbol),
|
||||||
)
|
)
|
||||||
|
|
||||||
val currency = cryptoCurrencyStatus.currency as? CryptoCurrency.Token ?: return
|
val userWallet = getWallet(index = state.walletsListConfig.selectedWalletIndex)
|
||||||
viewModelScope.launch(dispatchers.io) {
|
when (cryptoCurrencyStatus.currency) {
|
||||||
val userWallet = getWallet(index = state.walletsListConfig.selectedWalletIndex)
|
is CryptoCurrency.Coin -> {
|
||||||
|
uiState = stateFactory.getStateWithClosedBottomSheet()
|
||||||
|
reduxStateHolder.dispatch(
|
||||||
|
action = TradeCryptoAction.New.SendCoin(
|
||||||
|
userWallet = userWallet,
|
||||||
|
coinStatus = cryptoCurrencyStatus,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is CryptoCurrency.Token -> sendToken(userWallet, cryptoCurrencyStatus)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun sendToken(userWallet: UserWallet, cryptoCurrencyStatus: CryptoCurrencyStatus) {
|
||||||
|
viewModelScope.launch(dispatchers.io) {
|
||||||
getNetworkCoinStatusUseCase(
|
getNetworkCoinStatusUseCase(
|
||||||
userWalletId = userWallet.walletId,
|
userWalletId = userWallet.walletId,
|
||||||
networkId = cryptoCurrencyStatus.currency.network.id,
|
networkId = cryptoCurrencyStatus.currency.network.id,
|
||||||
|
|
@ -659,10 +672,11 @@ internal class WalletViewModel @Inject constructor(
|
||||||
.take(count = 1)
|
.take(count = 1)
|
||||||
.collectLatest {
|
.collectLatest {
|
||||||
it.onRight { coinStatus ->
|
it.onRight { coinStatus ->
|
||||||
|
uiState = stateFactory.getStateWithClosedBottomSheet()
|
||||||
reduxStateHolder.dispatch(
|
reduxStateHolder.dispatch(
|
||||||
action = TradeCryptoAction.New.SendToken(
|
action = TradeCryptoAction.New.SendToken(
|
||||||
userWallet = userWallet,
|
userWallet = userWallet,
|
||||||
tokenCurrency = currency,
|
tokenCurrency = requireNotNull(cryptoCurrencyStatus.currency as? CryptoCurrency.Token),
|
||||||
tokenFiatRate = cryptoCurrencyStatus.value.fiatRate,
|
tokenFiatRate = cryptoCurrencyStatus.value.fiatRate,
|
||||||
coinFiatRate = coinStatus.value.fiatRate,
|
coinFiatRate = coinStatus.value.fiatRate,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue