WIP: Add iOS version #10

Draft
Deadpikle wants to merge 67 commits from feature/ios into main
2 changed files with 38 additions and 2 deletions
Showing only changes of commit c3ec91027f - Show all commits
+11 -1
View File
@@ -1,10 +1,20 @@
----iOS----
-quickstart for loading last edited report on main menu
-option/setting to put picture data into internal data dir for backup (always on for mobile)
-option/setting to put copy/duplicate picture data into internal data dir for backup (always on for mobile)
-duplicate existing report with new name
-cleanup empty uuid folders in case user gets an internal folder created but never saves
-always save report data (file locations, title, etc.) to internal dir (might already be done?)
-add dropdown to Add Items button to have add items from folder and remove choose working folder option (data always saved internally)
-update project title -> should update recently used data
-this sort of works, something is wrong with the upgrade process where the UUID is not brought over properly; need to test and fix (maybe fixed already and my dataset is wrong?)
-iOS-specific (MAUI essentials?)
-Take picture
-Add pic from gallery
-Add file (uses Files picking)
-Generate PDF -> Share/print screen to share/print
-----------
https://stackoverflow.com/questions/78855900/error-ios-projects-must-build-with-publishtrimmed-true-when-trimming-is-disabl
+27 -1
View File
@@ -188,11 +188,37 @@ class Settings : ChangeNotifier
LastSaved = lastSaved,
BaseFolder = data.Key,
};
// if UUID exists in BaseFolder/(Constants.ReportSavedDataFileName), use that UUID instead.
var existingReportDataPath = Path.Combine(reportInfo.BaseFolder, Constants.ReportSavedDataFileName);
if (File.Exists(existingReportDataPath))
{
var originalReportData = JsonSerializer.Deserialize(File.ReadAllText(existingReportDataPath), jsonContext.PDFReport);
if (originalReportData != null)
{
if (!string.IsNullOrWhiteSpace(originalReportData.UUID))
{
Directory.Move(Path.Combine(internalPath, uuid), Path.Combine(internalPath, originalReportData.UUID));
reportInfo.UUID = originalReportData.UUID;
}
else
{
// update UUID so they are in sync between internal and external folders
originalReportData.UUID = reportInfo.UUID;
using var memoryStream = new MemoryStream();
JsonSerializer.Serialize(memoryStream, report, jsonContext.PDFReport);
memoryStream.Position = 0;
using var reader = new StreamReader(memoryStream);
var updatedJson = reader.ReadToEnd();
File.WriteAllText(existingReportDataPath, updatedJson);
}
}
}
list.Add(reportInfo);
}
settings.AllReportInfo = list.OrderBy(x => x.Title).ToList();
settings.WorkingFolderToInternalFolderName = []; // clear this list; it is no longer used
settings.WorkingFolderToInternalFolderName = []; // clear this list; it is no longer going to be used
settings.SettingsVersion = 2;
settings.SaveSettingsNotAsync(); // saves all data; UUIDs should be in sync if user has toggled settings
}
return settings;
}