1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-19 17:53:47 +00:00

view updates

This commit is contained in:
Kyle Spearrin
2019-04-16 07:43:56 -04:00
parent 40598721f1
commit 7d6ec46ebe
5 changed files with 185 additions and 12 deletions

View File

@@ -4,14 +4,34 @@ namespace Bit.Core.Models.View
{
public class IdentityView : View
{
private string _firstName;
private string _lastName;
private string _subTitle;
public IdentityView() { }
public IdentityView(Identity i) { }
public string Title { get; set; }
public string FirstName { get; set; }
public string FirstName
{
get => _firstName;
set
{
_firstName = value;
_subTitle = null;
}
}
public string MiddleName { get; set; }
public string LastName { get; set; }
public string LastName
{
get => _lastName;
set
{
_lastName = value;
_subTitle = null;
}
}
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Address3 { get; set; }
@@ -27,6 +47,83 @@ namespace Bit.Core.Models.View
public string PassportNumber { get; set; }
public string LicenseNumber { get; set; }
// TODO
public string SubTitle
{
get
{
if(_subTitle == null && (FirstName != null || LastName != null))
{
_subTitle = string.Empty;
if(FirstName != null)
{
_subTitle = FirstName;
}
if(LastName != null)
{
if(_subTitle != string.Empty)
{
_subTitle += " ";
}
_subTitle += LastName;
}
}
return _subTitle;
}
}
public string FullName
{
get
{
if(string.IsNullOrWhiteSpace(Title) || string.IsNullOrWhiteSpace(FirstName) ||
string.IsNullOrWhiteSpace(MiddleName) || string.IsNullOrWhiteSpace(LastName))
{
var name = string.Empty;
if(string.IsNullOrWhiteSpace(Title))
{
name = string.Concat(name, Title, " ");
}
if(string.IsNullOrWhiteSpace(FirstName))
{
name = string.Concat(name, FirstName, " ");
}
if(string.IsNullOrWhiteSpace(MiddleName))
{
name = string.Concat(name, MiddleName, " ");
}
if(string.IsNullOrWhiteSpace(LastName))
{
name = string.Concat(name, LastName);
}
return name.Trim();
}
return null;
}
}
public string FullAddress
{
get
{
var address = Address1;
if(string.IsNullOrWhiteSpace(Address2))
{
if(string.IsNullOrWhiteSpace(address))
{
address += ", ";
}
address += Address2;
}
if(string.IsNullOrWhiteSpace(Address3))
{
if(string.IsNullOrWhiteSpace(address))
{
address += ", ";
}
address += Address3;
}
return address;
}
}
}
}