Created
June 8, 2020 06:40
-
-
Save zivkesten/a2f60810fe64e561eed58356b65d16c5 to your computer and use it in GitHub Desktop.
MVI - viewModel event function
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
fun event(event: Event) { | |
when(event) { | |
is Event.DataReceived -> handleScreenLoadState(event.data) | |
is Event.LinkClicked -> viewAction.postValue(ViewEffect.NavigateToLink(data?.url)) | |
is Event.AddToFavouritesClicked -> viewAction.postValue(ViewEffect.ShowSnackBar( | |
R.string.button_result_text | |
)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment