From 3fd5410bf52ab24e883c0af66ccd88399e43d9d6 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Fri, 14 Nov 2025 12:40:17 +0100 Subject: [PATCH] Aggiunta versione app a video --- salesbook.Maui/Core/System/GenericSystemService.cs | 8 ++++++++ salesbook.Maui/MauiProgram.cs | 3 +++ salesbook.Shared/Components/Pages/Login.razor | 4 +++- salesbook.Shared/Components/Pages/PersonalInfo.razor | 9 +++++++-- salesbook.Shared/Components/Pages/SyncPage.razor | 3 +++ .../Components/SingleElements/AppVersion.razor | 6 ++++++ .../Components/SingleElements/AppVersion.razor.css | 11 +++++++++++ .../Core/Interface/System/IGenericSystemService.cs | 6 ++++++ 8 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 salesbook.Maui/Core/System/GenericSystemService.cs create mode 100644 salesbook.Shared/Components/SingleElements/AppVersion.razor create mode 100644 salesbook.Shared/Components/SingleElements/AppVersion.razor.css create mode 100644 salesbook.Shared/Core/Interface/System/IGenericSystemService.cs diff --git a/salesbook.Maui/Core/System/GenericSystemService.cs b/salesbook.Maui/Core/System/GenericSystemService.cs new file mode 100644 index 0000000..022f53d --- /dev/null +++ b/salesbook.Maui/Core/System/GenericSystemService.cs @@ -0,0 +1,8 @@ +using salesbook.Shared.Core.Interface.System; + +namespace salesbook.Maui.Core.System; + +public class GenericSystemService : IGenericSystemService +{ + public string GetCurrentAppVersion() => AppInfo.VersionString; +} \ No newline at end of file diff --git a/salesbook.Maui/MauiProgram.cs b/salesbook.Maui/MauiProgram.cs index e1bf355..7430936 100644 --- a/salesbook.Maui/MauiProgram.cs +++ b/salesbook.Maui/MauiProgram.cs @@ -7,6 +7,7 @@ using MudBlazor.Services; using MudExtensions.Services; using salesbook.Maui.Core.RestClient.IntegryApi; using salesbook.Maui.Core.Services; +using salesbook.Maui.Core.System; using salesbook.Maui.Core.System.Network; using salesbook.Maui.Core.System.Notification; using salesbook.Maui.Core.System.Notification.Push; @@ -16,6 +17,7 @@ using salesbook.Shared.Core.Dto.PageState; using salesbook.Shared.Core.Helpers; using salesbook.Shared.Core.Interface; using salesbook.Shared.Core.Interface.IntegryApi; +using salesbook.Shared.Core.Interface.System; using salesbook.Shared.Core.Interface.System.Network; using salesbook.Shared.Core.Interface.System.Notification; using salesbook.Shared.Core.Messages.Activity.Copy; @@ -102,6 +104,7 @@ namespace salesbook.Maui builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); + builder.Services.AddSingleton(); builder.Services.AddSingleton(); _ = typeof(System.Runtime.InteropServices.SafeHandle); diff --git a/salesbook.Shared/Components/Pages/Login.razor b/salesbook.Shared/Components/Pages/Login.razor index fd39faf..756401c 100644 --- a/salesbook.Shared/Components/Pages/Login.razor +++ b/salesbook.Shared/Components/Pages/Login.razor @@ -1,8 +1,10 @@ @page "/login" @using salesbook.Shared.Components.Layout.Spinner +@using salesbook.Shared.Core.Interface.System @using salesbook.Shared.Core.Services @inject IUserAccountService UserAccountService @inject AppAuthenticationStateProvider AuthenticationStateProvider +@inject IGenericSystemService GenericSystemService @if (Spinner) { @@ -34,7 +36,7 @@ else diff --git a/salesbook.Shared/Components/Pages/PersonalInfo.razor b/salesbook.Shared/Components/Pages/PersonalInfo.razor index 719bf67..7ff2873 100644 --- a/salesbook.Shared/Components/Pages/PersonalInfo.razor +++ b/salesbook.Shared/Components/Pages/PersonalInfo.razor @@ -1,6 +1,7 @@ @page "/PersonalInfo" @attribute [Authorize] @using salesbook.Shared.Components.Layout +@using salesbook.Shared.Components.SingleElements @using salesbook.Shared.Core.Authorization.Enum @using salesbook.Shared.Core.Interface @using salesbook.Shared.Core.Interface.System.Network @@ -16,7 +17,8 @@
- + @UtilityString.ExtractInitials(UserSession.User.Fullname) @@ -24,7 +26,8 @@ @UserSession.User.Fullname @if (UserSession.User.KeyGroup is not null) { - @(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable()) + @(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable()) }
@@ -113,6 +116,8 @@
+ + } @code { diff --git a/salesbook.Shared/Components/Pages/SyncPage.razor b/salesbook.Shared/Components/Pages/SyncPage.razor index 1597d9f..3cd0968 100644 --- a/salesbook.Shared/Components/Pages/SyncPage.razor +++ b/salesbook.Shared/Components/Pages/SyncPage.razor @@ -1,12 +1,15 @@ @page "/sync" @page "/sync/{DateFilter}" @using salesbook.Shared.Components.Layout.Spinner +@using salesbook.Shared.Components.SingleElements @using salesbook.Shared.Core.Interface @inject ISyncDbService syncDb @inject IManageDataService manageData + + @code { [Parameter] public string? DateFilter { get; set; } diff --git a/salesbook.Shared/Components/SingleElements/AppVersion.razor b/salesbook.Shared/Components/SingleElements/AppVersion.razor new file mode 100644 index 0000000..0b76be2 --- /dev/null +++ b/salesbook.Shared/Components/SingleElements/AppVersion.razor @@ -0,0 +1,6 @@ +@using salesbook.Shared.Core.Interface.System +@inject IGenericSystemService GenericSystemService + +
+ @($"v{GenericSystemService.GetCurrentAppVersion()}") +
\ No newline at end of file diff --git a/salesbook.Shared/Components/SingleElements/AppVersion.razor.css b/salesbook.Shared/Components/SingleElements/AppVersion.razor.css new file mode 100644 index 0000000..e4baf00 --- /dev/null +++ b/salesbook.Shared/Components/SingleElements/AppVersion.razor.css @@ -0,0 +1,11 @@ +.app-version{ + width: 100%; + display: flex; + justify-content: center; + margin: 8px 0; +} + +.app-version span{ + font-size: smaller; + color: var(--mud-palette-gray-darker); +} \ No newline at end of file diff --git a/salesbook.Shared/Core/Interface/System/IGenericSystemService.cs b/salesbook.Shared/Core/Interface/System/IGenericSystemService.cs new file mode 100644 index 0000000..865e0b1 --- /dev/null +++ b/salesbook.Shared/Core/Interface/System/IGenericSystemService.cs @@ -0,0 +1,6 @@ +namespace salesbook.Shared.Core.Interface.System; + +public interface IGenericSystemService +{ + string GetCurrentAppVersion(); +} \ No newline at end of file