android10 / Android-CleanArchitecture

This is a sample app that is part of a series of blog posts I have written about how to architect an android application using Uncle Bob's clean architecture approach.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UseCases that fetch data as Single or Completable?

mr746866 opened this issue · comments

In this project, all UseCases are treated (observed) like they fetch data as Observable<T>, as we need to implement the buildUseCaseObservable abstract method. But, quite frequently, it is more appropriate to retrieve data as Single<T> or even use Completable to know if some task completed or not.

What is the recommended way, if I want to use Single<T> or Completable instead of Observable<T>?

Sorry for my bad english.
I think you can create another abstract class for UseCase that return an instance of Single and Completable. The code is just the save as the Observable<T> one but the return of buildUseCaseObservable will change to Single and Completable. You know what task need to retrieve data or completable so you can extend from the appropriate base class.