Skip to content

Instantly share code, notes, and snippets.

@xsobolx
Last active December 6, 2017 10:59
Show Gist options
  • Select an option

  • Save xsobolx/6efddcc7f3ae7ca352e9302d297683dd to your computer and use it in GitHub Desktop.

Select an option

Save xsobolx/6efddcc7f3ae7ca352e9302d297683dd to your computer and use it in GitHub Desktop.
Observables.combineWithUnit(checkedProducts, view.confirmReplacement())
.switchMap { interactor.confirmReplacement(orderId, DenyCourierOrderRequest(it)) }
.subscribe { response -> response.fold(view::showError, { Timber.d("confirmed!!!!") }) }
fun <T> combineWithUnit(o1: Observable<T>, o2: Observable<Unit>): Observable<T>
= Observable.combineLatest(o1, o2, BiFunction { t1, _ -> t1 })
val checkedProducts = view.checkProduct()
.scan(ArrayList<String>(), {acc, next -> acc.add(next); acc})
.publish()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment