Skip to content

Commit 67c7e55

Browse files
committed
ADD: status bar component
FIX: full screen mode Desktop, increase timeout for barcode enter Mobile UPDATE: migrate to new net9 maui start up, trimming output app STYLE: update design of transfer form - Mobile
1 parent 0e396ef commit 67c7e55

23 files changed

+217
-229
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1+
using Microsoft.Extensions.Configuration;
2+
using Pl.Shared.Web.Extensions;
3+
14
namespace Pl.Desktop.Client;
25

36
public partial class App : Application
47
{
8+
private readonly bool _fullScreen;
9+
510
private static readonly Mutex Mutex = new(true, Assembly.GetEntryAssembly()?.GetName().Name);
611

7-
public App()
12+
public App(IConfiguration configuration)
813
{
914
if (!Mutex.WaitOne(TimeSpan.Zero, true))
1015
{
1116
Current?.Quit();
1217
Environment.Exit(0);
1318
}
19+
20+
_fullScreen = configuration.GetSection("System").GetValueOrDefault("FullScreenMode", true);
1421
InitializeComponent();
1522
}
1623

1724
protected override Window CreateWindow(IActivationState? activationState) =>
18-
new(new MainPage()) { Title = "Palleto Desktop" };
19-
}
25+
new(new MainPage(_fullScreen)) { Title = "Palleto Desktop" };
26+
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1+
using MauiPageFullScreen;
12
using Microsoft.AspNetCore.Components.WebView;
23

34
namespace Pl.Desktop.Client;
45

56
public partial class MainPage : ContentPage
67
{
7-
public MainPage()
8+
private readonly bool _fullScreen;
9+
public MainPage(bool fullScreen)
810
{
911
InitializeComponent();
12+
_fullScreen = fullScreen;
1013
}
1114

1215
private void Bwv_BlazorWebViewInitialized(object sender, BlazorWebViewInitializedEventArgs e)
1316
{
1417
e.WebView.CoreWebView2.Settings.IsPinchZoomEnabled = false;
1518
e.WebView.CoreWebView2.Settings.IsZoomControlEnabled = false;
19+
if (_fullScreen) Controls.FullScreen();
1620
}
17-
}
21+
}

Src/Apps/Mobile/Pl.Mobile.Client/App.xaml.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ public partial class App : Application
55
public App()
66
{
77
InitializeComponent();
8-
MainPage = new MainPage();
98
}
10-
}
9+
10+
protected override Window CreateWindow(IActivationState? activationState) =>
11+
new(new MainPage()) { Title = "Palleto Mobile" };
12+
}

Src/Apps/Mobile/Pl.Mobile.Client/Pl.Mobile.Client.csproj

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

3-
<ItemGroup Label="Static assets">
4-
<MauiIcon Include="Resources\appicon.svg" BaseSize="32,32" Color="#fff" />
5-
<MauiSplashScreen Include="Resources\organization_icon.svg" Color="#f5f5f6" />
6-
</ItemGroup>
7-
8-
<ItemGroup Label="Prod Restrictions" Condition="'$(Configuration)' == 'ReleaseVS'">
9-
<MauiXaml Remove="ScanPage.xaml" />
10-
<Compile Remove="ScanPage.xaml.cs" />
11-
<Content Remove="ScanPage.xaml.cs" />
12-
</ItemGroup>
13-
143
<PropertyGroup Label="Primary">
154
<TargetFramework>net9.0-android</TargetFramework>
165

@@ -21,13 +10,24 @@
2110
<SelfContained>false</SelfContained>
2211
<SupportedOSPlatformVersion>24.0</SupportedOSPlatformVersion>
2312

24-
<ApplicationTitle>Pl.Mobile.Client</ApplicationTitle>
13+
<ApplicationTitle>Palleto Mobile</ApplicationTitle>
2514
<ApplicationId>ru.vladstandart.scalesmobile</ApplicationId>
2615
<ApplicationIdGuid>C663D42A-C3A4-4848-AD9A-D10C23EE4ED1</ApplicationIdGuid>
2716

2817
<NoWarn>XA4301</NoWarn>
2918
</PropertyGroup>
3019

20+
<ItemGroup Label="Static assets">
21+
<MauiIcon Include="Resources\appicon.svg" BaseSize="32,32" Color="#fff" />
22+
<MauiSplashScreen Include="Resources\organization_icon.svg" Color="#f5f5f6" />
23+
</ItemGroup>
24+
25+
<ItemGroup Label="Prod Restrictions" Condition="'$(Configuration)' == 'ReleaseVS'">
26+
<MauiXaml Remove="ScanPage.xaml" />
27+
<Compile Remove="ScanPage.xaml.cs" />
28+
<Content Remove="ScanPage.xaml.cs" />
29+
</ItemGroup>
30+
3131
<ItemGroup Label="Directory.Packages.props">
3232
<PackageReference Include="CommunityToolkit.Maui" />
3333
<PackageReference Include="FluentValidation" />

Src/Apps/Mobile/Pl.Mobile.Client/Platforms/Android/MainActivity.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
using Android.Content.PM;
33

44
namespace Pl.Mobile.Client;
5+
56
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
6-
public class MainActivity : MauiAppCompatActivity;
7+
public class MainActivity : MauiAppCompatActivity;

Src/Apps/Mobile/Pl.Mobile.Client/Platforms/Android/MainApplication.cs

+4-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
using Android.Runtime;
33

44
namespace Pl.Mobile.Client;
5+
56
[Application]
6-
public class MainApplication : MauiApplication
7+
public class MainApplication(IntPtr handle, JniHandleOwnership ownership) : MauiApplication(handle, ownership)
78
{
8-
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
9-
: base(handle, ownership)
10-
{
11-
}
12-
13-
protected override MauiApp CreateMauiApp() => Pl.Mobile.Client.MauiProgram.CreateMauiApp();
14-
}
9+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
10+
}

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/AuthSuspense/AuthSuspense.razor

+8-8
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ else
8080

8181
try
8282
{
83-
ToastService.ShowProgressToast(new()
84-
{
85-
Id = toastId,
86-
Intent = ToastIntent.Progress,
87-
Title = "Процесс авторизации",
88-
Timeout = null,
89-
Content = new() { Details = "Подождите пока мы не проверим пользователя по данному коду" }
90-
});
83+
// ToastService.ShowProgressToast(new()
84+
// {
85+
// Id = toastId,
86+
// Intent = ToastIntent.Progress,
87+
// Title = "Процесс авторизации",
88+
// Timeout = null,
89+
// Content = new() { Details = "Подождите пока мы не проверим пользователя по данному коду" }
90+
// });
9191
9292
UserDto dto = await MobileApi.GetUserByCode(parsedPassword);
9393

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/CloseAppDialog.razor

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
if (Application.Current == null) return;
2828
Application.Current.Quit();
2929
}
30-
private async Task CloseDialog() => await Dialog.CloseAsync();
3130

32-
}
31+
private async Task CloseDialog() => await Dialog.CloseAsync();
32+
}

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/Debug/CameraBarcodeScanner.razor

+14-6
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040

4141
private async Task OpenCameraScanner()
4242
{
43-
if (Application.Current?.MainPage == null) return;
44-
await Application.Current.MainPage.Navigation.PushModalAsync(ScanPage.Value);
43+
Page? mainPage = Application.Current?.Windows[0].Page;
44+
if (mainPage == null) return;
45+
await mainPage.Navigation.PushModalAsync(ScanPage.Value);
4546
}
4647

4748
private async Task OpenCameraScannerWithCooldown()
@@ -59,10 +60,17 @@
5960

6061
private async void OnScanCompleted(object? sender, string value)
6162
{
62-
if (string.IsNullOrWhiteSpace(value)) return;
63-
string formattedValue = value.Trim();
64-
formattedValue = new(formattedValue.Where(char.IsDigit).ToArray());
65-
await ValueChanged.InvokeAsync(formattedValue);
63+
try
64+
{
65+
if (string.IsNullOrWhiteSpace(value)) return;
66+
string formattedValue = value.Trim();
67+
formattedValue = new(formattedValue.Where(char.IsDigit).ToArray());
68+
await ValueChanged.InvokeAsync(formattedValue);
69+
}
70+
catch
71+
{
72+
// pass
73+
}
6674
}
6775

6876
public void Dispose()

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/PageHeader.razor

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
@using Blazor.Heroicons.Outline
22

3-
<div class="flex h-12 items-center shrink-0 w-full px-2 border-b">
4-
<Button Link="@Routes.Home" Variant="ButtonVariantType.Ghost">
3+
<div class="grid h-10 items-center shrink-0 w-full px-2 grid-cols-[1fr,auto,1fr]">
4+
<Button Link="@Routes.Home" Variant="ButtonVariantType.Ghost" Size="ButtonSizeType.Icon">
55
<ArrowLeftIcon class="size-4 mr-3" />
6-
<span>@Title</span>
76
</Button>
7+
@if (!string.IsNullOrWhiteSpace(Title))
8+
{
9+
<h2>@Title</h2>
10+
}
811
</div>
912

1013
@code {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class="@TwMerge.Merge("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", Class)">
2+
<div class="h-full w-full flex-1 bg-primary transition-transform ease-in-out duration-500" style="@($"transform: translateX(-{100 - Value}%);")"></div>
3+
</div>
4+
5+
@code {
6+
[Inject] private TwMerge TwMerge { get; set; } = default!;
7+
[Parameter] public string Class { get; set; } = string.Empty;
8+
[Parameter] public int Value { get; set; }
9+
}

Src/Apps/Mobile/Pl.Mobile.Client/Source/Widgets/TransferForm/DocumentStage.razor Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Transfer/TransferForm/DocumentStage.razor

+9-18
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
1-
@using Blazor.Heroicons.Outline
21
@using Pl.Mobile.Client.Source.Features.Debug
32

43
<InternalBarcodeScanner ValueChanged="@SetDocumentNumber" />
54

6-
<div class="flex flex-col size-full justify-between py-3 px-2">
7-
<div class="size-full overflow-hidden flex items-center justify-center">
8-
@if (string.IsNullOrWhiteSpace(DocumentNumber))
9-
{
10-
<div class="flex flex-col items-center gap-1 text-center">
11-
<DocumentTextIcon class="size-10 stroke-[0.95]" />
12-
<h3 class="text-lg font-medium">Отсканируйте штрихкод документа</h3>
13-
</div>
14-
}
15-
else
16-
{
17-
<FormFieldWrapper Label="Штрихкод документа" Class="!space-y-1">
18-
<InputTextField Value="@DocumentNumber" Class="!h-8" ReadOnly />
19-
</FormFieldWrapper>
20-
}
5+
<div class="flex flex-col size-full justify-between p-4">
6+
<div class="flex flex-col overflow-hidden w-full pt-1">
7+
<h2 class="text-2xl font-bold text-center tracking-tight">Сканирование документа</h2>
8+
<h3 class="text-xs text-muted-foreground text-center tracking-tight pt-1">Используйте считыватель штрихкода <br /> и отсканируйте основной штрихкод документа переноса паллеты</h3>
9+
<div class="w-full pt-4">
10+
<InputTextField Value="@DocumentNumber" Class="rounded-lg" ReadOnly />
11+
</div>
2112
</div>
2213
<div class="shrink-0 w-full flex flex-col gap-2">
2314

2415
@{
25-
#if DEBUG
16+
#if DEBUG
2617
}
2718
@* ReSharper disable once Razor.UnresolvedComponent *@
2819
<CameraBarcodeScanner Variant="ButtonVariantType.Outline" ValueChanged="@SetDocumentNumber"/>
2920
@{
30-
#endif
21+
#endif
3122
}
3223

3324
<Button OnClick="@OnSuccessAction" Disabled="@string.IsNullOrWhiteSpace(DocumentNumber)">

Src/Apps/Mobile/Pl.Mobile.Client/Source/Widgets/TransferForm/PalletsStage.razor Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Transfer/TransferForm/PalletsStage.razor

+22-34
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,37 @@
33

44
<InternalBarcodeScanner ValueChanged="@AddNewPallet" />
55

6-
<div class="flex flex-col size-full justify-between overflow-hidden py-3 px-2">
7-
@if (!Pallets.Any())
8-
{
9-
<div class="size-full flex items-center justify-center py-4">
10-
<div class="flex flex-col items-center gap-1 text-center">
11-
<DocumentTextIcon class="size-10 stroke-[0.95]"/>
12-
<h3 class="text-lg font-medium">Отсканируйте штрихкод паллеты</h3>
13-
</div>
14-
</div>
15-
}
16-
else
17-
{
18-
<div class="size-full flex flex-col py-4 gap-1 overflow-hidden">
19-
<h3 class="text-sm font-medium">Штрихкода паллет</h3>
20-
<ul class="size-full items-center flex flex-col gap-1 overflow-y-auto">
21-
@foreach (string item in Pallets.ToArray().Reverse())
22-
{
23-
<li class="w-full">
24-
<button
25-
type="button"
26-
@onclick="@(() => DeletePalletItem(item))"
27-
Class="w-full overflow-hidden items-center h-8 text-sm rounded-md bg-background border px-3 flex gap-2"
28-
>
29-
<XMarkIcon class="size-4 shrink-0"/>
30-
<span class="truncate">@item</span>
31-
</button>
32-
</li>
33-
}
34-
</ul>
35-
</div>
36-
}
6+
<div class="flex flex-col size-full justify-between overflow-hidden p-4">
7+
<div class="flex flex-col overflow-hidden w-full pt-1">
8+
<h2 class="text-2xl font-bold tracking-tight text-center">Сканирование паллет</h2>
9+
<h3 class="text-xs text-muted-foreground tracking-tight text-center pt-1">Используйте считыватель штрихкода <br /> и отсканируйте штрихкоды с паллет</h3>
10+
<ul class="size-full flex flex-col gap-1.5 py-4 overflow-y-auto">
11+
@foreach (string item in Pallets.ToArray().Reverse())
12+
{
13+
<li class="w-full">
14+
<button
15+
type="button"
16+
@onclick="@(() => DeletePalletItem(item))"
17+
Class="w-full overflow-hidden items-center h-9 text-sm rounded-lg bg-background border px-2.5 flex gap-2"
18+
>
19+
<XMarkIcon class="size-4 shrink-0"/>
20+
<span class="truncate">@item</span>
21+
</button>
22+
</li>
23+
}
24+
</ul>
25+
</div>
3726
<div class="shrink-0 w-full flex flex-col gap-2">
3827
<Button OnClick="@OnCancelAction" Variant="ButtonVariantType.Outline">
3928
Назад
4029
</Button>
41-
4230
@{
43-
#if DEBUG
31+
#if DEBUG
4432
}
4533
@* ReSharper disable once Razor.UnresolvedComponent *@
4634
<CameraBarcodeScanner Variant="ButtonVariantType.Outline" ValueChanged="@AddNewPallet"/>
4735
@{
48-
#endif
36+
#endif
4937
}
5038

5139
<Button OnClick="@OnSuccessAction" Disabled="@(!Pallets.Any())">

0 commit comments

Comments
 (0)