private void handleNetworkError(VKRequest request) { if (request.attempt < 5) { request.attempt++; VkApi.VkApiInstance.Call(request); } else { request.CallBackFunction(request); } }
private void handleNeedToShowMessageToUser(VKRequest r) { YesNoMessageBox.Add(new YesNoTaskData { OnYesButton = () => { r.fullurl += "&confirm=1"; VkApi.VkApiInstance.Call(r); }, OnNoButton = () => { r.CallBackFunction(r); }, Message = Utilities.ParseConfirmationText(r.response) }); }
public void UploadToserverCall(VKRequest httprequest) { if (string.IsNullOrEmpty(httprequest.fullurl)) { if (httprequest.url.StartsWith("http")) { httprequest.fullurl = httprequest.url; } else { httprequest.fullurl = Utilities.GenerateFullHttpReqString(httprequest.url); } } StartCoroutine(_UploadToserverCall(httprequest)); }
private void HandleVKError(WWW www, VKRequest httprequest) { var vkerror = Error.ParseVkError(www.text); VKRequest vkargs = httprequest; vkargs.response = www.text; vkargs.error = vkerror; if (GlobalErrorHandler != null) { GlobalErrorHandler(vkargs); } else if (vkargs.CallBackFunction != null) { vkargs.CallBackFunction(vkargs); } }
public void Share() { if (_images == null) { PostToWall(RepeatRequest); return; } _imagesToUpload = _images.Count; var groupIdParam = _group_id == 0?"":"group_id=" + _group_id.ToString(); VKRequest r = new VKRequest() { url = "photos.getWallUploadServer?" + groupIdParam, data = new object[] { RepeatRequest }, CallBackFunction = GotWallUploadServer }; vkapi.Call(r); }
private void HandleResponse(WWW www, VKRequest httpRequest) { Error vkerror = Error.ParseVkError(www.text); if (!string.IsNullOrEmpty(www.error)) { HandleWWWError(www, httpRequest); } if (string.IsNullOrEmpty(www.error) && vkerror != null) { HandleVKError(www, httpRequest); } if (String.IsNullOrEmpty(www.error) && vkerror == null) { HandleNoError(www, httpRequest); } }
void OnPhotoSaved(VKRequest arg1) { if (arg1.error != null) { _callbackFunction(arg1); return; } var dict = Json.Deserialize(arg1.response) as Dictionary <string, object>; var resp = (List <object>)dict["response"]; var photo = VKPhoto.Deserialize(resp [0]); _photoIds.Add(photo.id); _imagesToUpload--; if (_imagesToUpload == 0) { PostToWall(RepeatRequest); } }
private void HandleTokenExpired(VKRequest httprequest) { Debug.Log("Invalid token. Are you logged in?"); VKRequest vkargs = httprequest; vkargs.response = ""; vkargs.error = new Error { error_code = "401", error_msg = "invalid token" }; if (GlobalErrorHandler != null) { GlobalErrorHandler(vkargs); } else if (vkargs.CallBackFunction != null) { vkargs.CallBackFunction(vkargs); } }
private void HandleWWWError(WWW www, VKRequest httprequest) { var vkerror = new Error() { error_code = "404", error_msg = www.error }; VKRequest vkargs = httprequest; vkargs.response = www.text; vkargs.error = vkerror; if (GlobalErrorHandler != null) { GlobalErrorHandler(vkargs); } else if (vkargs.CallBackFunction != null) { vkargs.CallBackFunction(vkargs); } }
void PhotoHasBeenUploaded(VKRequest arg1) { if (arg1.error != null) { _callbackFunction(arg1); return; } var dict = Json.Deserialize(arg1.response) as Dictionary <string, object>; var server = (long)dict["server"]; var photo = (string)dict["photo"]; var hash = (string)dict["hash"]; var groupIdParam = _group_id == 0?"":"&group_id=" + _group_id.ToString(); VKRequest r = new VKRequest() { url = "photos.saveWallPhoto?photo=" + photo + "&server=" + server + "&hash=" + hash + groupIdParam, CallBackFunction = OnPhotoSaved, data = new object[] { RepeatRequest } }; vkapi.Call(r); }
public void OnGlobalError(VKRequest request) { if (request.error.error_code == "17") { handle_17_Error(request); } else if (request.error.error_code == "14") { handleCaptchaError(request); } else if (request.error.error_code == "24") { handleNeedToShowMessageToUser(request); } else if (request.error.error_code == "404") { handleNetworkError(request); } else { request.CallBackFunction(request); } }
public void UploadToserverCall(VKRequest requestString, FileForUpload file) { StartCoroutine(_UploadToserverCall(requestString, file)); }
public void Call(VKRequest httprequest) { httprequest.error = null; StartCoroutine(_Call(httprequest)); }
void WhenPosted(VKRequest arg1) { _callbackFunction(arg1); Debug.Log("Finished Sharing"); }
private void handle_17_Error(VKRequest request) { Error_17_worker.Add(request); }
private void handleCaptchaError(VKRequest request) { CaptchaDialog.Add(request); }