mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
* [SG-601] Handle camera denied permissions * [SG-601] Code format * [SG-601] PR Fixes * [SG-601] Change resource text to singular * [SG-601] Remove horizontal and vertical options * [SG-601] Add start and stop scanner methods * [SG-601] Remove parameter from ScanPage * [SG-601] Move initialization to viewmodel * [SG-601] Fix zxing scanning bug * [SG-601] Move RunUIThread inside of method
139 lines
5.2 KiB
XML
139 lines
5.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<pages:BaseContentPage
|
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
x:Class="Bit.App.Pages.ScanPage"
|
|
xmlns:pages="clr-namespace:Bit.App.Pages"
|
|
xmlns:u="clr-namespace:Bit.App.Utilities"
|
|
xmlns:controls="clr-namespace:Bit.App.Controls"
|
|
xmlns:forms="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
|
|
xmlns:core="clr-namespace:Bit.Core;assembly=BitwardenCore"
|
|
xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
|
|
x:Name="_page"
|
|
Title="{Binding ScanQrPageTitle}">
|
|
|
|
<ContentPage.BindingContext>
|
|
<pages:ScanPageViewModel />
|
|
</ContentPage.BindingContext>
|
|
|
|
<ContentPage.Resources>
|
|
<ResourceDictionary>
|
|
<u:InverseBoolConverter x:Key="inverseBool" />
|
|
</ResourceDictionary>
|
|
</ContentPage.Resources>
|
|
|
|
<ContentPage.ToolbarItems>
|
|
<ToolbarItem Text="{u:I18n Cancel}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
|
|
</ContentPage.ToolbarItems>
|
|
|
|
<Grid
|
|
VerticalOptions="FillAndExpand"
|
|
HorizontalOptions="FillAndExpand">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<ContentView
|
|
x:Name="_scannerContainer"
|
|
AutomationId="zxingScannerView"
|
|
IsVisible="{Binding ShowScanner}"
|
|
Grid.Column="0"
|
|
Grid.Row="0"
|
|
Grid.RowSpan="3"/>
|
|
<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="Title"
|
|
TextColor="Transparent"/>
|
|
</StackLayout>
|
|
<BoxView
|
|
Grid.Column="0"
|
|
Grid.Row="0"
|
|
Grid.RowSpan="2"
|
|
IsVisible="{Binding ShowScanner, Converter={StaticResource inverseBool}}"
|
|
BackgroundColor="{DynamicResource BackgroundColor}"/>
|
|
<StackLayout
|
|
VerticalOptions="Center"
|
|
HorizontalOptions="FillAndExpand"
|
|
IsVisible="{Binding ShowScanner, Converter={StaticResource inverseBool}}"
|
|
Grid.Column="0"
|
|
Grid.Row="0"
|
|
Grid.RowSpan="2"
|
|
Margin="30,0">
|
|
<Label
|
|
Text="{u:I18n EnterKeyManually}"
|
|
FontSize="Title" />
|
|
<Label
|
|
Text="{u:I18n AuthenticatorKeyScanner}"
|
|
StyleClass="box-label" />
|
|
<controls:MonoEntry
|
|
x:Name="_authenticationKeyEntry"
|
|
Text="{Binding TotpAuthenticationKey}"
|
|
IsSpellCheckEnabled="False"
|
|
IsTextPredictionEnabled="False"
|
|
StyleClass="box-value" />
|
|
<Button
|
|
Text="{u:I18n AddTotp}"
|
|
StyleClass="box-button-row"
|
|
Clicked="AddAuthenticationKey_OnClicked"/>
|
|
</StackLayout>
|
|
<BoxView
|
|
Grid.Column="0"
|
|
Grid.Row="2"
|
|
VerticalOptions="Fill"
|
|
HorizontalOptions="FillAndExpand"
|
|
BackgroundColor="Black"
|
|
Opacity="0.7" />
|
|
<StackLayout
|
|
VerticalOptions="Start"
|
|
HorizontalOptions="Center"
|
|
Grid.Column="0"
|
|
Grid.Row="2">
|
|
<Label
|
|
Text="{Binding CameraInstructionTop}"
|
|
AutomationId="zxingDefaultOverlay_TopTextLabel"
|
|
Margin="30,15,30,0"
|
|
HorizontalOptions="Center"
|
|
HorizontalTextAlignment="Center"
|
|
StyleClass="text-sm"
|
|
TextColor="White" />
|
|
</StackLayout>
|
|
<Label
|
|
FormattedText="{Binding ToggleScanModeLabel}"
|
|
Grid.Column="0"
|
|
Grid.Row="2"
|
|
Margin="0,15"
|
|
StyleClass="text-sm"
|
|
FontAttributes="Bold"
|
|
VerticalOptions="End"
|
|
HorizontalOptions="Center" >
|
|
<Label.GestureRecognizers>
|
|
<TapGestureRecognizer Tapped="ToggleScanMode_OnTapped" />
|
|
</Label.GestureRecognizers>
|
|
</Label>
|
|
</Grid>
|
|
</pages:BaseContentPage> |