fixes for custom field name prompt

This commit is contained in:
Kyle Spearrin 2019-05-09 11:56:39 -04:00
parent a0e65fa75e
commit b07afa7f11

View file

@ -424,12 +424,20 @@ namespace Bit.App.Pages
if(typeSelection != null && typeSelection != AppResources.Cancel) if(typeSelection != null && typeSelection != AppResources.Cancel)
{ {
var name = await _deviceActionService.DisplayPromptAync(AppResources.CustomFieldName); var name = await _deviceActionService.DisplayPromptAync(AppResources.CustomFieldName);
if(name == null)
{
return;
}
if(Fields == null) if(Fields == null)
{ {
Fields = new ExtendedObservableCollection<AddEditPageFieldViewModel>(); Fields = new ExtendedObservableCollection<AddEditPageFieldViewModel>();
} }
var type = _fieldTypeOptions.FirstOrDefault(f => f.Value == typeSelection).Key; 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 set
{ {
SetProperty(ref _booleanValue, value); SetProperty(ref _booleanValue, value);
Field.Value = value ? "true" : "false"; if(IsBooleanType)
{
Field.Value = value ? "true" : "false";
}
} }
} }
public Command ToggleHiddenValueCommand { get; set; } public Command ToggleHiddenValueCommand { get; set; }
public string ShowHiddenValueIcon => _showHiddenValue ? "" : ""; public string ShowHiddenValueIcon => _showHiddenValue ? "" : "";
public bool IsTextType => _field.Type == FieldType.Text; public bool IsTextType => _field.Type == FieldType.Text;
public bool IsBooleanType => _field.Type == FieldType.Boolean; public bool IsBooleanType => _field.Type == FieldType.Boolean;