bitwarden-android/src/App/Models/View/VaultView.cs

52 lines
1.5 KiB
C#
Raw Normal View History

2016-05-02 09:52:09 +03:00
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Bit.App.Models.View
{
public class VaultView
{
public class Site
{
2016-05-04 02:49:49 +03:00
public Site(Models.Site site, string folderId)
2016-05-02 09:52:09 +03:00
{
Id = site.Id;
2016-05-04 02:49:49 +03:00
FolderId = folderId;
2016-05-02 09:52:09 +03:00
Name = site.Name?.Decrypt();
Username = site.Username?.Decrypt();
Password = site.Password?.Decrypt();
Uri = site.Uri?.Decrypt();
2016-05-02 09:52:09 +03:00
}
2016-05-03 09:08:50 +03:00
public string Id { get; set; }
2016-05-04 02:49:49 +03:00
public string FolderId { get; set; }
2016-05-02 09:52:09 +03:00
public string Name { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Uri { get; set; }
2016-05-02 09:52:09 +03:00
}
public class Folder : ObservableCollection<Site>
{
2016-05-04 02:49:49 +03:00
public Folder(IEnumerable<Models.Site> sites, string folderId = null)
2016-05-02 09:52:09 +03:00
{
foreach(var site in sites)
{
2016-05-04 02:49:49 +03:00
Items.Add(new Site(site, folderId));
2016-05-02 09:52:09 +03:00
}
}
public Folder(Models.Folder folder, IEnumerable<Models.Site> sites)
2016-05-04 02:49:49 +03:00
: this(sites, folder.Id)
2016-05-02 09:52:09 +03:00
{
Id = folder.Id;
Name = folder.Name?.Decrypt();
}
2016-05-03 09:08:50 +03:00
public string Id { get; set; }
2016-05-04 02:49:49 +03:00
public string Name { get; set; } = "(none)";
2016-05-02 09:52:09 +03:00
public string FirstLetter { get { return Name.Substring(0, 1); } }
}
}
}