1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-07 11:03:54 +00:00

Reactor rename Sites => Logins

This commit is contained in:
Kyle Spearrin
2017-01-03 00:17:15 -05:00
parent a176542114
commit 991afb7722
45 changed files with 543 additions and 542 deletions

View File

@@ -1,16 +1,16 @@
namespace Bit.App.Models.Api
{
public class SiteRequest
public class LoginRequest
{
public SiteRequest(Site site)
public LoginRequest(Login login)
{
FolderId = site.FolderId;
Name = site.Name?.EncryptedString;
Uri = site.Uri?.EncryptedString;
Username = site.Username?.EncryptedString;
Password = site.Password?.EncryptedString;
Notes = site.Notes?.EncryptedString;
Favorite = site.Favorite;
FolderId = login.FolderId;
Name = login.Name?.EncryptedString;
Uri = login.Uri?.EncryptedString;
Username = login.Username?.EncryptedString;
Password = login.Password?.EncryptedString;
Notes = login.Notes?.EncryptedString;
Favorite = login.Favorite;
}
public string FolderId { get; set; }

View File

@@ -2,7 +2,7 @@
namespace Bit.App.Models.Api
{
public class SiteResponse
public class LoginResponse
{
public string Id { get; set; }
public string FolderId { get; set; }

View File

@@ -1,6 +1,6 @@
namespace Bit.App.Models.Api
{
public class SiteDataModel
public class LoginDataModel
{
public string Name { get; set; }
public string Uri { get; set; }

View File

@@ -33,7 +33,7 @@ namespace Bit.App.Models.Data
throw new ArgumentException(nameof(cipher.Type));
}
var data = cipher.Data.ToObject<SiteDataModel>();
var data = cipher.Data.ToObject<LoginDataModel>();
Id = cipher.Id;
UserId = userId;

View File

@@ -6,46 +6,46 @@ using Bit.App.Models.Api;
namespace Bit.App.Models.Data
{
[Table("Site")]
public class SiteData : IDataObject<string>
public class LoginData : IDataObject<string>
{
public SiteData()
public LoginData()
{ }
public SiteData(Site site, string userId)
public LoginData(Login login, string userId)
{
Id = site.Id;
FolderId = site.FolderId;
Id = login.Id;
FolderId = login.FolderId;
UserId = userId;
Name = site.Name?.EncryptedString;
Uri = site.Uri?.EncryptedString;
Username = site.Username?.EncryptedString;
Password = site.Password?.EncryptedString;
Notes = site.Notes?.EncryptedString;
Favorite = site.Favorite;
Name = login.Name?.EncryptedString;
Uri = login.Uri?.EncryptedString;
Username = login.Username?.EncryptedString;
Password = login.Password?.EncryptedString;
Notes = login.Notes?.EncryptedString;
Favorite = login.Favorite;
}
public SiteData(SiteResponse site, string userId)
public LoginData(LoginResponse login, string userId)
{
Id = site.Id;
FolderId = site.FolderId;
Id = login.Id;
FolderId = login.FolderId;
UserId = userId;
Name = site.Name;
Uri = site.Uri;
Username = site.Username;
Password = site.Password;
Notes = site.Notes;
Favorite = site.Favorite;
RevisionDateTime = site.RevisionDate;
Name = login.Name;
Uri = login.Uri;
Username = login.Username;
Password = login.Password;
Notes = login.Notes;
Favorite = login.Favorite;
RevisionDateTime = login.RevisionDate;
}
public SiteData(CipherResponse cipher, string userId)
public LoginData(CipherResponse cipher, string userId)
{
if(cipher.Type != Enums.CipherType.Site)
if(cipher.Type != Enums.CipherType.Login)
{
throw new ArgumentException(nameof(cipher.Type));
}
var data = cipher.Data.ToObject<SiteDataModel>();
var data = cipher.Data.ToObject<LoginDataModel>();
Id = cipher.Id;
FolderId = cipher.FolderId;
@@ -72,9 +72,9 @@ namespace Bit.App.Models.Data
public bool Favorite { get; set; }
public DateTime RevisionDateTime { get; set; } = DateTime.UtcNow;
public Site ToSite()
public Login ToLogin()
{
return new Site(this);
return new Login(this);
}
}
}

View File

@@ -6,16 +6,16 @@ namespace Bit.App.Models.Page
{
public class VaultListPageModel
{
public class Site
public class Login
{
public Site(Models.Site site)
public Login(Models.Login login)
{
Id = site.Id;
FolderId = site.FolderId;
Name = site.Name?.Decrypt();
Username = site.Username?.Decrypt() ?? " ";
Password = new Lazy<string>(() => site.Password?.Decrypt());
Uri = new Lazy<string>(() => site.Uri?.Decrypt());
Id = login.Id;
FolderId = login.FolderId;
Name = login.Name?.Decrypt();
Username = login.Username?.Decrypt() ?? " ";
Password = new Lazy<string>(() => login.Password?.Decrypt());
Uri = new Lazy<string>(() => login.Uri?.Decrypt());
}
public string Id { get; set; }
@@ -26,7 +26,7 @@ namespace Bit.App.Models.Page
public Lazy<string> Uri { get; set; }
}
public class Folder : List<Site>
public class Folder : List<Login>
{
public Folder(Models.Folder folder)
{
@@ -34,9 +34,9 @@ namespace Bit.App.Models.Page
Name = folder.Name?.Decrypt();
}
public Folder(List<Site> sites)
public Folder(List<Login> logins)
{
AddRange(sites);
AddRange(logins);
}
public string Id { get; set; }

View File

@@ -5,7 +5,7 @@ using Xamarin.Forms;
namespace Bit.App.Models.Page
{
public class VaultViewSitePageModel : INotifyPropertyChanged
public class VaultViewLoginPageModel : INotifyPropertyChanged
{
private string _name;
private string _username;
@@ -15,7 +15,7 @@ namespace Bit.App.Models.Page
private bool _revealPassword;
private string _uriHost;
public VaultViewSitePageModel() { }
public VaultViewLoginPageModel() { }
public event PropertyChangedEventHandler PropertyChanged;
@@ -176,13 +176,13 @@ namespace Bit.App.Models.Page
public string ShowHideText => RevealPassword ? AppResources.Hide : AppResources.Show;
public ImageSource ShowHideImage => RevealPassword ? ImageSource.FromFile("eye_slash") : ImageSource.FromFile("eye");
public void Update(Site site)
public void Update(Login login)
{
Name = site.Name?.Decrypt();
Username = site.Username?.Decrypt();
Password = site.Password?.Decrypt();
Uri = site.Uri?.Decrypt();
Notes = site.Notes?.Decrypt();
Name = login.Name?.Decrypt();
Username = login.Username?.Decrypt();
Password = login.Password?.Decrypt();
Uri = login.Uri?.Decrypt();
Notes = login.Notes?.Decrypt();
}
}
}

View File

@@ -3,12 +3,12 @@ using Bit.App.Models.Data;
namespace Bit.App.Models
{
public class Site : Cipher
public class Login : Cipher
{
public Site()
public Login()
{ }
public Site(SiteData data)
public Login(LoginData data)
{
Id = data.Id;
FolderId = data.FolderId;
@@ -20,7 +20,7 @@ namespace Bit.App.Models
Favorite = data.Favorite;
}
public Site(SiteResponse response)
public Login(LoginResponse response)
{
Id = response.Id;
FolderId = response.FolderId;
@@ -39,14 +39,14 @@ namespace Bit.App.Models
public CipherString Notes { get; set; }
public bool Favorite { get; set; }
public SiteRequest ToSiteRequest()
public LoginRequest ToLoginRequest()
{
return new SiteRequest(this);
return new LoginRequest(this);
}
public SiteData ToSiteData(string userId)
public LoginData ToLoginData(string userId)
{
return new SiteData(this, userId);
return new LoginData(this, userId);
}
}
}