Advertisement
Guest User

Untitled

a guest
Jan 15th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.95 KB | None | 0 0
  1. private fun getRecommendedContacts() {
  2.         interactor?.let { interactor ->
  3.             compositeDisposable?.add(
  4.                 interactor.getRecommendedContacts()
  5.                     .map { recommendedContacts ->
  6.                         recommendedContacts.map { recommendedContact ->
  7.                             Pair(
  8.                                 interactor.getContactById(recommendedContact.contactId).blockingGet(),
  9.                                 recommendedContact
  10.                             )
  11.                         }.filter { !it.first.isBlocked }.associateBy { it.first.id }
  12.                     }.compose(ioToMainSingleScheduler())
  13.                     .doOnSuccess { recommendedContactsMap ->
  14.                         this.recommendedContactsMap = recommendedContactsMap.toMutableMap()
  15.                         view?.displayRecommendedContacts(recommendedContactsMap.map { it.value.first })
  16.                     }.subscribe())
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement