add some fields for various types

This commit is contained in:
Kyle Spearrin 2019-05-07 23:22:55 -04:00
parent 5dc4357078
commit 0b73317dd0
5 changed files with 231 additions and 2 deletions

View File

@ -79,6 +79,8 @@
<Compile Include="Autofill\FilledItem.cs" />
<Compile Include="Autofill\Parser.cs" />
<Compile Include="Autofill\SavedItem.cs" />
<Compile Include="Renderers\CustomPickerBarRenderer.cs" />
<Compile Include="Renderers\CustomEntryBarRenderer.cs" />
<Compile Include="Renderers\CustomSearchBarRenderer.cs" />
<Compile Include="SplashActivity.cs" />
<Compile Include="Renderers\BoxedView\BoxedViewRecyclerAdapter.cs" />

View File

@ -33,7 +33,7 @@
<Label Text="{u:I18n ItemInformation}"
StyleClass="box-header, box-header-platform" />
</StackLayout>
<StackLayout StyleClass="box-row">
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n Name}"
StyleClass="box-label" />
@ -41,6 +41,178 @@
Text="{Binding Cipher.Name}"
StyleClass="box-value" />
</StackLayout>
<StackLayout IsVisible="{Binding IsLogin}" Spacing="0" Padding="0">
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n Username}"
StyleClass="box-label" />
<Entry
Text="{Binding Cipher.Login.Username}"
StyleClass="box-value" />
</StackLayout>
<Grid StyleClass="box-row, box-row-input">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label
Text="{u:I18n Password}"
StyleClass="box-label"
Grid.Row="0"
Grid.Column="0" />
<controls:MonoEntry
Text="{Binding Cipher.Login.Password}"
StyleClass="box-value"
Grid.Row="1"
Grid.Column="0"
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}" />
<controls:FaButton
StyleClass="box-row-button, box-row-button-platform"
Text="&#xf058;"
Command="{Binding CheckPasswordCommand}"
Grid.Row="0"
Grid.Column="1"
Grid.RowSpan="2" />
<controls:FaButton
StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}"
Command="{Binding TogglePasswordCommand}"
Grid.Row="0"
Grid.Column="2"
Grid.RowSpan="2" />
<controls:FaButton
StyleClass="box-row-button, box-row-button-platform"
Text="&#xf021;"
Command="{Binding GeneratePasswordCommand}"
Grid.Row="0"
Grid.Column="3"
Grid.RowSpan="2" />
</Grid>
<StackLayout StyleClass="box-row">
<Label
Text="{u:I18n AuthenticatorKey}"
StyleClass="box-label" />
<controls:MonoEntry
Text="{Binding Cipher.Login.Totp}"
StyleClass="box-value" />
</StackLayout>
</StackLayout>
<StackLayout IsVisible="{Binding IsCard}" Spacing="0" Padding="0">
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n CardholderName}"
StyleClass="box-label" />
<Entry
Text="{Binding Cipher.Card.CardholderName}"
StyleClass="box-value" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n Number}"
StyleClass="box-label" />
<Entry
Text="{Binding Cipher.Card.Number}"
StyleClass="box-value"
Keyboard="Numeric" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n Brand}"
StyleClass="box-label" />
<Picker
x:Name="_cardBrandPicker"
ItemsSource="{Binding CardBrandOptions}"
StyleClass="box-value" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n ExpirationMonth}"
StyleClass="box-label" />
<Picker
x:Name="_cardExpMonthPicker"
ItemsSource="{Binding CardExpMonthOptions}"
StyleClass="box-value" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n ExpirationYear}"
StyleClass="box-label" />
<Entry
Text="{Binding Cipher.Card.ExpYear}"
StyleClass="box-value"
Keyboard="Numeric" />
</StackLayout>
<Grid StyleClass="box-row, box-row-input">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label
Text="{u:I18n SecurityCode}"
StyleClass="box-label"
Grid.Row="0"
Grid.Column="0" />
<controls:MonoEntry
Text="{Binding Cipher.Card.Code}"
StyleClass="box-value"
Grid.Row="1"
Grid.Column="0"
Keyboard="Numeric"
IsPassword="{Binding ShowCardCode, Converter={StaticResource inverseBool}}" />
<controls:FaButton
StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowCardCodeIcon}"
Command="{Binding ToggleCardCodeCommand}"
Grid.Row="0"
Grid.Column="1"
Grid.RowSpan="2" />
</Grid>
</StackLayout>
<StackLayout IsVisible="{Binding IsIdentity}" Spacing="0" Padding="0">
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n Title}"
StyleClass="box-label" />
<Picker
x:Name="_identityTitlePicker"
ItemsSource="{Binding IdentityTitleOptions}"
StyleClass="box-value" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n FirstName}"
StyleClass="box-label" />
<Entry
Text="{Binding Cipher.Identity.FirstName}"
StyleClass="box-value" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n MiddleName}"
StyleClass="box-label" />
<Entry
Text="{Binding Cipher.Identity.MiddleName}"
StyleClass="box-value" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n LastName}"
StyleClass="box-label" />
<Entry
Text="{Binding Cipher.Identity.LastName}"
StyleClass="box-value" />
</StackLayout>
</StackLayout>
</StackLayout>
</StackLayout>
</ScrollView>

View File

@ -20,6 +20,10 @@ namespace Bit.App.Pages
_vm.OrganizationId = organizationId;
_vm.Init();
SetActivityIndicator();
_cardBrandPicker.ItemDisplayBinding = new Binding("Key");
_cardExpMonthPicker.ItemDisplayBinding = new Binding("Key");
_identityTitlePicker.ItemDisplayBinding = new Binding("Key");
}
protected override async void OnAppearing()

View File

@ -37,6 +37,44 @@ namespace Bit.App.Pages
TogglePasswordCommand = new Command(TogglePassword);
ToggleCardCodeCommand = new Command(ToggleCardCode);
CheckPasswordCommand = new Command(CheckPasswordAsync);
CardBrandOptions = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>($"-- {AppResources.Select} --", null),
new KeyValuePair<string, string>("Visa", "Visa"),
new KeyValuePair<string, string>("Mastercard", "Mastercard"),
new KeyValuePair<string, string>("American Express", "Amex"),
new KeyValuePair<string, string>("Discover", "Discover"),
new KeyValuePair<string, string>("Diners Club", "Diners Club"),
new KeyValuePair<string, string>("JCB", "JCB"),
new KeyValuePair<string, string>("Maestro", "Maestro"),
new KeyValuePair<string, string>("UnionPay", "UnionPay"),
new KeyValuePair<string, string>(AppResources.Other, "Other")
};
CardExpMonthOptions = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>($"-- {AppResources.Select} --", null),
new KeyValuePair<string, string>($"01 - {AppResources.January}", "1"),
new KeyValuePair<string, string>($"02 - {AppResources.February}", "2"),
new KeyValuePair<string, string>($"03 - {AppResources.March}", "3"),
new KeyValuePair<string, string>($"04 - {AppResources.April}", "4"),
new KeyValuePair<string, string>($"05 - {AppResources.May}", "5"),
new KeyValuePair<string, string>($"06 - {AppResources.June}", "6"),
new KeyValuePair<string, string>($"07 - {AppResources.July}", "7"),
new KeyValuePair<string, string>($"08 - {AppResources.August}", "8"),
new KeyValuePair<string, string>($"09 - {AppResources.September}", "9"),
new KeyValuePair<string, string>($"10 - {AppResources.October}", "10"),
new KeyValuePair<string, string>($"11 - {AppResources.November}", "11"),
new KeyValuePair<string, string>($"12 - {AppResources.December}", "12")
};
IdentityTitleOptions = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>($"-- {AppResources.Select} --", null),
new KeyValuePair<string, string>(AppResources.Mr, AppResources.Mr),
new KeyValuePair<string, string>(AppResources.Mrs, AppResources.Mrs),
new KeyValuePair<string, string>(AppResources.Ms, AppResources.Ms),
new KeyValuePair<string, string>(AppResources.Dr, AppResources.Dr),
};
}
public Command GeneratePasswordCommand { get; set; }
@ -48,6 +86,9 @@ namespace Bit.App.Pages
public string FolderId { get; set; }
public CipherType? Type { get; set; }
public List<string> CollectionIds { get; set; }
public List<KeyValuePair<string, string>> CardBrandOptions { get; set; }
public List<KeyValuePair<string, string>> CardExpMonthOptions { get; set; }
public List<KeyValuePair<string, string>> IdentityTitleOptions { get; set; }
public CipherView Cipher
{
get => _cipher;
@ -203,7 +244,7 @@ namespace Bit.App.Pages
public void GeneratePassword()
{
// TODO: push modal for generate page
}
public void TogglePassword()

View File

@ -232,6 +232,16 @@
<Setter Property="Spacing"
Value="0" />
</Style>
<Style TargetType="Grid"
Class="box-row-input">
<Setter Property="Padding"
Value="0, 10, 0, 0" />
</Style>
<Style TargetType="StackLayout"
Class="box-row-input">
<Setter Property="Padding"
Value="0, 10, 0, 0" />
</Style>
<Style TargetType="Button"
ApplyToDerivedTypes="True"
Class="box-row-button">