From 36fe05e3c319ebe7e8f3703f7ef9233ae5dd9588 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Wed, 1 Oct 2025 12:35:34 +0200 Subject: [PATCH 1/3] Fix apertura fotocamera e fix codJcom interno --- .../Core/Services/AttachedService.cs | 10 +++-- .../Core/Services/ManageDataService.cs | 12 +++-- .../Platforms/Android/AndroidManifest.xml | 44 ++++++++++++++++--- .../Card/ActivityCard.razor.css | 6 +-- .../SingleElements/Modal/AddAttached.razor | 37 ++++++++++++---- .../Core/Services/IntegryApiService.cs | 11 ++++- 6 files changed, 94 insertions(+), 26 deletions(-) diff --git a/salesbook.Maui/Core/Services/AttachedService.cs b/salesbook.Maui/Core/Services/AttachedService.cs index 0d42acc..48bce9c 100644 --- a/salesbook.Maui/Core/Services/AttachedService.cs +++ b/salesbook.Maui/Core/Services/AttachedService.cs @@ -8,7 +8,9 @@ public class AttachedService : IAttachedService public async Task SelectImageFromCamera() { var cameraPerm = await Permissions.RequestAsync(); - if (cameraPerm != PermissionStatus.Granted) + var storagePerm = await Permissions.RequestAsync(); + + if (cameraPerm != PermissionStatus.Granted || storagePerm != PermissionStatus.Granted) return null; FileResult? result = null; @@ -20,6 +22,7 @@ public class AttachedService : IAttachedService catch (Exception ex) { Console.WriteLine($"Errore cattura foto: {ex.Message}"); + SentrySdk.CaptureException(ex); return null; } @@ -41,13 +44,13 @@ public class AttachedService : IAttachedService catch (Exception ex) { Console.WriteLine($"Errore selezione galleria: {ex.Message}"); + SentrySdk.CaptureException(ex); return null; } return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image); } - public async Task SelectFile() { var perm = await Permissions.RequestAsync(); @@ -115,6 +118,7 @@ public class AttachedService : IAttachedService catch (Exception e) { Console.WriteLine($"Errore durante il salvataggio dello stream: {e.Message}"); + SentrySdk.CaptureException(e); return null; } finally @@ -128,7 +132,7 @@ public class AttachedService : IAttachedService public async Task OpenFile(Stream file, string fileName) { var filePath = await SaveToTempStorage(file, fileName); - + if (filePath is null) return; await Launcher.OpenAsync(new OpenFileRequest { diff --git a/salesbook.Maui/Core/Services/ManageDataService.cs b/salesbook.Maui/Core/Services/ManageDataService.cs index 087b65a..75e325d 100644 --- a/salesbook.Maui/Core/Services/ManageDataService.cs +++ b/salesbook.Maui/Core/Services/ManageDataService.cs @@ -1,8 +1,8 @@ using AutoMapper; -using IntegryApiClient.Core.Domain.Abstraction.Contracts.Storage; using salesbook.Shared.Core.Dto; using salesbook.Shared.Core.Dto.Activity; using salesbook.Shared.Core.Dto.Contact; +using salesbook.Shared.Core.Dto.PageState; using salesbook.Shared.Core.Entity; using salesbook.Shared.Core.Helpers; using salesbook.Shared.Core.Helpers.Enum; @@ -10,7 +10,7 @@ using salesbook.Shared.Core.Interface; using salesbook.Shared.Core.Interface.IntegryApi; using salesbook.Shared.Core.Interface.System.Network; using System.Linq.Expressions; -using salesbook.Shared.Core.Dto.PageState; +using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account; namespace salesbook.Maui.Core.Services; @@ -19,7 +19,8 @@ public class ManageDataService( IMapper mapper, UserListState userListState, IIntegryApiService integryApiService, - INetworkService networkService + INetworkService networkService, + IUserSession userSession ) : IManageDataService { public Task> GetTable(Expression>? whereCond = null) where T : new() => @@ -260,6 +261,11 @@ public class ManageDataService( var returnDto = activities .Select(activity => { + if (activity.CodJcom is "0000" && userSession.ProfileDb != null && userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase)) + { + activity.CodJcom = null; + } + var dto = mapper.Map(activity); if (activity is { AlarmTime: not null, EstimatedTime: not null }) diff --git a/salesbook.Maui/Platforms/Android/AndroidManifest.xml b/salesbook.Maui/Platforms/Android/AndroidManifest.xml index 7c85307..34aac3e 100644 --- a/salesbook.Maui/Platforms/Android/AndroidManifest.xml +++ b/salesbook.Maui/Platforms/Android/AndroidManifest.xml @@ -1,27 +1,57 @@  - - - - + + + + + + + + + + + + - + + + + + - + + + + + + + + + + - \ No newline at end of file + + diff --git a/salesbook.Shared/Components/SingleElements/Card/ActivityCard.razor.css b/salesbook.Shared/Components/SingleElements/Card/ActivityCard.razor.css index 7e5a74e..a0757e0 100644 --- a/salesbook.Shared/Components/SingleElements/Card/ActivityCard.razor.css +++ b/salesbook.Shared/Components/SingleElements/Card/ActivityCard.razor.css @@ -10,17 +10,17 @@ .activity-card.memo { border-left: 5px solid var(--mud-palette-info-darken); - background-color: hsl(from var(--mud-palette-info-darken) h s 98%); + background-color: hsl(from var(--mud-palette-info-darken) h s 99%); } .activity-card.interna { border-left: 5px solid var(--mud-palette-success-darken); - background-color: hsl(from var(--mud-palette-success-darken) h s 98%); + background-color: hsl(from var(--mud-palette-success-darken) h s 99%); } .activity-card.commessa { border-left: 5px solid var(--mud-palette-warning); - background-color: hsl(from var(--mud-palette-warning) h s 98%); + background-color: hsl(from var(--mud-palette-warning) h s 99%); } .activity-left-section { diff --git a/salesbook.Shared/Components/SingleElements/Modal/AddAttached.razor b/salesbook.Shared/Components/SingleElements/Modal/AddAttached.razor index 2a27c74..ca68c9a 100644 --- a/salesbook.Shared/Components/SingleElements/Modal/AddAttached.razor +++ b/salesbook.Shared/Components/SingleElements/Modal/AddAttached.razor @@ -6,7 +6,7 @@ - + @if (RequireNewName) { @@ -71,9 +71,21 @@ private AttachedDTO? Attached { get; set; } - private bool RequireNewName { get; set; } + private bool _requireNewName; + private bool RequireNewName + { + get => _requireNewName; + set + { + _requireNewName = value; + TitleModal = _requireNewName ? "Nome allegato" : "Aggiungi allegati"; + StateHasChanged(); + } + } private bool SelectTypePicture { get; set; } + private string TitleModal { get; set; } = "Aggiungi allegati"; + private string? _newName; private string? NewName { @@ -102,16 +114,22 @@ { Attached = await AttachedService.SelectImageFromCamera(); - RequireNewName = true; - StateHasChanged(); + if (Attached != null) + { + RequireNewName = true; + StateHasChanged(); + } } private async Task OnGallery() { Attached = await AttachedService.SelectImageFromGallery(); - RequireNewName = true; - StateHasChanged(); + if (Attached != null) + { + RequireNewName = true; + StateHasChanged(); + } } private async Task OnFile() @@ -124,8 +142,11 @@ { Attached = await AttachedService.SelectPosition(); - RequireNewName = true; - StateHasChanged(); + if (Attached != null) + { + RequireNewName = true; + StateHasChanged(); + } } private void OnNewName() diff --git a/salesbook.Shared/Core/Services/IntegryApiService.cs b/salesbook.Shared/Core/Services/IntegryApiService.cs index 4a3d943..8c603d0 100644 --- a/salesbook.Shared/Core/Services/IntegryApiService.cs +++ b/salesbook.Shared/Core/Services/IntegryApiService.cs @@ -72,8 +72,15 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser return integryApiRestClient.AuthorizedGet($"activity/delete", queryParams); } - public Task?> SaveActivity(ActivityDTO activity) => - integryApiRestClient.AuthorizedPost?>("crm/saveActivity", activity); + public Task?> SaveActivity(ActivityDTO activity) + { + if (activity.CodJcom is null && userSession.ProfileDb != null && userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase)) + { + activity.CodJcom = "0000"; + } + + return integryApiRestClient.AuthorizedPost?>("crm/saveActivity", activity); + } public Task SaveContact(CRMCreateContactRequestDTO request) => integryApiRestClient.AuthorizedPost("crm/createContact", request); From ff36b1cdab9019cbf6ad2cf264e6e9534782b4e6 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Thu, 2 Oct 2025 23:48:14 +0200 Subject: [PATCH 2/3] Fix salvataggio posizione --- salesbook.Shared/Core/Dto/Activity/ActivityDTO.cs | 3 ++- salesbook.Shared/Core/Dto/PositionDTO.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/salesbook.Shared/Core/Dto/Activity/ActivityDTO.cs b/salesbook.Shared/Core/Dto/Activity/ActivityDTO.cs index f96e682..2e70722 100644 --- a/salesbook.Shared/Core/Dto/Activity/ActivityDTO.cs +++ b/salesbook.Shared/Core/Dto/Activity/ActivityDTO.cs @@ -17,7 +17,8 @@ public class ActivityDTO : StbActivity public DateTime? NotificationDate { get; set; } public bool Deleted { get; set; } - + + [JsonPropertyName("stbPosizioni")] public PositionDTO? Position { get; set; } public ActivityDTO Clone() diff --git a/salesbook.Shared/Core/Dto/PositionDTO.cs b/salesbook.Shared/Core/Dto/PositionDTO.cs index e283c6d..6db1212 100644 --- a/salesbook.Shared/Core/Dto/PositionDTO.cs +++ b/salesbook.Shared/Core/Dto/PositionDTO.cs @@ -7,7 +7,7 @@ public class PositionDTO [JsonPropertyName("id")] public long? Id { get; set; } - [JsonPropertyName("description")] + [JsonPropertyName("descrizione")] public string? Description { get; set; } [JsonPropertyName("lat")] From f4621f48c80bb06997755c32844530dab9a26d9a Mon Sep 17 00:00:00 2001 From: MarcoE Date: Fri, 3 Oct 2025 00:02:08 +0200 Subject: [PATCH 3/3] -> 2.0.2 (9) --- salesbook.Maui/salesbook.Maui.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salesbook.Maui/salesbook.Maui.csproj b/salesbook.Maui/salesbook.Maui.csproj index 8bd04a4..40a8691 100644 --- a/salesbook.Maui/salesbook.Maui.csproj +++ b/salesbook.Maui/salesbook.Maui.csproj @@ -30,7 +30,7 @@ 2.0.2 - 8 + 9 14.2