public async Task Execute(IActionFlowParmeters parameters) { try { await _deviceActionService.ShowLoadingAsync(AppResources.DeletingYourAccount); await _apiService.DeleteAccountAsync(new Core.Models.Request.DeleteAccountRequest { MasterPasswordHash = parameters.VerificationType == Core.Enums.VerificationType.MasterPassword ? parameters.Secret : (string)null, OTP = parameters.VerificationType == Core.Enums.VerificationType.OTP ? parameters.Secret : (string)null }); await _deviceActionService.HideLoadingAsync(); _messagingService.Send("logout"); await _platformUtilsService.ShowDialogAsync(AppResources.YourAccountHasBeenPermanentlyDeleted); } catch (ApiException apiEx) { await _deviceActionService.HideLoadingAsync(); if (apiEx?.Error != null) { await _platformUtilsService.ShowDialogAsync(apiEx.Error.GetSingleMessage(), AppResources.AnErrorHasOccurred); } } catch (System.Exception ex) { await _deviceActionService.HideLoadingAsync(); _logger.Exception(ex); await _platformUtilsService.ShowDialogAsync(AppResources.AnErrorHasOccurred); } }
public IActionFlowParmeters GetParameters() { if (_parameters is null) { _parameters = new DefaultActionFlowParameters(); } return(_parameters); }
public IVerificationActionsFlowHelper Configure(VerificationFlowAction action, IActionFlowParmeters parameters = null, string verificationCodeMainActionText = null, bool isVerificationCodeMainActionStyleDanger = false) { _action = action; _parameters = parameters; _verificationCodeMainActionText = verificationCodeMainActionText; _isVerificationCodeMainActionStyleDanger = isVerificationCodeMainActionStyleDanger; return(this); }
/// <summary> /// Executes the action with the given parameters after we have gotten the verification secret /// </summary> public async Task ExecuteAsync(IActionFlowParmeters parameters) { if (!_action.HasValue) { // this should never happen throw new InvalidOperationException("A problem occurred while getting the action value after validation"); } if (!_actionExecutionerDictionary.TryGetValue(_action.Value, out var executioner)) { throw new InvalidOperationException($"There is no executioner for {_action}"); } await executioner.Execute(GetParameters()); }