Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created August 1, 2022 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydoves/fda0224451d4f41948ff197aa83836e9 to your computer and use it in GitHub Desktop.
Save skydoves/fda0224451d4f41948ff197aa83836e9 to your computer and use it in GitHub Desktop.
vm_message_event
@HiltViewModel
class WhatsAppMessagesViewModel @Inject constructor(
..
) : ViewModel() {
..
fun handleEvents(whatsAppMessageEvent: WhatsAppMessageEvent) {
when (whatsAppMessageEvent) {
is WhatsAppMessageEvent.FetchChannel -> fetchChannel(whatsAppMessageEvent.channelId)
}
}
}
sealed interface WhatsAppMessageEvent {
class FetchChannel(val channelId: String) : WhatsAppMessageEvent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment