perform a task with an observable and emit value
private val performTask = io.reactivex.Observable.create<Boolean>({ emitter ->
// do somethinf
emitter.onNext(true)
emitter.onComplete()
})
// this is also another observable with retry. I want to retry 2 times, but only if perform task is successful.
fun <T> io.reactivex.Observable<T>.retryAuth(): Observable<T> {
return this.retry ({ count, error ->
if (count == 2 && error is ApolloException) {
// do something with performTask and return the value
} else false
})
just need illustration on achieving this