1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-26 16:57:59 +01:00

UX tweaks for Send (#1260)

* additional help text

* replace send type picker with segmented control

* formatting

* added note about rider issue

* additional design tweaks
This commit is contained in:
Matt Portune 2021-02-11 14:38:30 -05:00 committed by GitHub
parent a18e59a28a
commit 2602a09443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 202 additions and 95 deletions

View File

@ -50,7 +50,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n RememberMe}" Text="{u:I18n RememberMe}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Remember}" IsToggled="{Binding Remember}"
@ -85,7 +85,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n RememberMe}" Text="{u:I18n RememberMe}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Remember}" IsToggled="{Binding Remember}"
@ -105,7 +105,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n RememberMe}" Text="{u:I18n RememberMe}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Remember}" IsToggled="{Binding Remember}"

View File

@ -98,12 +98,12 @@
<StackLayout StyleClass="box-row, box-row-stepper"> <StackLayout StyleClass="box-row, box-row-stepper">
<Label <Label
Text="{u:I18n NumberOfWords}" Text="{u:I18n NumberOfWords}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center" /> VerticalTextAlignment="Center" />
<Label <Label
Text="{Binding NumWords}" Text="{Binding NumWords}"
StyleClass="box-label, box-sub-label" StyleClass="box-sub-label"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="End" HorizontalTextAlignment="End"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
@ -128,7 +128,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n Capitalize}" Text="{u:I18n Capitalize}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Capitalize}" IsToggled="{Binding Capitalize}"
@ -141,7 +141,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n IncludeNumber}" Text="{u:I18n IncludeNumber}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding IncludeNumber}" IsToggled="{Binding IncludeNumber}"
@ -155,11 +155,11 @@
<StackLayout StyleClass="box-row, box-row-slider"> <StackLayout StyleClass="box-row, box-row-slider">
<Label <Label
Text="{u:I18n Length}" Text="{u:I18n Length}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
VerticalOptions="CenterAndExpand" /> VerticalOptions="CenterAndExpand" />
<Label <Label
Text="{Binding Length}" Text="{Binding Length}"
StyleClass="box-label, box-sub-label" StyleClass="box-sub-label"
WidthRequest="30" WidthRequest="30"
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
HorizontalTextAlignment="End" /> HorizontalTextAlignment="End" />
@ -177,7 +177,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="A-Z" Text="A-Z"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Uppercase}" IsToggled="{Binding Uppercase}"
@ -190,7 +190,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="a-z" Text="a-z"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Lowercase}" IsToggled="{Binding Lowercase}"
@ -203,7 +203,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="0-9" Text="0-9"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Number}" IsToggled="{Binding Number}"
@ -216,7 +216,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="!@#$%^&amp;*" Text="!@#$%^&amp;*"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Special}" IsToggled="{Binding Special}"
@ -229,12 +229,12 @@
<StackLayout StyleClass="box-row, box-row-stepper"> <StackLayout StyleClass="box-row, box-row-stepper">
<Label <Label
Text="{u:I18n MinNumbers}" Text="{u:I18n MinNumbers}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center" /> VerticalTextAlignment="Center" />
<Label <Label
Text="{Binding MinNumber}" Text="{Binding MinNumber}"
StyleClass="box-label, box-sub-label" StyleClass="box-sub-label"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="End" HorizontalTextAlignment="End"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
@ -249,12 +249,12 @@
<StackLayout StyleClass="box-row, box-row-stepper"> <StackLayout StyleClass="box-row, box-row-stepper">
<Label <Label
Text="{u:I18n MinSpecial}" Text="{u:I18n MinSpecial}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center" /> VerticalTextAlignment="Center" />
<Label <Label
Text="{Binding MinSpecial}" Text="{Binding MinSpecial}"
StyleClass="box-label, box-sub-label" StyleClass="box-sub-label"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="End" HorizontalTextAlignment="End"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
@ -269,7 +269,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n AvoidAmbiguousCharacters}" Text="{u:I18n AvoidAmbiguousCharacters}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding AvoidAmbiguous}" IsToggled="{Binding AvoidAmbiguous}"

View File

@ -53,6 +53,26 @@
x:Name="_deleteItem" x:Name="_deleteItem"
x:Key="deleteItem" /> x:Key="deleteItem" />
<Style x:Key="segmentedButtonBase" TargetType="Button">
<Setter Property="HeightRequest" Value="{Binding SegmentedButtonHeight}" />
<Setter Property="FontSize" Value="{Binding SegmentedButtonFontSize}" />
<Setter Property="CornerRadius" Value="0" />
</Style>
<Style x:Key="segmentedButtonNormal" BaseResourceKey="segmentedButtonBase" TargetType="Button">
<Setter Property="TextColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="FontAttributes" Value="None" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="BorderColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="BorderWidth" Value="1" />
</Style>
<Style x:Key="segmentedButtonDisabled" BaseResourceKey="segmentedButtonBase" TargetType="Button">
<Setter Property="TextColor" Value="{StaticResource TitleTextColor}" />
<Setter Property="FontAttributes" Value="Bold" />
<Setter Property="BackgroundColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="BorderWidth" Value="0" />
</Style>
<ScrollView x:Key="scrollView" x:Name="_scrollView"> <ScrollView x:Key="scrollView" x:Name="_scrollView">
<StackLayout Spacing="20"> <StackLayout Spacing="20">
<StackLayout StyleClass="box"> <StackLayout StyleClass="box">
@ -61,11 +81,62 @@
<Label <Label
Text="{u:I18n Type}" Text="{u:I18n Type}"
StyleClass="box-label" /> StyleClass="box-label" />
<Picker <Grid RowSpacing="0" ColumnSpacing="0" Margin="{Binding SegmentedButtonMargins}">
x:Name="_typePicker" <Grid.ColumnDefinitions>
ItemsSource="{Binding TypeOptions, Mode=OneTime}" <ColumnDefinition Width="*" />
SelectedIndex="{Binding TypeSelectedIndex}" <ColumnDefinition Width="*" />
StyleClass="box-value" /> </Grid.ColumnDefinitions>
<Button Text="{u:I18n TypeText}"
IsEnabled="{Binding IsFile}"
Clicked="TextType_Clicked"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Text}"
Grid.Column="0">
<VisualStateManager.VisualStateGroups>
<!-- Rider users, if the x:Name values below are red, it's a known issue: -->
<!-- https://youtrack.jetbrains.com/issue/RSRP-479388 -->
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="Style"
Value="{StaticResource segmentedButtonNormal}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="Style"
Value="{StaticResource segmentedButtonDisabled}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Button>
<Button Text="{u:I18n TypeFile}"
IsEnabled="{Binding IsText}"
Clicked="FileType_Clicked"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n File}"
Grid.Column="1">
<VisualStateManager.VisualStateGroups>
<!-- Rider users, if the x:Name values below are red, it's a known issue: -->
<!-- https://youtrack.jetbrains.com/issue/RSRP-479388 -->
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="Style"
Value="{StaticResource segmentedButtonNormal}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="Style"
Value="{StaticResource segmentedButtonDisabled}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Button>
</Grid>
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row"> <StackLayout StyleClass="box-row">
<Label <Label
@ -75,6 +146,10 @@
x:Name="_nameEntry" x:Name="_nameEntry"
Text="{Binding Send.Name}" Text="{Binding Send.Name}"
StyleClass="box-value" /> StyleClass="box-value" />
<Label
Text="{u:I18n NameInfo}"
StyleClass="box-footer-label"
Margin="0,5,0,0" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row" <StackLayout StyleClass="box-row"
IsVisible="{Binding IsText}"> IsVisible="{Binding IsText}">
@ -88,10 +163,14 @@
StyleClass="box-value" StyleClass="box-value"
Margin="{Binding EditorMargins}" /> Margin="{Binding EditorMargins}" />
<BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowEditorSeparators}" /> <BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowEditorSeparators}" />
<Label
Text="{u:I18n TypeTextInfo}"
StyleClass="box-footer-label"
Margin="0,5,0,10" />
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n HideTextByDefault}" Text="{u:I18n HideTextByDefault}"
StyleClass="box-label" StyleClass="box-label-regular"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
@ -130,16 +209,22 @@
StyleClass="box-button-row" StyleClass="box-button-row"
Clicked="ChooseFile_Clicked" /> Clicked="ChooseFile_Clicked" />
<Label <Label
Margin="0, 10, 0, 0" Margin="0, 5, 0, 0"
Text="{u:I18n MaxFileSize}" Text="{u:I18n MaxFileSize}"
StyleClass="box-footer-label" /> StyleClass="text-sm, text-muted"
HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="Center" />
</StackLayout> </StackLayout>
<Label
Text="{u:I18n TypeFileInfo}"
StyleClass="box-footer-label"
Margin="0,5,0,0" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row-header"> <StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n Options, Header=True}" <Label Text="{u:I18n Options, Header=True}"
StyleClass="box-header, box-header-platform" /> StyleClass="box-header, box-header-platform" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row"> <StackLayout StyleClass="box-row" Margin="0,10,0,0">
<Label <Label
Text="{u:I18n DeletionDate}" Text="{u:I18n DeletionDate}"
StyleClass="box-label" /> StyleClass="box-label" />
@ -173,10 +258,10 @@
</Grid> </Grid>
<Label <Label
Text="{u:I18n DeletionDateInfo}" Text="{u:I18n DeletionDateInfo}"
StyleClass="box-label" StyleClass="box-footer-label"
Margin="0,5,0,0" /> Margin="0,5,0,0" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row"> <StackLayout StyleClass="box-row" Margin="0,5,0,0">
<Label <Label
Text="{u:I18n ExpirationDate}" Text="{u:I18n ExpirationDate}"
StyleClass="box-label" /> StyleClass="box-label" />
@ -213,20 +298,19 @@
<StackLayout Orientation="Horizontal" Margin="0,5,0,0"> <StackLayout Orientation="Horizontal" Margin="0,5,0,0">
<Label <Label
Text="{u:I18n ExpirationDateInfo}" Text="{u:I18n ExpirationDateInfo}"
StyleClass="box-label" StyleClass="box-footer-label"
HorizontalOptions="StartAndExpand" HorizontalOptions="StartAndExpand" />
VerticalOptions="Center" />
<Button <Button
Text="{u:I18n Clear}" Text="{u:I18n Clear}"
IsVisible="{Binding EditMode}" IsVisible="{Binding EditMode}"
WidthRequest="110" WidthRequest="110"
HeightRequest="{Binding SegmentedButtonHeight}"
FontSize="{Binding SegmentedButtonFontSize}"
StyleClass="box-row-button" StyleClass="box-row-button"
Clicked="ClearExpirationDate_Clicked" /> Clicked="ClearExpirationDate_Clicked" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<BoxView StyleClass="box-row-separator" <StackLayout StyleClass="box-row" Margin="0,5,0,0">
Margin="0, 5, 0, 0" />
<StackLayout StyleClass="box-row">
<Label <Label
Text="{u:I18n MaximumAccessCount}" Text="{u:I18n MaximumAccessCount}"
StyleClass="box-label" /> StyleClass="box-label" />
@ -246,25 +330,26 @@
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n MaximumAccessCountInfo}" Text="{u:I18n MaximumAccessCountInfo}"
StyleClass="box-label" StyleClass="box-footer-label" />
Margin="0,5" />
<StackLayout <StackLayout
IsVisible="{Binding EditMode}" IsVisible="{Binding EditMode}"
StyleClass="box-row" StyleClass="box-row"
Orientation="Horizontal"> Orientation="Horizontal">
<Label <Label
Text="{u:I18n CurrentAccessCount}" Text="{u:I18n CurrentAccessCount}"
StyleClass="box-label" StyleClass="box-footer-label"
HorizontalOptions="StartAndExpand" VerticalTextAlignment="Center" />
<Label
Text=": "
StyleClass="box-footer-label"
VerticalTextAlignment="Center" /> VerticalTextAlignment="Center" />
<Label <Label
Text="{Binding Send.AccessCount, Mode=OneWay}" Text="{Binding Send.AccessCount, Mode=OneWay}"
StyleClass="box-label" StyleClass="box-label"
HorizontalOptions="End" /> VerticalTextAlignment="Center" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<BoxView StyleClass="box-row-separator" /> <StackLayout StyleClass="box-row" Margin="0,5,0,0">
<StackLayout StyleClass="box-row" Margin="0,5">
<Label <Label
Text="{u:I18n NewPassword}" Text="{u:I18n NewPassword}"
StyleClass="box-label" /> StyleClass="box-label" />
@ -286,11 +371,10 @@
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n PasswordInfo}" Text="{u:I18n PasswordInfo}"
StyleClass="box-label" StyleClass="box-footer-label"
Margin="0,5,0,0" /> Margin="0,5,0,0" />
</StackLayout> </StackLayout>
<BoxView StyleClass="box-row-separator" /> <StackLayout StyleClass="box-row" Margin="0,5,0,0">
<StackLayout StyleClass="box-row" Margin="0,5">
<Label <Label
Text="{u:I18n Notes}" Text="{u:I18n Notes}"
StyleClass="box-label" /> StyleClass="box-label" />
@ -302,14 +386,13 @@
<BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowEditorSeparators}" /> <BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowEditorSeparators}" />
<Label <Label
Text="{u:I18n NotesInfo}" Text="{u:I18n NotesInfo}"
StyleClass="box-label" StyleClass="box-footer-label"
Margin="0,5,0,0" /> Margin="0,5,0,0" />
</StackLayout> </StackLayout>
<BoxView StyleClass="box-row-separator" /> <StackLayout StyleClass="box-row, box-row-switch" Margin="0,5,0,0">
<StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n DisableSend}" Text="{u:I18n DisableSend}"
StyleClass="box-label" StyleClass="box-label-regular"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
@ -320,7 +403,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n ShareOnSave}" Text="{u:I18n ShareOnSave}"
StyleClass="box-label" StyleClass="box-label-regular"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
@ -328,7 +411,6 @@
HorizontalOptions="End" HorizontalOptions="End"
Margin="10,0,0,0" /> Margin="10,0,0,0" />
</StackLayout> </StackLayout>
<BoxView StyleClass="box-row-separator" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>

View File

@ -28,6 +28,7 @@ namespace Bit.App.Pages
_vm.SendId = sendId; _vm.SendId = sendId;
_vm.Type = type; _vm.Type = type;
_vm.Init(); _vm.Init();
SetActivityIndicator();
if (Device.RuntimePlatform == Device.Android) if (Device.RuntimePlatform == Device.Android)
{ {
if (_vm.EditMode) if (_vm.EditMode)
@ -37,6 +38,9 @@ namespace Bit.App.Pages
ToolbarItems.Add(_shareLink); ToolbarItems.Add(_shareLink);
ToolbarItems.Add(_deleteItem); ToolbarItems.Add(_deleteItem);
} }
_vm.SegmentedButtonHeight = 36;
_vm.SegmentedButtonFontSize = 13;
_vm.SegmentedButtonMargins = new Thickness(0, 10, 0, 0);
_vm.EditorMargins = new Thickness(0, 5, 0, 0); _vm.EditorMargins = new Thickness(0, 5, 0, 0);
} }
else if (Device.RuntimePlatform == Device.iOS) else if (Device.RuntimePlatform == Device.iOS)
@ -46,14 +50,15 @@ namespace Bit.App.Pages
{ {
ToolbarItems.Add(_moreItem); ToolbarItems.Add(_moreItem);
} }
_vm.SegmentedButtonHeight = 30;
_vm.SegmentedButtonFontSize = 15;
_vm.SegmentedButtonMargins = new Thickness(0, 5, 0, 0);
_vm.ShowEditorSeparators = true; _vm.ShowEditorSeparators = true;
_vm.EditorMargins = new Thickness(0, 10, 0, 5); _vm.EditorMargins = new Thickness(0, 10, 0, 5);
_typePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
_deletionDateTypePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished); _deletionDateTypePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
_expirationDateTypePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished); _expirationDateTypePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
} }
_typePicker.ItemDisplayBinding = new Binding("Key");
_deletionDateTypePicker.ItemDisplayBinding = new Binding("Key"); _deletionDateTypePicker.ItemDisplayBinding = new Binding("Key");
_expirationDateTypePicker.ItemDisplayBinding = new Binding("Key"); _expirationDateTypePicker.ItemDisplayBinding = new Binding("Key");
@ -103,6 +108,16 @@ namespace Bit.App.Pages
} }
} }
private void TextType_Clicked(object sender, EventArgs eventArgs)
{
_vm.TypeChanged(SendType.Text);
}
private void FileType_Clicked(object sender, EventArgs eventArgs)
{
_vm.TypeChanged(SendType.File);
}
private void OnMaxAccessCountTextChanged(object sender, TextChangedEventArgs e) private void OnMaxAccessCountTextChanged(object sender, TextChangedEventArgs e)
{ {
if (string.IsNullOrWhiteSpace(e.NewTextValue)) if (string.IsNullOrWhiteSpace(e.NewTextValue))

View File

@ -21,10 +21,7 @@ namespace Bit.App.Pages
private readonly ISendService _sendService; private readonly ISendService _sendService;
private bool _canAccessPremium; private bool _canAccessPremium;
private SendView _send; private SendView _send;
private bool _showEditorSeparators;
private Thickness _editorMargins;
private bool _showPassword; private bool _showPassword;
private int _typeSelectedIndex;
private int _deletionDateTypeSelectedIndex; private int _deletionDateTypeSelectedIndex;
private int _expirationDateTypeSelectedIndex; private int _expirationDateTypeSelectedIndex;
private DateTime _deletionDate; private DateTime _deletionDate;
@ -76,6 +73,11 @@ namespace Bit.App.Pages
public Command TogglePasswordCommand { get; set; } public Command TogglePasswordCommand { get; set; }
public string SendId { get; set; } public string SendId { get; set; }
public int SegmentedButtonHeight { get; set; }
public int SegmentedButtonFontSize { get; set; }
public Thickness SegmentedButtonMargins { get; set; }
public bool ShowEditorSeparators { get; set; }
public Thickness EditorMargins { get; set; }
public SendType? Type { get; set; } public SendType? Type { get; set; }
public string FileName { get; set; } public string FileName { get; set; }
public byte[] FileData { get; set; } public byte[] FileData { get; set; }
@ -84,17 +86,6 @@ namespace Bit.App.Pages
public List<KeyValuePair<string, SendType>> TypeOptions { get; } public List<KeyValuePair<string, SendType>> TypeOptions { get; }
public List<KeyValuePair<string, string>> DeletionTypeOptions { get; } public List<KeyValuePair<string, string>> DeletionTypeOptions { get; }
public List<KeyValuePair<string, string>> ExpirationTypeOptions { get; } public List<KeyValuePair<string, string>> ExpirationTypeOptions { get; }
public int TypeSelectedIndex
{
get => _typeSelectedIndex;
set
{
if (SetProperty(ref _typeSelectedIndex, value))
{
TypeChanged();
}
}
}
public int DeletionDateTypeSelectedIndex public int DeletionDateTypeSelectedIndex
{ {
get => _deletionDateTypeSelectedIndex; get => _deletionDateTypeSelectedIndex;
@ -165,16 +156,6 @@ namespace Bit.App.Pages
get => _send; get => _send;
set => SetProperty(ref _send, value, additionalPropertyNames: _additionalSendProperties); set => SetProperty(ref _send, value, additionalPropertyNames: _additionalSendProperties);
} }
public bool ShowEditorSeparators
{
get => _showEditorSeparators;
set => SetProperty(ref _showEditorSeparators, value);
}
public Thickness EditorMargins
{
get => _editorMargins;
set => SetProperty(ref _editorMargins, value);
}
public bool ShowPassword public bool ShowPassword
{ {
get => _showPassword; get => _showPassword;
@ -223,7 +204,6 @@ namespace Bit.App.Pages
ExpirationDateTypeSelectedIndex = 0; ExpirationDateTypeSelectedIndex = 0;
} }
TypeSelectedIndex = TypeOptions.FindIndex(k => k.Value == Send.Type);
MaxAccessCount = Send.MaxAccessCount; MaxAccessCount = Send.MaxAccessCount;
_isOverridingPickers = true; _isOverridingPickers = true;
DeletionDate = Send.DeletionDate.ToLocalTime(); DeletionDate = Send.DeletionDate.ToLocalTime();
@ -389,16 +369,16 @@ namespace Bit.App.Pages
return await AppHelpers.DeleteSendAsync(SendId); return await AppHelpers.DeleteSendAsync(SendId);
} }
private async void TypeChanged() public async void TypeChanged(SendType type)
{ {
if (Send != null && TypeSelectedIndex > -1) if (Send != null)
{ {
if (!EditMode && TypeOptions[TypeSelectedIndex].Value == SendType.File && !_canAccessPremium) if (!EditMode && type == SendType.File && !_canAccessPremium)
{ {
await _platformUtilsService.ShowDialogAsync(AppResources.PremiumRequired); await _platformUtilsService.ShowDialogAsync(AppResources.PremiumRequired);
TypeSelectedIndex = 0; type = SendType.Text;
} }
Send.Type = TypeOptions[TypeSelectedIndex].Value; Send.Type = type;
TriggerPropertyChanged(nameof(Send), _additionalSendProperties); TriggerPropertyChanged(nameof(Send), _additionalSendProperties);
} }
} }

View File

@ -19,7 +19,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n AutofillService}" Text="{u:I18n AutofillService}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<RelativeLayout HorizontalOptions="End"> <RelativeLayout HorizontalOptions="End">
<Switch <Switch
@ -46,7 +46,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n InlineAutofill}" Text="{u:I18n InlineAutofill}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
IsEnabled="{Binding InlineAutofillEnabled}" IsEnabled="{Binding InlineAutofillEnabled}"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<RelativeLayout HorizontalOptions="End"> <RelativeLayout HorizontalOptions="End">
@ -75,7 +75,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n Accessibility}" Text="{u:I18n Accessibility}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<RelativeLayout HorizontalOptions="End"> <RelativeLayout HorizontalOptions="End">
<Switch <Switch
@ -102,7 +102,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n DrawOver}" Text="{u:I18n DrawOver}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
IsEnabled="{Binding DrawOverEnabled}" IsEnabled="{Binding DrawOverEnabled}"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<RelativeLayout HorizontalOptions="End"> <RelativeLayout HorizontalOptions="End">

View File

@ -68,7 +68,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n DisableAutoTotpCopy}" Text="{u:I18n DisableAutoTotpCopy}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding DisableAutoTotpCopy}" IsToggled="{Binding DisableAutoTotpCopy}"
@ -83,7 +83,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n DisableWebsiteIcons}" Text="{u:I18n DisableWebsiteIcons}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding DisableFavicon}" IsToggled="{Binding DisableFavicon}"
@ -102,7 +102,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n DisableSavePrompt}" Text="{u:I18n DisableSavePrompt}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding AutofillDisableSavePrompt}" IsToggled="{Binding AutofillDisableSavePrompt}"

View File

@ -22,7 +22,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n EnableSyncOnRefresh}" Text="{u:I18n EnableSyncOnRefresh}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding EnableSyncOnRefresh}" IsToggled="{Binding EnableSyncOnRefresh}"

View File

@ -523,7 +523,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n Favorite}" Text="{u:I18n Favorite}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Cipher.Favorite}" IsToggled="{Binding Cipher.Favorite}"
@ -674,7 +674,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{Binding Collection.Name}" Text="{Binding Collection.Name}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Checked}" IsToggled="{Binding Checked}"

View File

@ -39,7 +39,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{Binding Collection.Name}" Text="{Binding Collection.Name}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Checked}" IsToggled="{Binding Checked}"

View File

@ -66,7 +66,7 @@
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{Binding Collection.Name}" Text="{Binding Collection.Name}"
StyleClass="box-label, box-label-regular" StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand" />
<Switch <Switch
IsToggled="{Binding Checked}" IsToggled="{Binding Checked}"

View File

@ -3201,12 +3201,24 @@ namespace Bit.App.Resources {
} }
} }
public static string NameInfo {
get {
return ResourceManager.GetString("NameInfo", resourceCulture);
}
}
public static string TypeText { public static string TypeText {
get { get {
return ResourceManager.GetString("TypeText", resourceCulture); return ResourceManager.GetString("TypeText", resourceCulture);
} }
} }
public static string TypeTextInfo {
get {
return ResourceManager.GetString("TypeTextInfo", resourceCulture);
}
}
public static string HideTextByDefault { public static string HideTextByDefault {
get { get {
return ResourceManager.GetString("HideTextByDefault", resourceCulture); return ResourceManager.GetString("HideTextByDefault", resourceCulture);
@ -3219,6 +3231,12 @@ namespace Bit.App.Resources {
} }
} }
public static string TypeFileInfo {
get {
return ResourceManager.GetString("TypeFileInfo", resourceCulture);
}
}
public static string DeletionDate { public static string DeletionDate {
get { get {
return ResourceManager.GetString("DeletionDate", resourceCulture); return ResourceManager.GetString("DeletionDate", resourceCulture);

View File

@ -1811,9 +1811,16 @@
<value>Sends</value> <value>Sends</value>
<comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment> <comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment>
</data> </data>
<data name="NameInfo" xml:space="preserve">
<value>A friendly name to describe this Send.</value>
<comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment>
</data>
<data name="TypeText" xml:space="preserve"> <data name="TypeText" xml:space="preserve">
<value>Text</value> <value>Text</value>
</data> </data>
<data name="TypeTextInfo" xml:space="preserve">
<value>The text you want to send.</value>
</data>
<data name="HideTextByDefault" xml:space="preserve"> <data name="HideTextByDefault" xml:space="preserve">
<value>When accessing the Send, hide the text by default</value> <value>When accessing the Send, hide the text by default</value>
<comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment> <comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment>
@ -1821,6 +1828,9 @@
<data name="TypeFile" xml:space="preserve"> <data name="TypeFile" xml:space="preserve">
<value>File</value> <value>File</value>
</data> </data>
<data name="TypeFileInfo" xml:space="preserve">
<value>The file you want to send.</value>
</data>
<data name="DeletionDate" xml:space="preserve"> <data name="DeletionDate" xml:space="preserve">
<value>Deletion Date</value> <value>Deletion Date</value>
</data> </data>

View File

@ -320,6 +320,8 @@
Class="box-label"> Class="box-label">
<Setter Property="FontSize" <Setter Property="FontSize"
Value="Small" /> Value="Small" />
<Setter Property="FontAttributes"
Value="Bold" />
<Setter Property="TextColor" <Setter Property="TextColor"
Value="{StaticResource MutedColor}" /> Value="{StaticResource MutedColor}" />
</Style> </Style>