1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 07:43:37 +00:00

PS-70 changed labels on manual scanner screen

This commit is contained in:
André Bispo
2022-06-22 19:02:16 +01:00
parent 9bc8e6912d
commit 9ddbe400f8
2 changed files with 61 additions and 53 deletions

View File

@@ -10,18 +10,18 @@
xmlns:core="clr-namespace:Bit.Core;assembly=BitwardenCore" xmlns:core="clr-namespace:Bit.Core;assembly=BitwardenCore"
xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms" xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
x:Name="_page" x:Name="_page"
Title="{u:I18n ScanQrTitle}"> Title="{Binding ScanQrPageTitle}">
<ContentPage.BindingContext> <ContentPage.BindingContext>
<pages:ScanPageViewModel /> <pages:ScanPageViewModel />
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" /> <u:InverseBoolConverter x:Key="inverseBool" />
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem Text="{u:I18n Cancel}" Clicked="Close_Clicked" Order="Primary" Priority="-1" /> <ToolbarItem Text="{u:I18n Cancel}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
@@ -44,13 +44,42 @@
Grid.Row="0" Grid.Row="0"
Grid.RowSpan="3" Grid.RowSpan="3"
OnScanResult="OnScanResult"/> OnScanResult="OnScanResult"/>
<StackLayout
VerticalOptions="Center"
HorizontalOptions="FillAndExpand"
IsVisible="{Binding ShowScanner}"
Grid.Column="0"
Grid.Row="0"
Grid.RowSpan="2"
Margin="30,0">
<forms:SKCanvasView
x:Name="SkCanvasView"
Margin="0,50,0,0"
WidthRequest="250"
HeightRequest="250"
IsVisible="{Binding ShowScanner}"
VerticalOptions="Center"
HorizontalOptions="Center"
PaintSurface="OnCanvasViewPaintSurface"/>
<controls:IconButton
x:Name="_checkIcon"
IsVisible="{Binding ShowScanner}"
StyleClass="box-row-button, box-row-button-platform"
Text="{Binding Source={x:Static core:BitwardenIcons.CheckCircle}}"
HorizontalOptions="Center"
VerticalOptions="Start"
FontSize="30"
TextColor="Transparent"/>
</StackLayout>
<BoxView <BoxView
Grid.Column="0" Grid.Column="0"
Grid.Row="0" Grid.Row="0"
Grid.RowSpan="2" Grid.RowSpan="2"
IsVisible="{Binding ShowScanner, Converter={StaticResource inverseBool}}" IsVisible="{Binding ShowScanner, Converter={StaticResource inverseBool}}"
BackgroundColor="{DynamicResource BackgroundColor}"/> BackgroundColor="{DynamicResource BackgroundColor}"/>
<StackLayout <StackLayout
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
IsVisible="{Binding ShowScanner, Converter={StaticResource inverseBool}}" IsVisible="{Binding ShowScanner, Converter={StaticResource inverseBool}}"
@@ -58,76 +87,50 @@
Grid.Row="0" Grid.Row="0"
Grid.RowSpan="2" Grid.RowSpan="2"
Margin="30,0"> Margin="30,0">
<Label <Label
Text="{u:I18n EnterCodeManually}" Text="{u:I18n EnterCodeManually}"
FontSize="30" /> FontSize="30" />
<Label <Label
Text="{u:I18n AuthenticatorKey}" Text="{u:I18n AuthenticatorKeyScanner}"
StyleClass="box-label" /> StyleClass="box-label" />
<controls:MonoEntry <controls:MonoEntry
x:Name="_authenticationKeyEntry" x:Name="_authenticationKeyEntry"
Text="{Binding TotpAuthenticationKey}" Text="{Binding TotpAuthenticationKey}"
IsSpellCheckEnabled="False" IsSpellCheckEnabled="False"
IsTextPredictionEnabled="False" IsTextPredictionEnabled="False"
StyleClass="box-value" /> StyleClass="box-value" />
<Button <Button
Text="{u:I18n AddTotp}" Text="{u:I18n AddTotp}"
StyleClass="box-button-row" StyleClass="box-button-row"
Clicked="AddAuthenticationKey_OnClicked"/> Clicked="AddAuthenticationKey_OnClicked"/>
</StackLayout> </StackLayout>
<StackLayout <BoxView
VerticalOptions="Center"
HorizontalOptions="FillAndExpand"
IsVisible="{Binding ShowScanner}"
Grid.Column="0"
Grid.Row="0"
Grid.RowSpan="2"
Margin="30,0">
<forms:SKCanvasView x:Name="SkCanvasView"
Margin="0,50,0,0"
WidthRequest="250"
HeightRequest="250"
VerticalOptions="Center"
HorizontalOptions="Center"
PaintSurface="OnCanvasViewPaintSurface"/>
<controls:IconButton
x:Name="_checkIcon"
StyleClass="box-row-button, box-row-button-platform"
Text="{Binding Source={x:Static core:BitwardenIcons.CheckCircle}}"
HorizontalOptions="Center"
VerticalOptions="Start"
FontSize="30"
TextColor="Transparent"/>
</StackLayout>
<BoxView
Grid.Column="0" Grid.Column="0"
Grid.Row="2" Grid.Row="2"
VerticalOptions="Fill" VerticalOptions="Fill"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
BackgroundColor="Black" BackgroundColor="Black"
Opacity="0.7" /> Opacity="0.7" />
<StackLayout <StackLayout
VerticalOptions="Start" VerticalOptions="Start"
HorizontalOptions="Center" HorizontalOptions="Center"
Grid.Column="0" Grid.Column="0"
Grid.Row="2"> Grid.Row="2">
<Label <Label
Text="{u:I18n CameraInstructionTop}" Text="{Binding CameraInstructionTop}"
AutomationId="zxingDefaultOverlay_TopTextLabel" AutomationId="zxingDefaultOverlay_TopTextLabel"
Margin="0,15,0,0" Margin="30,15,30,0"
HorizontalOptions="Center" HorizontalOptions="Center"
StyleClass="text-sm" StyleClass="text-sm"
TextColor="White" /> TextColor="White" />
<Label <Label
Text="{u:I18n CameraInstructionBottom}" Text="{Binding CameraInstructionBottom}"
AutomationId="zxingDefaultOverlay_BottomTextLabel" AutomationId="zxingDefaultOverlay_BottomTextLabel"
HorizontalOptions="Center" HorizontalOptions="Center"
StyleClass="text-sm" StyleClass="text-sm"
TextColor="White" /> TextColor="White" />
</StackLayout> </StackLayout>
<Label <Label
FormattedText="{Binding ToggleScanModeLabel}" FormattedText="{Binding ToggleScanModeLabel}"
Grid.Column="0" Grid.Column="0"
Grid.Row="2" Grid.Row="2"
@@ -135,9 +138,9 @@
StyleClass="text-sm" StyleClass="text-sm"
VerticalOptions="End" VerticalOptions="End"
HorizontalOptions="Center" > HorizontalOptions="Center" >
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Tapped="ToggleScanMode_OnTapped" /> <TapGestureRecognizer Tapped="ToggleScanMode_OnTapped" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
</Label> </Label>
</Grid> </Grid>
</pages:BaseContentPage> </pages:BaseContentPage>

View File

@@ -17,7 +17,9 @@ namespace Bit.App.Pages
} }
public Command ToggleScanModeCommand { get; set; } public Command ToggleScanModeCommand { get; set; }
public string ScanQrPageTitle => ShowScanner ? AppResources.ScanQrTitle : AppResources.AuthenticatorKeyScanner;
public string CameraInstructionTop => ShowScanner ? AppResources.CameraInstructionTop : AppResources.OnceTheKeyIsSuccessfullyEntered;
public string CameraInstructionBottom => ShowScanner ? AppResources.CameraInstructionBottom : AppResources.SelectAddTotpToStoreTheKeySafely;
public string TotpAuthenticationKey public string TotpAuthenticationKey
{ {
get => _totpAuthenticationKey; get => _totpAuthenticationKey;
@@ -33,7 +35,10 @@ namespace Bit.App.Pages
set => SetProperty(ref _showScanner, value, set => SetProperty(ref _showScanner, value,
additionalPropertyNames: new string[] additionalPropertyNames: new string[]
{ {
nameof(ToggleScanModeLabel) nameof(ToggleScanModeLabel),
nameof(ScanQrPageTitle),
nameof(CameraInstructionTop),
nameof(CameraInstructionBottom)
}); });
} }