/** * Method used for response processing * * @param jsonResponse response from API * @param parsedModel model parsed from json */ private void provideResponse(final JSONObject jsonResponse, Object parsedModel) { final VKResponse response = new VKResponse(); response.request = this; response.json = jsonResponse; response.parsedModel = parsedModel; if (mLoadingOperation instanceof VKHttpOperation) { response.responseString = ((VKHttpOperation) mLoadingOperation).getResponseString(); } if (mPostRequestsQueue != null && mPostRequestsQueue.size() > 0) { for (VKRequest request : mPostRequestsQueue) { request.start(); } } if (requestListener != null) { requestListener.onComplete(response); } }
/** * Register current request for execute after passed request, if passed request is successful. If * it's not, errorBlock will be called. * * @param request after which request must be called that request * @param listener listener for request events */ public void executeAfterRequest(VKRequest request, VKRequestListener listener) { this.requestListener = listener; request.addPostRequest(this); }