Skip to content

Instantly share code, notes, and snippets.

@orcchg
Created June 26, 2021 08:10
Show Gist options
  • Select an option

  • Save orcchg/e667f6242ccaeceaefd3cb2eb609fa0e to your computer and use it in GitHub Desktop.

Select an option

Save orcchg/e667f6242ccaeceaefd3cb2eb609fa0e to your computer and use it in GitHub Desktop.
abstract class MaybeUseCase<T>(
private val schedulersFactory: SchedulersFactory
) {
abstract fun sourceImpl(params: Params = Params.EMPTY): Maybe<T>
fun source(params: Params = Params.EMPTY): Maybe<T> =
sourceImpl(params)
.subscribeOn(schedulersFactory.useCase())
.observeOn(schedulersFactory.main())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment