Android Oauth2 token refresh mechanism – OkHttp vs RxJava layering

The RxJava approach

I am currently working on an app where the devs before me took this strange decision in regard to the refresh token mechanism – have a single entry point of the app which is called every time whenever you need to have a fresh token. What I mean is this:

Continue reading “Android Oauth2 token refresh mechanism – OkHttp vs RxJava layering”

RxJava toList – completes only after onComplete is called

 mGetActiveHubUpdatesInteractor.getActiveHubUpdates()
                .filter(Optional::isPresent)
                .firstOrError()
                .map(Optional::get)
                .flatMap(activeHub ->
                        mGetActiveHubEventsInteractor.getActiveHubEvents(activeHub, startTime,
                                endTime))
                .flattenAsObservable(list -> list)
                .map(mActiveHubEventUiMapper::toUiActiveHubEvent)
                .toList()
                .subscribe(this::populateEvents, this::handleError);
Continue reading “RxJava toList – completes only after onComplete is called”