mirror of
https://github.com/bitwarden/mobile
synced 2025-12-19 09:43:27 +00:00
Site edit page. Moved site view page to a bound view model. Renamed view models to Models.Page namespace.
This commit is contained in:
52
src/App/Models/Page/VaultListPageModel.cs
Normal file
52
src/App/Models/Page/VaultListPageModel.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Bit.App.Resources;
|
||||
|
||||
namespace Bit.App.Models.Page
|
||||
{
|
||||
public class VaultListPageModel
|
||||
{
|
||||
public class Site
|
||||
{
|
||||
public Site(Models.Site site, string folderId)
|
||||
{
|
||||
Id = site.Id;
|
||||
FolderId = folderId;
|
||||
Name = site.Name?.Decrypt();
|
||||
Username = site.Username?.Decrypt();
|
||||
Password = site.Password?.Decrypt();
|
||||
Uri = site.Uri?.Decrypt();
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Uri { get; set; }
|
||||
}
|
||||
|
||||
public class Folder : ObservableCollection<Site>
|
||||
{
|
||||
public Folder(IEnumerable<Models.Site> sites, string folderId = null)
|
||||
{
|
||||
foreach(var site in sites)
|
||||
{
|
||||
Items.Add(new Site(site, folderId));
|
||||
}
|
||||
}
|
||||
|
||||
public Folder(Models.Folder folder, IEnumerable<Models.Site> sites)
|
||||
: this(sites, folder.Id)
|
||||
{
|
||||
Id = folder.Id;
|
||||
Name = folder.Name?.Decrypt();
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; } = AppResources.FolderNone;
|
||||
public string FirstLetter { get { return Name.Substring(0, 1); } }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user