Fix apertura fotocamera e fix codJcom interno

This commit is contained in:
2025-10-01 12:35:34 +02:00
parent 7359310c48
commit 36fe05e3c3
6 changed files with 94 additions and 26 deletions

View File

@@ -8,7 +8,9 @@ public class AttachedService : IAttachedService
public async Task<AttachedDTO?> SelectImageFromCamera()
{
var cameraPerm = await Permissions.RequestAsync<Permissions.Camera>();
if (cameraPerm != PermissionStatus.Granted)
var storagePerm = await Permissions.RequestAsync<Permissions.StorageWrite>();
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<AttachedDTO?> SelectFile()
{
var perm = await Permissions.RequestAsync<Permissions.StorageRead>();
@@ -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
{