Skip to content

Commit

Permalink
update DialogControl
Browse files Browse the repository at this point in the history
add dismissOnDispose for auto dismiss dialog when subscribe canceled
  • Loading branch information
Alex committed Jan 15, 2021
1 parent d626003 commit 45c7a61
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ class DialogControl<T, R> internal constructor() : BaseControl() {
displayed.consumer.accept(Display.Displayed(data))
}

fun showForResult(data: T): Maybe<R> {
fun showForResult(data: T, dismissOnDispose: Boolean = false): Maybe<R> {
dismiss()
return result
.observable
.doOnSubscribe { displayed.consumer.accept(Display.Displayed(data)) }
.doOnDispose { if (dismissOnDispose) dismiss() }
.takeUntil(
displayed.observable
.skip(1)
Expand Down

0 comments on commit 45c7a61

Please sign in to comment.