WIP: Add iOS version #10
@@ -11,6 +11,9 @@ class Constants
|
|||||||
public static string[] AllowedFileExtensionPatterns = [ "*.png", "*.jpg", "*.jpeg", "*.gif", "*.bmp", "*.webp", "*.pdf", "*.heic", ];
|
public static string[] AllowedFileExtensionPatterns = [ "*.png", "*.jpg", "*.jpeg", "*.gif", "*.bmp", "*.webp", "*.pdf", "*.heic", ];
|
||||||
public static string[] AllowedFileExtensionsNoStar = [ "png", "jpg", "jpeg", "gif", "bmp", "webp", "pdf", "heic", ];
|
public static string[] AllowedFileExtensionsNoStar = [ "png", "jpg", "jpeg", "gif", "bmp", "webp", "pdf", "heic", ];
|
||||||
|
|
||||||
|
public static string[] FilePickerMimeTypes = [ "image/*", "application/pdf", "image/heic" ];
|
||||||
|
public static string[] FilePickerAppleTypeIdentifiers = [ "public.image", "com.adobe.pdf", "public.heic" ];
|
||||||
|
|
||||||
public static string ReportSavedDataFileName = "report_data.json";
|
public static string ReportSavedDataFileName = "report_data.json";
|
||||||
|
|
||||||
public static List<DateDisplayFormat> GetDateDisplayFormats()
|
public static List<DateDisplayFormat> GetDateDisplayFormats()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Text.Json.Serialization;
|
|||||||
using System.Text.Json.Serialization.Metadata;
|
using System.Text.Json.Serialization.Metadata;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
using MayShow.Models;
|
using MayShow.Models;
|
||||||
|
|
||||||
namespace MayShow.Helpers;
|
namespace MayShow.Helpers;
|
||||||
@@ -140,4 +141,24 @@ class Utilities
|
|||||||
var json = await reader.ReadToEndAsync();
|
var json = await reader.ReadToEndAsync();
|
||||||
await File.WriteAllTextAsync(path, json);
|
await File.WriteAllTextAsync(path, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FilePickerFileType[] GetReportFilePickerFileTypes()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new FilePickerFileType("All Types")
|
||||||
|
{
|
||||||
|
Patterns = Constants.AllowedFileExtensionPatterns,
|
||||||
|
AppleUniformTypeIdentifiers = Constants.FilePickerAppleTypeIdentifiers,
|
||||||
|
MimeTypes = Constants.FilePickerMimeTypes,
|
||||||
|
},
|
||||||
|
FilePickerFileTypes.ImageAll,
|
||||||
|
new FilePickerFileType("HEIC Images")
|
||||||
|
{
|
||||||
|
Patterns = [ "*.heic" ],
|
||||||
|
AppleUniformTypeIdentifiers = [ "public.heic" ],
|
||||||
|
MimeTypes = [ "image/heic" ]
|
||||||
|
},
|
||||||
|
FilePickerFileTypes.Pdf,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -296,22 +296,7 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
|
|||||||
{
|
{
|
||||||
Title = "Choose image or PDF files...",
|
Title = "Choose image or PDF files...",
|
||||||
AllowMultiple = true,
|
AllowMultiple = true,
|
||||||
FileTypeFilter = [
|
FileTypeFilter = Utilities.GetReportFilePickerFileTypes(),
|
||||||
new FilePickerFileType("All Types")
|
|
||||||
{
|
|
||||||
Patterns = Constants.AllowedFileExtensionPatterns,
|
|
||||||
AppleUniformTypeIdentifiers = [ "public.image", "com.adobe.pdf", "public.heic" ],
|
|
||||||
MimeTypes = [ "image/*", "application/pdf", "image/heic" ]
|
|
||||||
},
|
|
||||||
FilePickerFileTypes.ImageAll,
|
|
||||||
new FilePickerFileType("HEIC Images")
|
|
||||||
{
|
|
||||||
Patterns = [ "*.heic" ],
|
|
||||||
AppleUniformTypeIdentifiers = [ "public.heic" ],
|
|
||||||
MimeTypes = [ "image/heic" ]
|
|
||||||
},
|
|
||||||
FilePickerFileTypes.Pdf,
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
if (files.Count > 0)
|
if (files.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -401,22 +386,7 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
|
|||||||
{
|
{
|
||||||
Title = "Choose image or PDF file...",
|
Title = "Choose image or PDF file...",
|
||||||
AllowMultiple = false,
|
AllowMultiple = false,
|
||||||
FileTypeFilter = [
|
FileTypeFilter = Utilities.GetReportFilePickerFileTypes(),
|
||||||
new FilePickerFileType("All Types")
|
|
||||||
{
|
|
||||||
Patterns = Constants.AllowedFileExtensionPatterns,
|
|
||||||
AppleUniformTypeIdentifiers = [ "public.image", "com.adobe.pdf", "public.heic" ],
|
|
||||||
MimeTypes = [ "image/*", "application/pdf", "image/heic" ]
|
|
||||||
},
|
|
||||||
FilePickerFileTypes.ImageAll,
|
|
||||||
new FilePickerFileType("HEIC Images")
|
|
||||||
{
|
|
||||||
Patterns = [ "*.heic" ],
|
|
||||||
AppleUniformTypeIdentifiers = [ "public.heic" ],
|
|
||||||
MimeTypes = [ "image/heic" ]
|
|
||||||
},
|
|
||||||
FilePickerFileTypes.Pdf,
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
if (files.Count > 0)
|
if (files.Count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user