Skip to content

Instantly share code, notes, and snippets.

@RohitSurwase
Created February 25, 2020 02:09
Show Gist options
  • Save RohitSurwase/6a44bb41663468e879ef656882ba17b0 to your computer and use it in GitHub Desktop.
Save RohitSurwase/6a44bb41663468e879ef656882ba17b0 to your computer and use it in GitHub Desktop.
UI observes MainViewState model for changes.
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