Created
February 25, 2020 02:09
-
-
Save RohitSurwase/6a44bb41663468e879ef656882ba17b0 to your computer and use it in GitHub Desktop.
UI observes MainViewState model for changes.
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
data class MainViewState(val fetchStatus: FetchStatus, val newsList: List<NewsItem>) | |
sealed class MainViewEffect { | |
data class ShowSnackbar(val message: String) : MainViewEffect() | |
data class ShowToast(val message: String) : MainViewEffect() | |
} | |
sealed class MainViewEvent { | |
data class NewsItemClicked(val newsItem: NewsItem) : MainViewEvent() | |
object FabClicked : MainViewEvent() | |
object OnSwipeRefresh : MainViewEvent() | |
object FetchNews : MainViewEvent() | |
} | |
sealed class FetchStatus { | |
object Fetching : FetchStatus() | |
object Fetched : FetchStatus() | |
object NotFetched : FetchStatus() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment