Skip to content

Instantly share code, notes, and snippets.

@aleksandra-majchrzak
Created May 10, 2021 21:15
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 aleksandra-majchrzak/b28fe520630144255d3ff7116e49f364 to your computer and use it in GitHub Desktop.
Save aleksandra-majchrzak/b28fe520630144255d3ff7116e49f364 to your computer and use it in GitHub Desktop.
Example 1 for Kotlin Shared Flow article
fun uploadData(): Observable<UpdateStep> = Observable.create<UpdateStep> {
it.onNext(UpdateStep.Step1)
doUpdateStep1()
it.onNext(UpdateStep.Step2)
doUpdateStep2()
it.onNext(UpdateStep.Step3)
doUpdateStep3()
it.onNext(UpdateStep.Success)
}.onErrorReturn {
UpdateStep.Error(it)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment