Updated on 2026-08-14
This commit is contained in:
parent
199c2795ad
commit
92ee3c0273
10 changed files with 140 additions and 7 deletions
|
|
@ -153,7 +153,13 @@ internal class SwapViewModel @Inject constructor(
|
|||
swapInteractor.getTokensDataState(initialCryptoCurrency)
|
||||
}.onSuccess { state ->
|
||||
updateTokensState(state)
|
||||
applyInitialTokenChoice(state, selectInitialCurrencyToSwap(state))
|
||||
applyInitialTokenChoice(
|
||||
state,
|
||||
swapInteractor.selectInitialCurrencyToSwap(
|
||||
initialCryptoCurrency,
|
||||
state,
|
||||
),
|
||||
)
|
||||
}.onFailure {
|
||||
Timber.tag(loggingTag).e(it)
|
||||
}
|
||||
|
|
@ -182,11 +188,6 @@ internal class SwapViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun selectInitialCurrencyToSwap(state: TokensDataStateExpress): CryptoCurrencyStatus? {
|
||||
// todo add algorithm to select initial currency
|
||||
return state.toGroup.available.firstOrNull()?.currencyStatus
|
||||
}
|
||||
|
||||
private fun updateTokensState(dataState: TokensDataStateExpress) {
|
||||
val tokensDataState = if (!isOrderReversed) dataState.toGroup else dataState.fromGroup
|
||||
uiState = stateBuilder.addTokensToState(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue