kioba
08/07/2017, 9:00 PM.concat
for is offline sync, so it depends on heavily what you meant on local observable.
Basically he concat the 3 datasource and take the first available. So if you don’t have in the upper layers then you go deeper to the more expensive ones and update the upper ones.
answering you question i would go with both of them, take local or network with the most uptodate data, but on the network call just update the local:
fun getDistinctUsers() = Observable
.concat(local, network.doOnNext{ data -> saveToLocal(data)})
.first {data -> data.synced }
.filter(SomeAlgorithm::distinct)
vivekneel
08/08/2017, 6:25 AM