Skip to content

Instantly share code, notes, and snippets.

@manuelvicnt
Created November 14, 2019 12:55
Show Gist options
  • Save manuelvicnt/852824961588fd00612ca7c27d7609de to your computer and use it in GitHub Desktop.
Save manuelvicnt/852824961588fd00612ca7c27d7609de to your computer and use it in GitHub Desktop.
/* Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
// Simplified version of the real code
class SessionDetailViewModel(
private val loadUserSessionUseCase: LoadUserSessionUseCase,
...
): ViewModel() {
private fun listenForUserSessionChanges(sessionId: SessionId) {
viewModelScope.launch {
loadUserSessionUseCase(sessionId).collect { loadResult ->
// Update multiple LiveDatas to notify the View
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment