Created
December 12, 2017 14:46
-
-
Save digitalbuddha/74f96bd374f2bfbc5263c1264b850777 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
@ActivityScoped | |
class SuccessPresenter @Inject constructor(val dispatcher: Dispatcher) : | |
BasePresenter<SuccessMVPView>() { | |
override fun attachView(mvpView: SuccessMVPView, lifecycle: Lifecycle) { | |
super.attachView(mvpView, lifecycle) | |
dispatcher.showingSuccess() | |
.subscribe({ bindData((it as Showing.Success).successMetaData) }, | |
{ Timber.e(it) }) | |
dispatcher | |
.showing() | |
.filter { it !is Showing.Success } | |
.subscribe { mvpView.hideView() } | |
} | |
fun bindData(successMetaData: SuccessMetaData) { | |
mvpView?.bindData(successMetaData) | |
} | |
} | |
@ActivityScoped | |
class FailurePresenter @Inject constructor(val dispatcher: Dispatcher, | |
@Android val scheduler: Scheduler) : | |
BasePresenter<FailureBinder>() { | |
override fun attachView(mvpView: FailureBinder, lifecycle: Lifecycle) { | |
super.attachView(mvpView, lifecycle) | |
dispatcher.showingFailure() | |
.observeOn(scheduler) | |
.subscribe({ bindData((it as Showing.Failure).failureActionMetaData) }, | |
{ Timber.e(it) }) | |
dispatcher | |
.showing() | |
.filter { it !is Showing.Success } | |
.subscribe { mvpView.hide() } | |
} | |
fun bindData(failureActionMetaData: FailureActionMetaData) { | |
mvpView?.bindData(failureActionMetaData) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment