Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
override fun getStatusById(id: UUID): LiveData<WorkStatus> {
val dao = mWorkDatabase.workSpecDao()
val inputLiveData = dao.getWorkStatusPojoLiveDataForIds(listOf(id.toString()))
return LiveDataUtils.dedupedMappedLiveDataFor<List<WorkSpec.WorkStatusPojo>, WorkStatus>(inputLiveData) { input ->
var workStatus: WorkStatus? = null
if (null != input && input.isNotEmpty()) {
workStatus = input [0].toWorkStatus()
}
workStatus
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment