Skip to content

Instantly share code, notes, and snippets.

@ifucolo
Created August 2, 2022 18:22
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 ifucolo/8b6b8987d0198dc622102b19654d6063 to your computer and use it in GitHub Desktop.
Save ifucolo/8b6b8987d0198dc622102b19654d6063 to your computer and use it in GitHub Desktop.
override fun getJobs(): Flow<List<AndroidJob>> {
return jobsDao.getJobs().map { jobs ->
jobs.map(AndroidJobCache::asExternalModel)
}.onEach {
if (it.isEmpty()) {
fetchFreshJobs()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment