WIP: Add iOS version #10
@@ -14,8 +14,14 @@
|
|||||||
-output in internal dir (default)
|
-output in internal dir (default)
|
||||||
-always ask me every time (opens save file picker after generating PDF to ask user where they want it)
|
-always ask me every time (opens save file picker after generating PDF to ask user where they want it)
|
||||||
-always put in X folder (uses existing option)
|
-always put in X folder (uses existing option)
|
||||||
-add option to backup added files to internal data directory (always on for iOS)
|
~-add option to backup added files to internal data directory (always on for iOS)
|
||||||
-make backup of last generated PDF somewhere
|
*-add option
|
||||||
|
-add to settings view
|
||||||
|
-add logic to CreatePDFReportViewModel
|
||||||
|
-programmed in but not tested yet
|
||||||
|
-make backup of last generated PDF somewhere (another internal folder, most likely);
|
||||||
|
-save to PDF report data somewhere for safe-keeping
|
||||||
|
-allow loading by user
|
||||||
-iOS-specific (MAUI essentials?)
|
-iOS-specific (MAUI essentials?)
|
||||||
-maui community essentials https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/get-started?tabs=CommunityToolkitMaui
|
-maui community essentials https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/get-started?tabs=CommunityToolkitMaui
|
||||||
-I don't think this is what we are looking for ultimately....?
|
-I don't think this is what we are looking for ultimately....?
|
||||||
@@ -31,6 +37,8 @@
|
|||||||
-https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/data/share?view=net-maui-10.0&tabs=macios
|
-https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/data/share?view=net-maui-10.0&tabs=macios
|
||||||
-Make sure clipboard works (not sure if it will out of the box or not)
|
-Make sure clipboard works (not sure if it will out of the box or not)
|
||||||
-https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/data/clipboard?view=net-maui-10.0
|
-https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/data/clipboard?view=net-maui-10.0
|
||||||
|
-show report file size in recent list
|
||||||
|
-make sure setting for backup files is not available (always backs up files on iOS)
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class Settings : ChangeNotifier
|
|||||||
public string _reportDateFormat;
|
public string _reportDateFormat;
|
||||||
public int _settingsVersion;
|
public int _settingsVersion;
|
||||||
private PDFSaveLocation _pdfOutputSaveLocation;
|
private PDFSaveLocation _pdfOutputSaveLocation;
|
||||||
|
public bool _copyFilesToInternalDir;
|
||||||
|
|
||||||
public Settings() : base()
|
public Settings() : base()
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,10 @@ class Settings : ChangeNotifier
|
|||||||
_dataGridDateFormat = "dd/MM/yyyy";
|
_dataGridDateFormat = "dd/MM/yyyy";
|
||||||
_reportDateFormat = "yyyy-MM-dd";
|
_reportDateFormat = "yyyy-MM-dd";
|
||||||
_pdfOutputSaveLocation = PDFSaveLocation.BaseFolder;
|
_pdfOutputSaveLocation = PDFSaveLocation.BaseFolder;
|
||||||
|
_copyFilesToInternalDir = false;
|
||||||
|
#if IOS
|
||||||
|
_copyFilesToInternalDir = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings(Settings other)
|
public Settings(Settings other)
|
||||||
@@ -53,6 +58,7 @@ class Settings : ChangeNotifier
|
|||||||
_dataGridDateFormat = other.DataGridDateFormat;
|
_dataGridDateFormat = other.DataGridDateFormat;
|
||||||
_reportDateFormat = other.ReportDateFormat;
|
_reportDateFormat = other.ReportDateFormat;
|
||||||
_pdfOutputSaveLocation = other.PDFOutputSaveLocation;
|
_pdfOutputSaveLocation = other.PDFOutputSaveLocation;
|
||||||
|
_copyFilesToInternalDir = other.CopyFilesToInternalDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
@@ -133,6 +139,13 @@ class Settings : ChangeNotifier
|
|||||||
set { _reportDateFormat = value; NotifyPropertyChanged(); }
|
set { _reportDateFormat = value; NotifyPropertyChanged(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonInclude]
|
||||||
|
public bool CopyFilesToInternalDir
|
||||||
|
{
|
||||||
|
get => _copyFilesToInternalDir;
|
||||||
|
set { _copyFilesToInternalDir = value; NotifyPropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
public static string SettingsFileName = "settings.json";
|
public static string SettingsFileName = "settings.json";
|
||||||
|
|
||||||
public static string GetSettingsPath()
|
public static string GetSettingsPath()
|
||||||
|
|||||||
@@ -344,6 +344,24 @@ class CreatePDFReportViewModel : BaseViewModel, ICanCheckShutdown, ILogger
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var date = Utilities.CheckValidDateInString(filePath);
|
var date = Utilities.CheckValidDateInString(filePath);
|
||||||
|
if (_settings.CopyFilesToInternalDir)
|
||||||
|
{
|
||||||
|
// copy file to internal folder, then add report file based on that path
|
||||||
|
// make sure file names are not conflicting with one another, too.
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
var fileNameNoExt = Path.GetFileNameWithoutExtension(filePath);
|
||||||
|
var extension = Path.GetExtension(filePath);
|
||||||
|
var copyToPath = Path.Combine(_pdfReport.BaseFolder, fileName);
|
||||||
|
var rnd = new Random();
|
||||||
|
// TODO: test to make sure this works
|
||||||
|
while (File.Exists(copyToPath))
|
||||||
|
{
|
||||||
|
fileName = fileNameNoExt + rnd.Next(1, 999999) + "." + extension;
|
||||||
|
copyToPath = Path.Combine(_pdfReport.BaseFolder, fileName);
|
||||||
|
}
|
||||||
|
File.Copy(filePath, copyToPath);
|
||||||
|
filePath = copyToPath;
|
||||||
|
}
|
||||||
ReportFiles.Add(new ReportFile()
|
ReportFiles.Add(new ReportFile()
|
||||||
{
|
{
|
||||||
Title = Path.GetFileName(filePath),
|
Title = Path.GetFileName(filePath),
|
||||||
|
|||||||
Reference in New Issue
Block a user