Repository navigation
[NMA-1353] Coinbase loading dialog improvements - #1013
Conversation
8d0a0c8 to
feb5289
Compare
| private val coinbaseAddressMapper: CoinbaseAddressMapper | ||
| ) : CoinBaseRepositoryInt { | ||
| override suspend fun getUserAccount() = safeApiCall { | ||
| private var userAccountInfo: List<CoinBaseUserAccountData> = listOf() |
There was a problem hiding this comment.
All methods in this class call /accounts endpoint every time they need something which results in long processing times and loading dialogs. It's better to cache the result. getUserAccount will still update it periodically.
We might also want to add more sophisticated caching logic.
| setConvertViewInput() | ||
| } | ||
|
|
||
| viewModel.userAccountsWithBalance.observe( |
There was a problem hiding this comment.
Passing the execution flow around by calling/observing events is convoluted and unnecessary. Just call a suspend method from the fragment and wait for the result.
|
|
||
| is BaseIdForFaitDataUIState.LoadingState ->{ | ||
| if (uiState.isLoading) { | ||
| showProgress(R.string.loading) |
There was a problem hiding this comment.
@Syn-McJ we need to keep status if the user choose feature before all data related loaded
There was a problem hiding this comment.
Yes, but this code sets _baseIdForFaitModelCoinBase which is only needed when the swap trade is initiated, not before. So technically, we don't need a loading dialog for this until the user actually starts the conversion process, right?
| } | ||
| is ResponseResource.Failure -> { | ||
| _coinbaseBalance.value = if (config.lastCoinbaseBalance.isNullOrEmpty()) { | ||
| _coinbaseBalance.value = if (!config.lastCoinbaseBalance.isNullOrEmpty()) { |
There was a problem hiding this comment.
This is an error. If lastCoinbaseBalance is not empty, we want to return it and not 0.
| import org.dash.wallet.common.ui.payment_method_picker.PaymentMethod | ||
| import org.dash.wallet.integration.coinbase_integration.model.BaseIdForUSDData | ||
|
|
||
| sealed class BaseIdForFaitDataUIState { |
There was a problem hiding this comment.
perhaps, Fait should be Fiat -- we can fix this in a different PR if that is the case.
Improvements for the loading dialog showing time on the Convert screen.
This PR includes #1009 to avoid conflicts.
Issue being fixed or feature implemented
Coinbase code seems to request the
/accountsendpoint each time it needs something from it - I think there is an opportunity for caching and reusing the result. It will still be updated when a user opens buy/sell or the Coinbase portal and at some other times, but for deeper navigations, we might as well use the data we already have.Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist: