Created
June 8, 2023 04:39
-
-
Save u0705666/38ee8ee5575ae4cf207e06057e6867cd to your computer and use it in GitHub Desktop.
rxjava-combined-api-call-example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun fetchAccounts() { | |
val externalAccountLinkStatusObservable = linkCoordinator.linkStatusObservable | |
val wealthFrontAccountObservable = accountRepository.wealthfrontAccountObservable | |
val wealthFrontAccountRequestsObservable = accountRequestsRepository.wealthfrontAccountRequestObservable | |
val calloutObservable = calloutsRepository.getCalloutsObservable(AccountListSection::class.java) | |
autoDisposer.autoDispose( | |
combineLatest( | |
externalAccountLinkStatusObservable, | |
wealthFrontAccountObservable, | |
wealthFrontAccountRequestsObservable, | |
calloutObservable | |
) { parallelLinkingResult, abstractAccountOverviews, accountRequests, callouts -> | |
showAccounts(abstractAccountOverviews, accountRequests, parallelLinkingResult.statuses, callouts) | |
} | |
.doOnSubscribe { view?.showTransparentLoading() } | |
.subscribe( | |
{ | |
view?.hideLoadingAndErrorStates() | |
}, | |
{ | |
view?.hideLoadingAndErrorStates() | |
networkErrorToaster.showErrorMessage(it, R.string.dashboard_load_error) | |
} | |
) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment