Created
December 10, 2019 14:46
-
-
Save wangerekaharun/6cbd13041ecafec81a3c2c29f4b928cb to your computer and use it in GitHub Desktop.
error.kt
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
//omitted class definations for brevity | |
private val sessionDataStateMediatorLiveData = MediatorLiveData<SessionsModel>() | |
private val error = MediatorLiveData<String>() | |
fun getSessionDetails(dayNumber: String, sessionId: Int) { | |
viewModelScope.launch { | |
when (val value = sessionDataRepo.getSessionData(dayNumber, sessionId)) { | |
is FirebaseResult.Success -> sessionDataStateMediatorLiveData.postValue(value.data) | |
is FirebaseResult.Error -> error.postValue(value.exception) | |
} | |
} | |
} | |
fun sendSessionFeedBack(userEventFeedback: SessionsUserFeedback) { | |
viewModelScope.launch { | |
when (val value = sessionFeedbackRepo.sendFeedBack(userEventFeedback)) { | |
is FirebaseResult.Success -> sessionFeedBackMediatorLiveData.postValue(value.data) | |
is FirebaseResult.Error -> error.postValue(value.exception) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment