Skip to content

Instantly share code, notes, and snippets.

@rozkminiacz
Created May 7, 2018 21:57
Show Gist options
  • Save rozkminiacz/937c286be6aca8640841c39287a4fa02 to your computer and use it in GitHub Desktop.
Save rozkminiacz/937c286be6aca8640841c39287a4fa02 to your computer and use it in GitHub Desktop.
class PromotionListViewRobot(presenter: PromotionListContract.Presenter) {
private val initSubject = BehaviorSubject.create<Any>()
private val renderedViewStates: MutableList<PromotionListContract.ViewState> = mutableListOf()
private val view: PromotionListContract.View = object : PromotionListContract.View {
override fun listInit(): Observable<Any> = initSubject
override fun render(viewState: PromotionListContract.ViewState) {
renderedViewStates.add(viewState)
}
}
init {
presenter.attachView(view)
}
fun start() {
initSubject.onNext(Any())
}
fun checkStatesRendered(function: (List<PromotionListContract.ViewState>) -> Unit) {
function(renderedViewStates)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment