2019-05-01 17:31:00 +02:00
|
|
|
|
using Bit.App.Resources;
|
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
using Bit.Core.Models.View;
|
2019-03-29 18:24:44 +01:00
|
|
|
|
|
|
|
|
|
namespace Bit.App.Pages
|
|
|
|
|
{
|
|
|
|
|
public class GroupingsPageListItem
|
|
|
|
|
{
|
2019-04-22 23:08:37 +02:00
|
|
|
|
private string _icon;
|
2019-05-01 17:31:00 +02:00
|
|
|
|
private string _name;
|
2019-04-22 23:08:37 +02:00
|
|
|
|
|
2019-03-29 18:24:44 +01:00
|
|
|
|
public FolderView Folder { get; set; }
|
2019-04-19 22:45:16 +02:00
|
|
|
|
public CollectionView Collection { get; set; }
|
2019-03-29 18:24:44 +01:00
|
|
|
|
public CipherView Cipher { get; set; }
|
2019-05-01 17:31:00 +02:00
|
|
|
|
public CipherType? Type { get; set; }
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if(_name != null)
|
|
|
|
|
{
|
|
|
|
|
return _name;
|
|
|
|
|
}
|
|
|
|
|
if(Folder != null)
|
|
|
|
|
{
|
|
|
|
|
_name = Folder.Name;
|
|
|
|
|
}
|
|
|
|
|
else if(Collection != null)
|
|
|
|
|
{
|
|
|
|
|
_name = Collection.Name;
|
|
|
|
|
}
|
|
|
|
|
else if(Type != null)
|
|
|
|
|
{
|
|
|
|
|
switch(Type.Value)
|
|
|
|
|
{
|
|
|
|
|
case CipherType.Login:
|
|
|
|
|
_name = AppResources.TypeLogin;
|
|
|
|
|
break;
|
|
|
|
|
case CipherType.SecureNote:
|
|
|
|
|
_name = AppResources.TypeSecureNote;
|
|
|
|
|
break;
|
|
|
|
|
case CipherType.Card:
|
|
|
|
|
_name = AppResources.TypeCard;
|
|
|
|
|
break;
|
|
|
|
|
case CipherType.Identity:
|
|
|
|
|
_name = AppResources.TypeIdentity;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 23:08:37 +02:00
|
|
|
|
public string Icon
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if(_icon != null)
|
|
|
|
|
{
|
|
|
|
|
return _icon;
|
|
|
|
|
}
|
|
|
|
|
if(Folder != null)
|
|
|
|
|
{
|
|
|
|
|
_icon = Folder.Id == null ? "" : "";
|
|
|
|
|
}
|
|
|
|
|
else if(Collection != null)
|
|
|
|
|
{
|
|
|
|
|
_icon = "";
|
|
|
|
|
}
|
2019-05-01 17:31:00 +02:00
|
|
|
|
else if(Type != null)
|
|
|
|
|
{
|
|
|
|
|
switch(Type.Value)
|
|
|
|
|
{
|
|
|
|
|
case CipherType.Login:
|
|
|
|
|
_icon = "";
|
|
|
|
|
break;
|
|
|
|
|
case CipherType.SecureNote:
|
|
|
|
|
_icon = "";
|
|
|
|
|
break;
|
|
|
|
|
case CipherType.Card:
|
|
|
|
|
_icon = "";
|
|
|
|
|
break;
|
|
|
|
|
case CipherType.Identity:
|
|
|
|
|
_icon = "";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
_icon = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-22 23:08:37 +02:00
|
|
|
|
return _icon;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-29 18:24:44 +01:00
|
|
|
|
}
|
|
|
|
|
}
|