Skip to content

[NMA-1353] Coinbase loading dialog improvements - #1013

Merged
HashEngineering merged 9 commits into
feature-coinbase-integrationfrom
coinbase-loading-improvements
Aug 13, 2022
Merged

HashEngineering merged 9 commits into
feature-coinbase-integrationfrom
coinbase-loading-improvements

Conversation

@Syn-McJ

@Syn-McJ Syn-McJ commented Aug 11, 2022

Copy link
Copy Markdown
Member

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 /accounts endpoint 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?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

@Syn-McJ Syn-McJ self-assigned this Aug 11, 2022
@Syn-McJ
Syn-McJ force-pushed the coinbase-loading-improvements branch from 8d0a0c8 to feb5289 Compare August 11, 2022 08:46
private val coinbaseAddressMapper: CoinbaseAddressMapper
) : CoinBaseRepositoryInt {
override suspend fun getUserAccount() = safeApiCall {
private var userAccountInfo: List<CoinBaseUserAccountData> = listOf()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from #1009. This code adds more loading dialogs while we're trying to get rid of them. Is it really necessary here? @hadia

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Syn-McJ we need to keep status if the user choose feature before all data related loaded

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an error. If lastCoinbaseBalance is not empty, we want to return it and not 0.

@hadia hadia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

import org.dash.wallet.common.ui.payment_method_picker.PaymentMethod
import org.dash.wallet.integration.coinbase_integration.model.BaseIdForUSDData

sealed class BaseIdForFaitDataUIState {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps, Fait should be Fiat -- we can fix this in a different PR if that is the case.

@HashEngineering

Copy link
Copy Markdown
Collaborator

This PR pulls in code from #1009 which has not been approved, it will be merged after #1009

@HashEngineering
HashEngineering merged commit 6b08703 into feature-coinbase-integration Aug 13, 2022
@Syn-McJ
Syn-McJ deleted the coinbase-loading-improvements branch August 17, 2022 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants