From b07afa7f11847fc060e0d2bf83ccbebd6ca1582f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 9 May 2019 11:56:39 -0400 Subject: [PATCH] fixes for custom field name prompt --- src/App/Pages/Vault/AddEditPageViewModel.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/App/Pages/Vault/AddEditPageViewModel.cs b/src/App/Pages/Vault/AddEditPageViewModel.cs index 9158c623e..6fbe319d0 100644 --- a/src/App/Pages/Vault/AddEditPageViewModel.cs +++ b/src/App/Pages/Vault/AddEditPageViewModel.cs @@ -424,12 +424,20 @@ namespace Bit.App.Pages if(typeSelection != null && typeSelection != AppResources.Cancel) { var name = await _deviceActionService.DisplayPromptAync(AppResources.CustomFieldName); + if(name == null) + { + return; + } if(Fields == null) { Fields = new ExtendedObservableCollection(); } var type = _fieldTypeOptions.FirstOrDefault(f => f.Value == typeSelection).Key; - Fields.Add(new AddEditPageFieldViewModel(new FieldView { Type = type, Name = name })); + Fields.Add(new AddEditPageFieldViewModel(new FieldView + { + Type = type, + Name = string.IsNullOrWhiteSpace(name) ? null : name + })); } } @@ -547,12 +555,15 @@ namespace Bit.App.Pages set { SetProperty(ref _booleanValue, value); - Field.Value = value ? "true" : "false"; + if(IsBooleanType) + { + Field.Value = value ? "true" : "false"; + } } } public Command ToggleHiddenValueCommand { get; set; } - + public string ShowHiddenValueIcon => _showHiddenValue ? "" : ""; public bool IsTextType => _field.Type == FieldType.Text; public bool IsBooleanType => _field.Type == FieldType.Boolean;