Example #1
0
        public async Task <bool> ProcessAPIError(BaseErrorResponseInfo error)
        {
            String message = "General.Error.API.Generic".Translate();

            if (error is BaseAPIErrorResponseInfo apiErrorResponse)
            {
                if (apiErrorResponse.Error == APIError.TimeOut)
                {
                    message = "General.Error.API.Timeout".Translate();
                }
                else if (apiErrorResponse.Error == APIError.UnAuthorized)
                {
                    AuthService.Instance.DeleteAllUserAuthData();
                    var appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
                    appDelegate.InitialRouter.NavigateAfterDeleteProfile();
                    return(true);
                }
            }
            else if (error is BaseClientErrorResponseInfo clientError && !String.IsNullOrEmpty(clientError.Message))
            {
                message = clientError.Message;
            }

            var title  = AppResources.ErrorInfoTitle;
            var dialog = new BasicInfoAlert(message, title);
            await dialog.ShowAsync();

            return(false);
        }
        public void ProcessAPIError(BaseErrorResponseInfo error, Action onCompleted = null)
        {
            String message = Resources.GetString(Resource.String.general_error_api_generic); //"General.Error.API.Generic".Translate();

            if (error is BaseAPIErrorResponseInfo apiErrorResponse)
            {
                if (apiErrorResponse.Error == APIError.TimeOut)
                {
                    message = Resources.GetString(Resource.String.general_error_api_timeout);
                }
            }
            else if (error is BaseClientErrorResponseInfo clientError && !String.IsNullOrEmpty(clientError.Message))
            {
                message = clientError.Message;
            }
            var title = AppResources.ErrorInfoTitle;

            Activity.RunOnUiThread(() => ShowInfoDialog(message, title, onCompleted));
        }
Example #3
0
 public Response(BaseErrorResponseInfo responseInfo) : base(responseInfo)
 {
 }