Show notification on first run after an update with a link to the changelog

Closes #487
pull/1001/head
Tyrrrz 2 years ago
parent e7d80688aa
commit 1e7b8ec83f

@ -15,9 +15,11 @@ public partial class App
public static string VersionString { get; } = Version.ToString(3); public static string VersionString { get; } = Version.ToString(3);
public static string GitHubProjectUrl { get; } = "https://github.com/Tyrrrz/DiscordChatExporter"; public static string ProjectUrl { get; } = "https://github.com/Tyrrrz/DiscordChatExporter";
public static string GitHubProjectDocsUrl { get; } = GitHubProjectUrl + "/blob/master/.docs"; public static string ChangelogUrl { get; } = ProjectUrl + "/blob/master/Changelog.md";
public static string DocumentationUrl { get; } = ProjectUrl + "/blob/master/.docs";
} }
public partial class App public partial class App

@ -1,4 +1,5 @@
using DiscordChatExporter.Core.Exporting; using System;
using DiscordChatExporter.Core.Exporting;
using Microsoft.Win32; using Microsoft.Win32;
using Tyrrrz.Settings; using Tyrrrz.Settings;
@ -20,6 +21,8 @@ public partial class SettingsService : SettingsManager
public bool ShouldReuseAssets { get; set; } public bool ShouldReuseAssets { get; set; }
public Version? LastAppVersion { get; set; }
public string? LastToken { get; set; } public string? LastToken { get; set; }
public ExportFormat LastExportFormat { get; set; } = ExportFormat.HtmlDark; public ExportFormat LastExportFormat { get; set; } = ExportFormat.HtmlDark;

@ -83,7 +83,7 @@ public class DashboardViewModel : PropertyChangedBase
await _dialogManager.ShowDialogAsync(dialog); await _dialogManager.ShowDialogAsync(dialog);
} }
public void ShowHelp() => ProcessEx.StartShellExecute(App.GitHubProjectDocsUrl); public void ShowHelp() => ProcessEx.StartShellExecute(App.DocumentationUrl);
public bool CanPopulateGuildsAndChannels => public bool CanPopulateGuildsAndChannels =>
!IsBusy && !string.IsNullOrWhiteSpace(Token); !IsBusy && !string.IsNullOrWhiteSpace(Token);

@ -106,6 +106,7 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, IDisposable
_settingsService.Load(); _settingsService.Load();
// Sync theme with settings
if (_settingsService.IsDarkModeEnabled) if (_settingsService.IsDarkModeEnabled)
{ {
App.SetDarkTheme(); App.SetDarkTheme();
@ -114,6 +115,18 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, IDisposable
{ {
App.SetLightTheme(); App.SetLightTheme();
} }
// App has just been updated, display changelog
if (_settingsService.LastAppVersion != App.Version)
{
Notifications.Enqueue(
$"Successfully updated to {App.Name} v{App.VersionString}",
"CHANGELOG", () => ProcessEx.StartShellExecute(App.ChangelogUrl)
);
_settingsService.LastAppVersion = App.Version;
_settingsService.Save();
}
} }
protected override void OnClose() protected override void OnClose()

Loading…
Cancel
Save