Skip to content

Instantly share code, notes, and snippets.

@patrykpoborca
Created March 16, 2016 22:24
Show Gist options
  • Save patrykpoborca/436647fa12fdd908f512 to your computer and use it in GitHub Desktop.
Save patrykpoborca/436647fa12fdd908f512 to your computer and use it in GitHub Desktop.
private Retrofit retrofit = ApplicationFactory.getRetrofitClient();
private ManagerDelegate managerDelegate = ApplicationFactory.getManagerDelegateImpl();
private Observable<Response> retrieveSomeValue(String param) {
RetrofitClient client = retrofit.create(RetrofitClient.class);
Observable<Response> request = client.doRequest(param);
request.subscribe(response ->{
CachingManager.getInstance().cacheSimpleResponse(response);
// Which one's better?
managerDelegate.getCachingManager.cacheSimpleResponse(response);
});
//by returning the "promise" of this network request we can allow some other component of the app to do the routing for us.
return request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment