Skip to content

Instantly share code, notes, and snippets.

@Laimiux
Created April 23, 2017 11:00
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 Laimiux/697ec2f9c60376afd00bb47593346e85 to your computer and use it in GitHub Desktop.
Save Laimiux/697ec2f9c60376afd00bb47593346e85 to your computer and use it in GitHub Desktop.
class StoreRepository {
Observable<Lce<List<Store>> getStoreEventStream() {
return userBundleManager.switchMap { bundleEvent ->
if (bundleEvent.isLoading()) {
return Observable.just(Lce.loading())
} else if (bundleEvent.hasError()) {
return Observable.just(Lce.error(bundleEvent.getError()))
} else {
// Stores can come from cached source or network
return storeListEventStream(bundleEvent.data.getZipCode())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment