Created
April 13, 2018 07:52
-
-
Save vvsevolodovich/ad663493320edbe2a5c10d659a6d56c0 to your computer and use it in GitHub Desktop.
RxChain
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 attemptLoginRx() { | |
showProgress(true) | |
apiClient.login(auth) | |
.flatMap { | |
user -> apiClient.getRepositories(user.repos_url, auth) | |
} | |
.map { | |
list -> list.map { it.full_name } | |
} | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.doFinally { showProgress(false) } | |
.subscribe( | |
{ list -> showRepositories(this, list) }, | |
{ error -> Log.e("TAG", "Failed to show repos", error) } | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment