Created
April 5, 2018 16:14
-
-
Save nanlabsweb/ead1768acc1e38b9e5816e847f8c12b7 to your computer and use it in GitHub Desktop.
Sync Repository without coroutines.
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
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