Created
September 10, 2017 15:07
-
-
Save charlag/4d069d4a1411ee86b7e7e3c81a433c3d 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
private val viewStateEffect = Transformer<State, Event, Event.ViewStateEvent> { upstream -> | |
upstream.distinctUntilChanged { old, new -> old.second == new.second } | |
.map { (_, state, _) -> | |
val viewState = state.todos.map { | |
TodoViewData(it.id, it.text, it.completed) | |
} | |
.sortedBy { it.completed } | |
Event.ViewStateEvent(viewState) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment