From 42ffbc404c78e4b48e86fd2744d3d8f5d95363e8 Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Sat, 27 Jan 2024 16:50:34 -0600 Subject: [PATCH] Update --- JournalApp.sln | 13 ------------- JournalApp/App.xaml.cs | 10 +++++++++- .../Components/Pages/ManageCategoriesPage.razor | 1 + JournalApp/Components/Pages/SettingsPage.razor | 5 ++++- JournalApp/Data/AppDataService.cs | 2 +- JournalApp/Data/AppDbContext.cs | 2 +- JournalApp/Data/AppDbSeeder.cs | 2 +- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/JournalApp.sln b/JournalApp.sln index 04f3fe0..18c9de2 100644 --- a/JournalApp.sln +++ b/JournalApp.sln @@ -4,19 +4,6 @@ VisualStudioVersion = 17.0.31611.283 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JournalApp", "JournalApp\JournalApp.csproj", "{DDDAF171-71A4-467A-BA11-9C4589CA0B3E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BC38128F-ED70-4D23-BA7C-E1E8DB5E5176}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitignore = .gitignore - .github\workflows\build-and-deploy.yml = .github\workflows\build-and-deploy.yml - Directory.Build.props = Directory.Build.props - global.json = global.json - LICENSE = LICENSE - PRIVACY_POLICY.md = PRIVACY_POLICY.md - README.md = README.md - version.json = version.json - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JournalApp.Tests", "JournalApp.Tests\JournalApp.Tests.csproj", "{3C1F4A08-B991-48DE-B7B6-014A7D427514}" EndProject Global diff --git a/JournalApp/App.xaml.cs b/JournalApp/App.xaml.cs index f5d3d36..12c93df 100644 --- a/JournalApp/App.xaml.cs +++ b/JournalApp/App.xaml.cs @@ -9,19 +9,27 @@ public App() MainPage = new MainPage(); } + public static event EventHandler NewIntent; + public static Window Window { get; private set; } public static string ActivatedFilePath { get; set; } public static (DateTimeOffset LeftAt, DateOnly LastDate)? IndexDateState { get; set; } - public static event EventHandler NewIntent; + public int LaunchCount + { + get => Preferences.Get("launches", 0); + set => Preferences.Set("launches", value); + } protected override Window CreateWindow(IActivationState activationState) { var window = base.CreateWindow(activationState); Window = window; + LaunchCount++; + return window; } diff --git a/JournalApp/Components/Pages/ManageCategoriesPage.razor b/JournalApp/Components/Pages/ManageCategoriesPage.razor index 028b740..b5d404d 100644 --- a/JournalApp/Components/Pages/ManageCategoriesPage.razor +++ b/JournalApp/Components/Pages/ManageCategoriesPage.razor @@ -70,6 +70,7 @@ async Task OnEnabledChanged(DataPointCategory c, bool newValue) { + logger.LogInformation($"Toggled category enabled <{c}, {newValue}>"); c.Enabled = newValue; await db.SaveChangesAsync(); } diff --git a/JournalApp/Components/Pages/SettingsPage.razor b/JournalApp/Components/Pages/SettingsPage.razor index d247b1f..6d068f5 100644 --- a/JournalApp/Components/Pages/SettingsPage.razor +++ b/JournalApp/Components/Pages/SettingsPage.razor @@ -53,7 +53,10 @@ else JournalApp @(ThisAssembly.AssemblyInformationalVersion) @($"{DeviceInfo.Current.Platform} {DeviceInfo.Current.VersionString}") - Send feedback... + Send feedback by email + Send feedback on GitHub + View on Play Store + View source code
diff --git a/JournalApp/Data/AppDataService.cs b/JournalApp/Data/AppDataService.cs index 929c85a..7079d1a 100644 --- a/JournalApp/Data/AppDataService.cs +++ b/JournalApp/Data/AppDataService.cs @@ -11,7 +11,7 @@ public async Task StartImportWizard(IDialogService dialogService, string p // Warn if an export wasn't done in the last week. if (DateTimeOffset.Now > LastExportDate.AddDays(7) && await dialogService.ShowCustomMessageBox(string.Empty, "It's recommended to export your data first", yesText: "Continue anyway", cancelText: "Go back") == null) { - logger.LogDebug("User didn't want to import and might export first"); + logger.LogDebug("User didn't want to import after being warned about export"); return false; } diff --git a/JournalApp/Data/AppDbContext.cs b/JournalApp/Data/AppDbContext.cs index 1537ca8..45f9fd2 100644 --- a/JournalApp/Data/AppDbContext.cs +++ b/JournalApp/Data/AppDbContext.cs @@ -83,7 +83,7 @@ public HashSet GetMissingPoints(Day day, DataPointCategory category, // Randomize values. if (random != null) { - point.CreatedAt = new DateTime(day.Date, TimeOnly.FromTimeSpan(TimeSpan.FromHours(random.Next(1, 24))), DateTimeKind.Local); + point.CreatedAt = new DateTime(day.Date, TimeOnly.FromTimeSpan(TimeSpan.FromMinutes(random.Next(1, 1440))), DateTimeKind.Local); point.Mood = DataPoint.Moods[random.Next(1, DataPoint.Moods.Count)]; point.SleepHours = random.Next(0, 49) / 2.0m; point.ScaleIndex = random.Next(0, 6); diff --git a/JournalApp/Data/AppDbSeeder.cs b/JournalApp/Data/AppDbSeeder.cs index 71cdb54..399be36 100644 --- a/JournalApp/Data/AppDbSeeder.cs +++ b/JournalApp/Data/AppDbSeeder.cs @@ -11,7 +11,7 @@ public void SeedDb() try { #if DEBUG && false - // This is so dangerous that it's kept in a block instead of me adding it and removing it as needed. + // This is so dangerous that it's kept in a block instead of being added and removed as needed. db.Database.EnsureDeleted(); #endif db.Database.Migrate();