Skip to content

Instantly share code, notes, and snippets.

@mattmook
Created July 14, 2021 10:47
Show Gist options
  • Save mattmook/7878fbfc67cd82f26b8f79edf25ebb69 to your computer and use it in GitHub Desktop.
Save mattmook/7878fbfc67cd82f26b8f79edf25ebb69 to your computer and use it in GitHub Desktop.
The state of MVI on Android - Uniflow - actions
class PostListViewModel : AndroidDataFlow(defaultState = PostListState()) {
init {
action1()
action2()
}
private fun action1() = actionOn<PostListState> { state ->
delay(5000)
setState {
state.copy(action1 = true)
}
}
private fun action2() = actionOn<PostListState> { state ->
delay(2500)
setState {
state.copy(action2 = true)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment