Last active
November 23, 2017 14:16
-
-
Save luks91/d70b19abd60f630afc64e50e89948d83 to your computer and use it in GitHub Desktop.
This file contains 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
fun save(contacts: Flowable<Contact>) = | |
contacts | |
.observeOn(Schedulers.io()) | |
.subscribe(object : DefaultSubscriber<Contact>() { | |
override fun onStart() = request(1) | |
override fun onNext(contact: Contact) = | |
openConnection<Contact>().use { | |
it.write(contact) | |
request(1) | |
} | |
override fun onComplete() {} | |
override fun onError(t: Throwable) { | |
Log.e("TAG", "Oops!", t) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment