Skip to content

Instantly share code, notes, and snippets.

@nanlabsweb
Created April 5, 2018 16:14
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 nanlabsweb/ead1768acc1e38b9e5816e847f8c12b7 to your computer and use it in GitHub Desktop.
Save nanlabsweb/ead1768acc1e38b9e5816e847f8c12b7 to your computer and use it in GitHub Desktop.
Sync Repository without coroutines.
fun syncPets(): LiveData<List<Pet>> {
liveDataMerger.addSource(firestoreWrapper.getAllPets()) {
value -> liveDataMerger.value = value
appDataBase.petDao().deleteAllPets()
value?.forEach {
appDataBase.petDao().insert(it)
}
}
return liveDataMerger
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment