Android-CleanArchitecture icon indicating copy to clipboard operation
Android-CleanArchitecture copied to clipboard

UseCases that fetch data as Single or Completable?

Open mr746866 opened this issue 7 years ago • 1 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>?

mr746866 avatar Jan 18 '18 15:01 mr746866

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.

ghost avatar Jan 19 '18 15:01 ghost