Skip to content

Instantly share code, notes, and snippets.

@vchernyshov
Created April 10, 2020 19:47
Show Gist options
  • Save vchernyshov/e68aa51ef0a6ff3a499e743305c470ac to your computer and use it in GitHub Desktop.
Save vchernyshov/e68aa51ef0a6ff3a499e743305c470ac to your computer and use it in GitHub Desktop.
How logs were collected:
private val codeFilled = code.text.observable
.doOnNext { println("Confirm: text emitted") }
.filter { it.length == CODE_LENGTH }
.doOnNext { println("Confirm: filtered") }
.distinctUntilChanged()
.doOnNext { println("Confirm: distinct") }
.map { Unit }
val sendClicks = action<Unit> {
this.mergeWith(codeFilled)
.doOnNext { println("Confirm: merge before skip") }
.skipWhileInProgress(inProgress)
.doOnNext { println("Confirm: merge after skip") }
.map { code.text.value }
.filter { formValidator.validate() }
.switchMapCompletable { code ->
authModel.sendConfirmationCode(phone, code)
.bindProgress(inProgress)
.doOnComplete { sendMessage(PhoneConfirmed) }
.doOnError(errorConsumer)
}
.toObservable<Any>()
}
Logcat output RxPm:
2020-04-10 22:34:37.216 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: text emitted // initial empty
2020-04-10 22:34:43.307 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: text emitted // 1
2020-04-10 22:34:44.375 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: text emitted // 2
2020-04-10 22:34:45.245 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: text emitted // 3
2020-04-10 22:34:45.978 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: text emitted // 4
2020-04-10 22:34:45.979 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: filtered
2020-04-10 22:34:45.979 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: distinct
2020-04-10 22:34:45.979 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: merge before skip
2020-04-10 22:34:45.979 14672-14672/me.dmdev.rxpm.sample I/System.out: Confirm: merge after skip
2020-04-10 22:34:49.000 14672-14767/me.dmdev.rxpm.sample I/System.out: Confirm: text emitted // initial not empty
2020-04-10 22:34:49.000 14672-14767/me.dmdev.rxpm.sample I/System.out: Confirm: filtered
2020-04-10 22:34:49.000 14672-14767/me.dmdev.rxpm.sample I/System.out: Confirm: distinct
2020-04-10 22:34:49.000 14672-14767/me.dmdev.rxpm.sample I/System.out: Confirm: merge before skip
Logcat output ReaktivePm:
2020-04-10 22:37:26.433 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: text emitted // initial empty
2020-04-10 22:37:30.222 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: text emitted // 1
2020-04-10 22:37:30.563 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: text emitted // 2
2020-04-10 22:37:31.211 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: text emitted // 3
2020-04-10 22:37:31.542 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: text emitted // 4
2020-04-10 22:37:31.542 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: filtered
2020-04-10 22:37:31.543 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: distinct
2020-04-10 22:37:31.543 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: merge before skip
2020-04-10 22:37:31.543 14887-14887/dev.garage.rpm.app.debug I/System.out: Confirm: merge after skip
2020-04-10 22:37:34.551 14887-14959/dev.garage.rpm.app.debug I/System.out: Confirm: text emitted // initial not empty
2020-04-10 22:37:34.551 14887-14959/dev.garage.rpm.app.debug I/System.out: Confirm: filtered
2020-04-10 22:37:34.551 14887-14959/dev.garage.rpm.app.debug I/System.out: Confirm: distinct
2020-04-10 22:37:34.552 14887-14959/dev.garage.rpm.app.debug I/System.out: Confirm: merge before skip
2020-04-10 22:37:34.552 14887-14959/dev.garage.rpm.app.debug I/System.out: Confirm: merge after skip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment