1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

more renames

This commit is contained in:
Kyle Spearrin 2017-10-19 16:08:29 -04:00
parent ebbe704672
commit d2468d144e
3 changed files with 49 additions and 49 deletions

View File

@ -153,7 +153,7 @@
<Compile Include="Models\PlatformCulture.cs" /> <Compile Include="Models\PlatformCulture.cs" />
<Compile Include="Models\PushNotification.cs" /> <Compile Include="Models\PushNotification.cs" />
<Compile Include="Models\Cipher.cs" /> <Compile Include="Models\Cipher.cs" />
<Compile Include="Models\Page\VaultViewLoginPageModel.cs" /> <Compile Include="Models\Page\VaultViewCipherPageModel.cs" />
<Compile Include="Pages\HomePage.cs" /> <Compile Include="Pages\HomePage.cs" />
<Compile Include="Pages\Lock\BaseLockPage.cs" /> <Compile Include="Pages\Lock\BaseLockPage.cs" />
<Compile Include="Pages\Lock\LockPasswordPage.cs" /> <Compile Include="Pages\Lock\LockPasswordPage.cs" />

View File

@ -7,7 +7,7 @@ using Bit.App.Enums;
namespace Bit.App.Models.Page namespace Bit.App.Models.Page
{ {
public class VaultViewLoginPageModel : INotifyPropertyChanged public class VaultViewCipherPageModel : INotifyPropertyChanged
{ {
private string _name; private string _name;
private string _username; private string _username;
@ -20,7 +20,7 @@ namespace Bit.App.Models.Page
private List<Attachment> _attachments; private List<Attachment> _attachments;
private List<Field> _fields; private List<Field> _fields;
public VaultViewLoginPageModel() { } public VaultViewCipherPageModel() { }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

View File

@ -17,16 +17,16 @@ namespace Bit.App.Pages
{ {
public class VaultViewCipherPage : ExtendedContentPage public class VaultViewCipherPage : ExtendedContentPage
{ {
private readonly string _loginId; private readonly string _cipherId;
private readonly ICipherService _cipherService; private readonly ICipherService _cipherService;
private readonly IUserDialogs _userDialogs; private readonly IUserDialogs _userDialogs;
private readonly IDeviceActionService _deviceActionService; private readonly IDeviceActionService _deviceActionService;
private readonly ITokenService _tokenService; private readonly ITokenService _tokenService;
private bool _pageDisappeared = true; private bool _pageDisappeared = true;
public VaultViewCipherPage(string loginId) public VaultViewCipherPage(string cipherId)
{ {
_loginId = loginId; _cipherId = cipherId;
_cipherService = Resolver.Resolve<ICipherService>(); _cipherService = Resolver.Resolve<ICipherService>();
_userDialogs = Resolver.Resolve<IUserDialogs>(); _userDialogs = Resolver.Resolve<IUserDialogs>();
_deviceActionService = Resolver.Resolve<IDeviceActionService>(); _deviceActionService = Resolver.Resolve<IDeviceActionService>();
@ -35,9 +35,9 @@ namespace Bit.App.Pages
Init(); Init();
} }
private VaultViewLoginPageModel Model { get; set; } = new VaultViewLoginPageModel(); private VaultViewCipherPageModel Model { get; set; } = new VaultViewCipherPageModel();
private ExtendedTableView Table { get; set; } private ExtendedTableView Table { get; set; }
private TableSection LoginInformationSection { get; set; } private TableSection ItemInformationSection { get; set; }
private TableSection NotesSection { get; set; } private TableSection NotesSection { get; set; }
private TableSection AttachmentsSection { get; set; } private TableSection AttachmentsSection { get; set; }
private TableSection FieldsSection { get; set; } private TableSection FieldsSection { get; set; }
@ -46,13 +46,13 @@ namespace Bit.App.Pages
public LabeledValueCell UriCell { get; set; } public LabeledValueCell UriCell { get; set; }
public LabeledValueCell NotesCell { get; set; } public LabeledValueCell NotesCell { get; set; }
public LabeledValueCell TotpCodeCell { get; set; } public LabeledValueCell TotpCodeCell { get; set; }
private EditLoginToolBarItem EditItem { get; set; } private EditCipherToolBarItem EditItem { get; set; }
public List<LabeledValueCell> FieldsCells { get; set; } public List<LabeledValueCell> FieldsCells { get; set; }
public List<AttachmentViewCell> AttachmentCells { get; set; } public List<AttachmentViewCell> AttachmentCells { get; set; }
private void Init() private void Init()
{ {
EditItem = new EditLoginToolBarItem(this, _loginId); EditItem = new EditCipherToolBarItem(this, _cipherId);
ToolbarItems.Add(EditItem); ToolbarItems.Add(EditItem);
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows) if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{ {
@ -61,19 +61,19 @@ namespace Bit.App.Pages
// Name // Name
var nameCell = new LabeledValueCell(AppResources.Name); var nameCell = new LabeledValueCell(AppResources.Name);
nameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Name)); nameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.Name));
// Username // Username
UsernameCell = new LabeledValueCell(AppResources.Username, button1Image: "clipboard.png"); UsernameCell = new LabeledValueCell(AppResources.Username, button1Image: "clipboard.png");
UsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Username)); UsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.Username));
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username)); UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
UsernameCell.Value.LineBreakMode = LineBreakMode.WordWrap; UsernameCell.Value.LineBreakMode = LineBreakMode.WordWrap;
// Password // Password
PasswordCell = new LabeledValueCell(AppResources.Password, button1Image: string.Empty, PasswordCell = new LabeledValueCell(AppResources.Password, button1Image: string.Empty,
button2Image: "clipboard.png"); button2Image: "clipboard.png");
PasswordCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.MaskedPassword)); PasswordCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.MaskedPassword));
PasswordCell.Button1.SetBinding(Button.ImageProperty, nameof(VaultViewLoginPageModel.ShowHideImage)); PasswordCell.Button1.SetBinding(Button.ImageProperty, nameof(VaultViewCipherPageModel.ShowHideImage));
if(Device.RuntimePlatform == Device.iOS) if(Device.RuntimePlatform == Device.iOS)
{ {
PasswordCell.Button1.Margin = new Thickness(10, 0); PasswordCell.Button1.Margin = new Thickness(10, 0);
@ -85,8 +85,8 @@ namespace Bit.App.Pages
// URI // URI
UriCell = new LabeledValueCell(AppResources.Website, button1Image: "launch.png"); UriCell = new LabeledValueCell(AppResources.Website, button1Image: "launch.png");
UriCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.UriHost)); UriCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.UriHost));
UriCell.Button1.SetBinding(IsVisibleProperty, nameof(VaultViewLoginPageModel.ShowLaunch)); UriCell.Button1.SetBinding(IsVisibleProperty, nameof(VaultViewCipherPageModel.ShowLaunch));
UriCell.Button1.Command = new Command(() => UriCell.Button1.Command = new Command(() =>
{ {
if(Device.RuntimePlatform == Device.Android && Model.Uri.StartsWith("androidapp://")) if(Device.RuntimePlatform == Device.Android && Model.Uri.StartsWith("androidapp://"))
@ -101,19 +101,19 @@ namespace Bit.App.Pages
// Totp // Totp
TotpCodeCell = new LabeledValueCell(AppResources.VerificationCodeTotp, button1Image: "clipboard.png", subText: "--"); TotpCodeCell = new LabeledValueCell(AppResources.VerificationCodeTotp, button1Image: "clipboard.png", subText: "--");
TotpCodeCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.TotpCodeFormatted)); TotpCodeCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.TotpCodeFormatted));
TotpCodeCell.Value.SetBinding(Label.TextColorProperty, nameof(VaultViewLoginPageModel.TotpColor)); TotpCodeCell.Value.SetBinding(Label.TextColorProperty, nameof(VaultViewCipherPageModel.TotpColor));
TotpCodeCell.Button1.Command = new Command(() => Copy(Model.TotpCode, AppResources.VerificationCodeTotp)); TotpCodeCell.Button1.Command = new Command(() => Copy(Model.TotpCode, AppResources.VerificationCodeTotp));
TotpCodeCell.Sub.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.TotpSecond)); TotpCodeCell.Sub.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.TotpSecond));
TotpCodeCell.Sub.SetBinding(Label.TextColorProperty, nameof(VaultViewLoginPageModel.TotpColor)); TotpCodeCell.Sub.SetBinding(Label.TextColorProperty, nameof(VaultViewCipherPageModel.TotpColor));
TotpCodeCell.Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", WinPhone: "Courier"); TotpCodeCell.Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", WinPhone: "Courier");
// Notes // Notes
NotesCell = new LabeledValueCell(); NotesCell = new LabeledValueCell();
NotesCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Notes)); NotesCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.Notes));
NotesCell.Value.LineBreakMode = LineBreakMode.WordWrap; NotesCell.Value.LineBreakMode = LineBreakMode.WordWrap;
LoginInformationSection = new TableSection(AppResources.ItemInformation) ItemInformationSection = new TableSection(AppResources.ItemInformation)
{ {
nameCell nameCell
}; };
@ -131,7 +131,7 @@ namespace Bit.App.Pages
EnableSelection = true, EnableSelection = true,
Root = new TableRoot Root = new TableRoot
{ {
LoginInformationSection ItemInformationSection
} }
}; };
@ -152,7 +152,7 @@ namespace Bit.App.Pages
NotesCell.Tapped += NotesCell_Tapped; NotesCell.Tapped += NotesCell_Tapped;
EditItem.InitEvents(); EditItem.InitEvents();
var cipher = await _cipherService.GetByIdAsync(_loginId); var cipher = await _cipherService.GetByIdAsync(_cipherId);
if(cipher == null) if(cipher == null)
{ {
await Navigation.PopForDeviceAsync(); await Navigation.PopForDeviceAsync();
@ -161,31 +161,31 @@ namespace Bit.App.Pages
Model.Update(cipher); Model.Update(cipher);
if(LoginInformationSection.Contains(UriCell)) if(ItemInformationSection.Contains(UriCell))
{ {
LoginInformationSection.Remove(UriCell); ItemInformationSection.Remove(UriCell);
} }
if(Model.ShowUri) if(Model.ShowUri)
{ {
LoginInformationSection.Add(UriCell); ItemInformationSection.Add(UriCell);
} }
if(LoginInformationSection.Contains(UsernameCell)) if(ItemInformationSection.Contains(UsernameCell))
{ {
LoginInformationSection.Remove(UsernameCell); ItemInformationSection.Remove(UsernameCell);
} }
if(Model.ShowUsername) if(Model.ShowUsername)
{ {
LoginInformationSection.Add(UsernameCell); ItemInformationSection.Add(UsernameCell);
} }
if(LoginInformationSection.Contains(PasswordCell)) if(ItemInformationSection.Contains(PasswordCell))
{ {
LoginInformationSection.Remove(PasswordCell); ItemInformationSection.Remove(PasswordCell);
} }
if(Model.ShowPassword) if(Model.ShowPassword)
{ {
LoginInformationSection.Add(PasswordCell); ItemInformationSection.Add(PasswordCell);
} }
if(Table.Root.Contains(NotesSection)) if(Table.Root.Contains(NotesSection))
@ -198,9 +198,9 @@ namespace Bit.App.Pages
} }
// Totp // Totp
if(LoginInformationSection.Contains(TotpCodeCell)) if(ItemInformationSection.Contains(TotpCodeCell))
{ {
LoginInformationSection.Remove(TotpCodeCell); ItemInformationSection.Remove(TotpCodeCell);
} }
if(cipher.Login?.Totp != null && (_tokenService.TokenPremium || cipher.OrganizationUseTotp)) if(cipher.Login?.Totp != null && (_tokenService.TokenPremium || cipher.OrganizationUseTotp))
{ {
@ -222,7 +222,7 @@ namespace Bit.App.Pages
return true; return true;
}); });
LoginInformationSection.Add(TotpCodeCell); ItemInformationSection.Add(TotpCodeCell);
} }
} }
} }
@ -300,9 +300,9 @@ namespace Bit.App.Pages
} }
} }
private async Task OpenAttachmentAsync(Cipher login, VaultViewLoginPageModel.Attachment attachment) private async Task OpenAttachmentAsync(Cipher cipher, VaultViewCipherPageModel.Attachment attachment)
{ {
if(!_tokenService.TokenPremium && !login.OrganizationUseTotp) if(!_tokenService.TokenPremium && !cipher.OrganizationUseTotp)
{ {
_userDialogs.Alert(AppResources.PremiumRequired); _userDialogs.Alert(AppResources.PremiumRequired);
return; return;
@ -323,7 +323,7 @@ namespace Bit.App.Pages
} }
_userDialogs.ShowLoading(AppResources.Downloading, MaskType.Black); _userDialogs.ShowLoading(AppResources.Downloading, MaskType.Black);
var data = await _cipherService.DownloadAndDecryptAttachmentAsync(attachment.Url, login.OrganizationId); var data = await _cipherService.DownloadAndDecryptAttachmentAsync(attachment.Url, cipher.OrganizationId);
_userDialogs.HideLoading(); _userDialogs.HideLoading();
if(data == null) if(data == null)
{ {
@ -361,22 +361,22 @@ namespace Bit.App.Pages
} }
} }
private class EditLoginToolBarItem : ExtendedToolbarItem private class EditCipherToolBarItem : ExtendedToolbarItem
{ {
private readonly VaultViewCipherPage _page; private readonly VaultViewCipherPage _page;
private readonly string _loginId; private readonly string _cipherId;
public EditLoginToolBarItem(VaultViewCipherPage page, string loginId) public EditCipherToolBarItem(VaultViewCipherPage page, string cipherId)
{ {
_page = page; _page = page;
_loginId = loginId; _cipherId = cipherId;
Text = AppResources.Edit; Text = AppResources.Edit;
ClickAction = async () => await ClickedItem(); ClickAction = async () => await ClickedItem();
} }
private async Task ClickedItem() private async Task ClickedItem()
{ {
var page = new VaultEditCipherPage(_loginId); var page = new VaultEditCipherPage(_cipherId);
await _page.Navigation.PushForDeviceAsync(page); await _page.Navigation.PushForDeviceAsync(page);
} }
} }
@ -385,7 +385,7 @@ namespace Bit.App.Pages
{ {
private readonly Action _tapped; private readonly Action _tapped;
public AttachmentViewCell(VaultViewLoginPageModel.Attachment attachment, Action tappedAction) public AttachmentViewCell(VaultViewCipherPageModel.Attachment attachment, Action tappedAction)
{ {
_tapped = tappedAction; _tapped = tappedAction;
Label.Text = attachment.Name; Label.Text = attachment.Name;
@ -413,19 +413,19 @@ namespace Bit.App.Pages
public class FieldViewCell : LabeledValueCell public class FieldViewCell : LabeledValueCell
{ {
public FieldViewCell(VaultViewCipherPage page, VaultViewLoginPageModel.Field field) public FieldViewCell(VaultViewCipherPage page, VaultViewCipherPageModel.Field field)
: base(field.Name, field.Value == "true" ? "✓" : "-") : base(field.Name, field.Value == "true" ? "✓" : "-")
{ {
Init(page, field, null); Init(page, field, null);
} }
public FieldViewCell(VaultViewCipherPage page, VaultViewLoginPageModel.Field field, bool? a) public FieldViewCell(VaultViewCipherPage page, VaultViewCipherPageModel.Field field, bool? a)
: base(field.Name, field.Value, "clipboard.png") : base(field.Name, field.Value, "clipboard.png")
{ {
Init(page, field, Button1); Init(page, field, Button1);
} }
public FieldViewCell(VaultViewCipherPage page, VaultViewLoginPageModel.Field field, bool? a, bool? b) public FieldViewCell(VaultViewCipherPage page, VaultViewCipherPageModel.Field field, bool? a, bool? b)
: base(field.Name, field.MaskedValue, string.Empty, "clipboard.png") : base(field.Name, field.MaskedValue, string.Empty, "clipboard.png")
{ {
Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular",
@ -454,7 +454,7 @@ namespace Bit.App.Pages
Init(page, field, Button2); Init(page, field, Button2);
} }
private void Init(VaultViewCipherPage page, VaultViewLoginPageModel.Field field, ExtendedButton copyButton) private void Init(VaultViewCipherPage page, VaultViewCipherPageModel.Field field, ExtendedButton copyButton)
{ {
Value.LineBreakMode = LineBreakMode.WordWrap; Value.LineBreakMode = LineBreakMode.WordWrap;
if(copyButton != null) if(copyButton != null)