Skip to content

Instantly share code, notes, and snippets.

@javipacheco
Created May 23, 2018 20:55
Show Gist options
  • Save javipacheco/f8ae58cb3dd13878f80c339c753bc525 to your computer and use it in GitHub Desktop.
Save javipacheco/f8ae58cb3dd13878f80c339c753bc525 to your computer and use it in GitHub Desktop.
Handling notifications on ViewModel
fun notification(notification: Notifications): DeferredK<Unit> = when (notification) {
is Notifications.NewsGetItemsNotification -> DeferredK {
viewState.postValue(ViewState.FailedViewState(notification.ex))
}
else -> notification.toDeferred()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment