WIP: Add iOS version #10

Draft
Deadpikle wants to merge 67 commits from feature/ios into main
2 changed files with 28 additions and 6 deletions
Showing only changes of commit 7be1e16489 - Show all commits
@@ -194,7 +194,7 @@ class ReportPDFCreator : ChangeNotifier
} }
var imageTitle = string.IsNullOrWhiteSpace(file.Title) ? file.FileName : file.Title; var imageTitle = string.IsNullOrWhiteSpace(file.Title) ? file.FileName : file.Title;
var imageTitlePar = MakeParagraph(section, imageTitle, true, 12, "ReceiptTitlePar"); var imageTitlePar = MakeParagraph(section, imageTitle, true, 12, "ReceiptTitlePar");
MakeParagraph(section, file.ReceiptDate.ToString("yyyy-MM-dd"), true, 12, "ReceiptDatePar"); MakeParagraph(section, file.ReceiptDate.ToString(appSettings.ReportDateFormat), true, 12, "ReceiptDatePar");
if (!string.IsNullOrWhiteSpace(file.Notes)) if (!string.IsNullOrWhiteSpace(file.Notes))
{ {
var imageNotesPar = MakeParagraph(section, file.Notes, false, 10, "ReceiptNotesPar"); var imageNotesPar = MakeParagraph(section, file.Notes, false, 10, "ReceiptNotesPar");
@@ -12,6 +12,8 @@ using MayShow.Helpers;
using MayShow.Interfaces; using MayShow.Interfaces;
using MayShow.Models; using MayShow.Models;
using MayShows.Helpers; using MayShows.Helpers;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace MayShow.ViewModels; namespace MayShow.ViewModels;
@@ -25,6 +27,7 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
private PDFReport _pdfReport; private PDFReport _pdfReport;
private Settings _settings; private Settings _settings;
private List<DateDisplayFormat> _dateDisplayFormats;
private bool _hasUnsavedWork; private bool _hasUnsavedWork;
private CreatePDFReportViewModel(IChangeViewModel viewModelChanger) : base(viewModelChanger) private CreatePDFReportViewModel(IChangeViewModel viewModelChanger) : base(viewModelChanger)
@@ -36,6 +39,9 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
ReportFiles = []; ReportFiles = [];
_programLog = ""; _programLog = "";
_settings = Settings.LoadSettings(); _settings = Settings.LoadSettings();
_dateDisplayFormats = Constants.GetDateDisplayFormats();
NotifyPropertyChanged(nameof(DataGridDateFormat));
NotifyPropertyChanged(nameof(DataGridDateFormatWatermark));
HasUnsavedWork = false; HasUnsavedWork = false;
// setup initial quote and program log data // setup initial quote and program log data
InitializeProgramLog(); InitializeProgramLog();
@@ -199,6 +205,16 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
} }
} }
public string DataGridDateFormat
{
get => _settings.DataGridDateFormat;
}
public string DataGridDateFormatWatermark
{
get => _dateDisplayFormats.FirstOrDefault(x => x.Value == _settings.DataGridDateFormat)?.Example ?? "2025-12-04";
}
private void SetupFileCollectionChangedWatcher() private void SetupFileCollectionChangedWatcher()
{ {
_pdfReport.Files.CollectionChanged += ( sender, e ) => _pdfReport.Files.CollectionChanged += ( sender, e ) =>
@@ -213,7 +229,9 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
var quotes = Constants.GetQuotes(); var quotes = Constants.GetQuotes();
var random = new Random(); var random = new Random();
var quoteIndex = random.Next(0, quotes.Length); var quoteIndex = random.Next(0, quotes.Length);
_programLog = "----- MayShow v" + Constants.AppVersion + " ------" + Environment.NewLine; var compDetails = RuntimeInformation.OSDescription + " | " +
RuntimeInformation.OSArchitecture.ToString();
_programLog = "----- MayShow v" + Constants.AppVersion + " | " + compDetails + " ------" + Environment.NewLine;
_programLog += quotes[quoteIndex] + Environment.NewLine; _programLog += quotes[quoteIndex] + Environment.NewLine;
_programLog += "---------------------------------------" + Environment.NewLine; _programLog += "---------------------------------------" + Environment.NewLine;
_programLog += "Loaded and ready to create report!" + Environment.NewLine; _programLog += "Loaded and ready to create report!" + Environment.NewLine;
@@ -337,6 +355,8 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
_settings = (Settings)updatedSettings; _settings = (Settings)updatedSettings;
await _settings.SaveSettingsAsync(); await _settings.SaveSettingsAsync();
LogInfo("Saved updated settings!"); LogInfo("Saved updated settings!");
NotifyPropertyChanged(nameof(DataGridDateFormat));
NotifyPropertyChanged(nameof(DataGridDateFormatWatermark));
} }
} }
@@ -552,13 +572,15 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
{ {
LogInfo(e.StackTrace); LogInfo(e.StackTrace);
} }
if (e.InnerException != null) var otherException = e.InnerException;
while (otherException != null)
{ {
LogInfo("Inner exception: " + e.InnerException.Message); LogInfo(">> Inner exception: " + otherException.Message);
if (e.InnerException.StackTrace != null) if (otherException.StackTrace != null)
{ {
LogInfo(e.InnerException.StackTrace); LogInfo(otherException.StackTrace);
} }
otherException = otherException.InnerException;
} }
LogInfo("Please report this error to a programmer or fix the issue listed above."); LogInfo("Please report this error to a programmer or fix the issue listed above.");
IsCreatingPDF = false; IsCreatingPDF = false;