Created
July 14, 2021 10:47
-
-
Save mattmook/7878fbfc67cd82f26b8f79edf25ebb69 to your computer and use it in GitHub Desktop.
The state of MVI on Android - Uniflow - actions
This file contains hidden or 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
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