diff --git a/src/App/Models/ViewFieldViewModel.cs b/src/App/Models/ViewFieldViewModel.cs
index e3bd62961..8bba95145 100644
--- a/src/App/Models/ViewFieldViewModel.cs
+++ b/src/App/Models/ViewFieldViewModel.cs
@@ -1,15 +1,18 @@
using Bit.App.Pages;
using Bit.Core.Models.View;
+using Xamarin.Forms;
namespace Bit.App.Models
{
public class ViewFieldViewModel : BaseViewModel
{
private FieldView _field;
+ private bool _showHiddenValue;
public ViewFieldViewModel(FieldView field)
{
Field = field;
+ ToggleHiddenValueCommand = new Command(ToggleHiddenValue);
}
public FieldView Field
@@ -18,8 +21,37 @@ namespace Bit.App.Models
set => SetProperty(ref _field, value,
additionalPropertyNames: new string[]
{
-
+ nameof(ValueText),
+ nameof(IsBooleanType),
+ nameof(IsHiddenType),
+ nameof(IsTextType),
+ nameof(ShowCopyButton),
});
}
+
+ public bool ShowHiddenValue
+ {
+ get => _showHiddenValue;
+ set => SetProperty(ref _showHiddenValue, value,
+ additionalPropertyNames: new string[]
+ {
+ nameof(ShowHiddenValueIcon)
+ });
+ }
+
+ public Command ToggleHiddenValueCommand { get; set; }
+
+ public string ValueText => IsBooleanType ? (_field.Value == "true" ? "" : "") : _field.Value;
+ public string ShowHiddenValueIcon => _showHiddenValue ? "" : "";
+ public bool IsTextType => _field.Type == Core.Enums.FieldType.Text;
+ public bool IsBooleanType => _field.Type == Core.Enums.FieldType.Boolean;
+ public bool IsHiddenType => _field.Type == Core.Enums.FieldType.Hidden;
+ public bool ShowCopyButton => _field.Type != Core.Enums.FieldType.Boolean &&
+ !string.IsNullOrWhiteSpace(_field.Value);
+
+ public void ToggleHiddenValue()
+ {
+ ShowHiddenValue = !ShowHiddenValue;
+ }
}
}
diff --git a/src/App/Pages/Vault/ViewPage.xaml b/src/App/Pages/Vault/ViewPage.xaml
index 21e7818ac..2f955b61b 100644
--- a/src/App/Pages/Vault/ViewPage.xaml
+++ b/src/App/Pages/Vault/ViewPage.xaml
@@ -490,6 +490,7 @@
+
+ Grid.Column="0"
+ IsVisible="{Binding IsTextType}" />
+
+
+
+
+
+
diff --git a/src/App/Pages/Vault/ViewPageViewModel.cs b/src/App/Pages/Vault/ViewPageViewModel.cs
index 4ea87688a..fef59dfc7 100644
--- a/src/App/Pages/Vault/ViewPageViewModel.cs
+++ b/src/App/Pages/Vault/ViewPageViewModel.cs
@@ -42,6 +42,7 @@ namespace Bit.App.Pages
_auditService = ServiceContainer.Resolve("auditService");
CopyCommand = new Command((id) => CopyAsync(id, null));
CopyUriCommand = new Command(CopyUri);
+ CopyFieldCommand = new Command(CopyField);
LaunchUriCommand = new Command(LaunchUri);
TogglePasswordCommand = new Command(TogglePassword);
ToggleCardCodeCommand = new Command(ToggleCardCode);
@@ -52,6 +53,7 @@ namespace Bit.App.Pages
public Command CopyCommand { get; set; }
public Command CopyUriCommand { get; set; }
+ public Command CopyFieldCommand { get; set; }
public Command LaunchUriCommand { get; set; }
public Command TogglePasswordCommand { get; set; }
public Command ToggleCardCodeCommand { get; set; }
@@ -265,6 +267,10 @@ namespace Bit.App.Pages
{
name = AppResources.URI;
}
+ else if(id == "FieldValue")
+ {
+ name = AppResources.Value;
+ }
else if(id == "CardNumber")
{
text = Cipher.Card.Number;
@@ -291,6 +297,11 @@ namespace Bit.App.Pages
CopyAsync("LoginUri", uri.Uri);
}
+ private void CopyField(FieldView field)
+ {
+ CopyAsync("FieldValue", field.Value);
+ }
+
private void LaunchUri(LoginUriView uri)
{
if(uri.CanLaunch)
diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs
index 2d29d9c4a..e8ab87d12 100644
--- a/src/App/Resources/AppResources.Designer.cs
+++ b/src/App/Resources/AppResources.Designer.cs
@@ -3363,6 +3363,15 @@ namespace Bit.App.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Value.
+ ///
+ internal static string Value {
+ get {
+ return ResourceManager.GetString("Value", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to {0} has been copied..
///
diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx
index bcbefcfcf..2238c900d 100644
--- a/src/App/Resources/AppResources.resx
+++ b/src/App/Resources/AppResources.resx
@@ -1384,4 +1384,7 @@
Identity Name
+
+ Value
+
\ No newline at end of file