Skip to content

Instantly share code, notes, and snippets.

@ppicas
Created June 19, 2018 12:33
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 ppicas/83ec703a71638c77ffc6c5b811f52c70 to your computer and use it in GitHub Desktop.
Save ppicas/83ec703a71638c77ffc6c5b811f52c70 to your computer and use it in GitHub Desktop.
interface PushUpdates {
val jobs: Observable<Job>
}
class SubscribedJobRepository(
private val delegate: JobRepository,
private val pushUpdates: PushUpdates
) : JobRepository by delegate {
override fun getJob(jobId: String): Observable<Job> {
return delegate.getJob(jobId)
.concatWith(pushUpdates.jobs.filter {
it.id == jobId
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment