Skip to content

Commit 6dbdba0

Browse files
Fix mobile application
1 parent 884fc04 commit 6dbdba0

5 files changed

Lines changed: 31 additions & 35 deletions

File tree

src/Mobile/SimpleIdServer.Mobile/QRCodeScannerPage.xaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@
2020
<Grid ZIndex="1">
2121
<Grid.RowDefinitions>
2222
<RowDefinition Height="*" />
23-
<RowDefinition Height="9*" />
2423
</Grid.RowDefinitions>
25-
<StackLayout Grid.Row="0" Style="{StaticResource modalToolbar}">
26-
<ImageButton Command="{Binding Path=CloseCommand}" Style="{StaticResource modalToolbarClose}" />
27-
<Label Style="{StaticResource modalToolbarTitle}">Scan QR Code</Label>
28-
</StackLayout>
29-
<zxing:CameraBarcodeReaderView x:Name="cameraBarCodeReader" Grid.Row="1">
24+
<zxing:CameraBarcodeReaderView x:Name="cameraBarCodeReader" Grid.Row="0">
3025
<zxing:CameraBarcodeReaderView.Behaviors>
3126
<toolkit:EventToCommandBehavior EventName="BarcodesDetected" Command="{Binding ScanQRCodeCommand}" EventArgsConverter="{StaticResource barcodeDetectionEventArgsConverter}" />
3227
</zxing:CameraBarcodeReaderView.Behaviors>

src/Mobile/SimpleIdServer.Mobile/Services/NavigationService.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ public interface INavigationService
55
Task GoBack();
66
Task<T> DisplayModal<T>() where T : ContentPage;
77
Task<T> DisplayModal<T>(T content) where T : ContentPage;
8+
Task<T> Navigate<T>() where T : ContentPage;
9+
Task<T> Navigate<T>(T content) where T : ContentPage;
810
}
911

1012
public class NavigationService : INavigationService
@@ -30,6 +32,12 @@ public Task<T> DisplayModal<T>() where T : ContentPage
3032
return DisplayModal(service);
3133
}
3234

35+
public Task<T> Navigate<T>() where T : ContentPage
36+
{
37+
var service = _serviceProvider.GetRequiredService<T>();
38+
return Navigate(service);
39+
}
40+
3341
public async Task<T> DisplayModal<T>(T content) where T : ContentPage
3442
{
3543
await App.Current.Dispatcher.DispatchAsync(async () =>
@@ -39,4 +47,14 @@ await App.Current.Dispatcher.DispatchAsync(async () =>
3947
});
4048
return content;
4149
}
50+
51+
public async Task<T> Navigate<T>(T content) where T : ContentPage
52+
{
53+
await App.Current.Dispatcher.DispatchAsync(async () =>
54+
{
55+
var navigation = App.Current.MainPage.Navigation;
56+
await navigation.PushAsync(content);
57+
});
58+
return content;
59+
}
4260
}

src/Mobile/SimpleIdServer.Mobile/ViewCredentialListPage.xaml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,17 @@
1212
xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls"
1313
x:Class="SimpleIdServer.Mobile.ViewCredentialListPage"
1414
Shell.TabBarIsVisible="false"
15-
Title="One time password">
15+
Title="Credentials">
16+
<ContentPage.ToolbarItems>
17+
<ToolbarItem Order="Primary" Text="Delete" Command="{Binding Path=RemoveSelectedCredentialsCommand}"></ToolbarItem>
18+
</ContentPage.ToolbarItems>
1619
<Grid>
1720
<common:Loader IsVisible="{Binding Path=IsLoading}" ZIndex="2" />
1821
<Grid ZIndex="1">
1922
<Grid.RowDefinitions>
2023
<RowDefinition Height="*" />
21-
<RowDefinition Height="9*" />
2224
</Grid.RowDefinitions>
23-
<StackLayout Grid.Row="0" Style="{StaticResource modalToolbar}">
24-
<ImageButton Command="{Binding Path=CloseCommand}" Style="{StaticResource modalToolbarClose}" />
25-
<Label Style="{StaticResource modalToolbarTitle}">Credentials</Label>
26-
<Label Text="Delete" Style="{StaticResource removeBtn}">
27-
<Label.GestureRecognizers>
28-
<TapGestureRecognizer Command="{Binding Path=RemoveSelectedCredentialsCommand}"></TapGestureRecognizer>
29-
</Label.GestureRecognizers>
30-
</Label>
31-
</StackLayout>
32-
<ListView ItemsSource="{Binding Path=Credentials}" SelectionMode="None" Grid.Row="1">
25+
<ListView ItemsSource="{Binding Path=Credentials}" SelectionMode="None" Grid.Row="0">
3326
<ListView.ItemTemplate>
3427
<DataTemplate x:DataType="stores:SelectableCredentialRecord">
3528
<ViewCell>

src/Mobile/SimpleIdServer.Mobile/ViewModels/EnrollViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public EnrollViewModel(INavigationService navigationService)
1111
{
1212
ScanQRCodeCommand = new Command(async () =>
1313
{
14-
await navigationService.DisplayModal<QRCodeScannerPage>();
14+
await navigationService.Navigate<QRCodeScannerPage>();
1515
});
1616
ViewOTPCommand = new Command((async () =>
1717
{
18-
await navigationService.DisplayModal<ViewOtpListPage>();
18+
await navigationService.Navigate<ViewOtpListPage>();
1919
}));
2020
ViewCredentialListCommand = new Command((async () =>
2121
{
22-
await navigationService.DisplayModal<ViewCredentialListPage>();
22+
await navigationService.Navigate<ViewCredentialListPage>();
2323
}));
2424
}
2525

src/Mobile/SimpleIdServer.Mobile/ViewOtpListPage.xaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,13 @@
1919
<common:Loader IsVisible="{Binding Path=IsLoading}" ZIndex="2" />
2020
<Grid ZIndex="1">
2121
<Grid.RowDefinitions>
22+
<RowDefinition Height="9*" />
2223
<RowDefinition Height="*" />
23-
<RowDefinition Height="8*" />
24-
<RowDefinition Height="*" />
25-
</Grid.RowDefinitions>
26-
<StackLayout Grid.Row="0" Style="{StaticResource modalToolbar}">
27-
<ImageButton Command="{Binding Path=CloseCommand}" Style="{StaticResource modalToolbarClose}" />
28-
<Label Style="{StaticResource modalToolbarTitle}">One Time Password</Label>
29-
<Label Text="Delete" Style="{StaticResource removeBtn}">
30-
<Label.GestureRecognizers>
31-
<TapGestureRecognizer Command="{Binding Path=RemoveSelectedOtpCommand}"></TapGestureRecognizer>
32-
</Label.GestureRecognizers>
33-
</Label>
34-
</StackLayout>
24+
</Grid.RowDefinitions>
3525
<!-- Display the selected OTP Code -->
36-
<components:ViewOTPCode Grid.Row="1" OTPCode="{Binding Path=SelectedOTPCode}" />
26+
<components:ViewOTPCode Grid.Row="0" OTPCode="{Binding Path=SelectedOTPCode}" />
3727
<!-- Display list of OTP Codes -->
38-
<CollectionView Grid.Row="2" ItemsSource="{Binding Path=OTPCodes}" SelectionMode="Single" SelectedItem="{Binding Path=SelectedOTPCode}">
28+
<CollectionView Grid.Row="1" ItemsSource="{Binding Path=OTPCodes}" SelectionMode="Single" SelectedItem="{Binding Path=SelectedOTPCode}">
3929
<CollectionView.ItemsLayout>
4030
<LinearItemsLayout Orientation="Horizontal" />
4131
</CollectionView.ItemsLayout>

0 commit comments

Comments
 (0)