From e0ac8387ff902f637e0a8aa3d86d8f31df2566cf Mon Sep 17 00:00:00 2001 From: Marcos Date: Sat, 2 Sep 2023 21:19:52 -0300 Subject: [PATCH 1/4] Added some convenience tools and goodies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added an About msg box to identify current installed version. • Added an option to check for updates (w/ option to open releases url). • Added option to run on windows startup. • Added option to close to tray (adds to the existing minimize to tray). • Added option to start minimized. • Added main window auto-save position and state between sessions. • Added settings persistence. --- .../Skiff Desktop/MainWindow.xaml.cs | 109 ++++++++++- .../Skiff Desktop/PreferencesController.cs | 76 ++++++++ .../Skiff Desktop/Skiff Desktop.csproj | 4 +- .../Skiff Desktop/TrayController.cs | 183 +++++++++++++++--- 4 files changed, 341 insertions(+), 31 deletions(-) create mode 100644 skiffWindowsApp/Skiff Desktop/PreferencesController.cs diff --git a/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs b/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs index 68a1d71..0de7ff0 100644 --- a/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs +++ b/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs @@ -8,6 +8,7 @@ using ToastNotifications.Position; using ToastNotifications.Core; using CustomNotificationsExample.CustomMessage; +using System.Net.Http; namespace Skiff_Desktop { @@ -16,15 +17,17 @@ namespace Skiff_Desktop /// public partial class MainWindow : Window { - // Counter and action not yet updated. We need messaging from server or webview. - // Use placeholder tray menu items to demo this. - public int UnreadCount { get; private set; } public Action UnreadCounterChanged; + public int UnreadCount { get; private set; } + public HttpClient HttpClient { get; private set; } private string baseURL = "https://app.skiff.com/"; private Notifier _notifier; private TrayController _trayController; private MessageProcessor _messageProcessor; + private PreferencesController _preferencesController; + + private WindowState _prevState; public MainWindow() @@ -46,8 +49,67 @@ public MainWindow() cfg.DisplayOptions.TopMost = true; }); - _trayController = new TrayController(this); + HttpClient = new HttpClient(); + _preferencesController = new PreferencesController(this); + _trayController = new TrayController(this, _preferencesController); _messageProcessor = new MessageProcessor(this); + + StateChanged += OnWindowStateChanged; + SizeChanged += OnWindowSizeChanged; + RestoreWindow(); + ApplyWindowPreferences(); + } + + internal void RestoreWindow() + { + var windowData = _preferencesController.WindowData; + if (windowData != null) + { + Top = windowData.Top; + Left = windowData.Left; + Width = windowData.Width; + Height = windowData.Height; + WindowState = windowData.Maximized ? WindowState.Maximized : WindowState.Normal; + } + else + { + WindowState = WindowState.Maximized; + } + } + + private void ApplyWindowPreferences() + { + if (_preferencesController.StartMinimized) + { + WindowState = WindowState.Minimized; + if (_preferencesController.MinimizeToTray) + Hide(); + } + } + + private void SaveWindowData() + { + var windowData = new WindowData() + { + Top = Top, + Left = Left, + Width = Width, + Height = Height, + Maximized = WindowState == WindowState.Maximized + }; + _preferencesController.SetWindowPosAndState(windowData); + } + + private void OnWindowStateChanged(object? sender, EventArgs e) + { + if (WindowState != WindowState.Minimized) + SaveWindowData(); + } + + private void OnWindowSizeChanged(object sender, SizeChangedEventArgs e) + { + if (WindowState != WindowState.Minimized) + SaveWindowData(); } internal void ShowToastNotification(string title, string message) @@ -58,6 +120,9 @@ internal void ShowToastNotification(string title, string message) protected override void OnClosed(EventArgs e) { + if (WindowState != WindowState.Minimized) + SaveWindowData(); + _notifier.Dispose(); base.OnClosed(e); } @@ -113,7 +178,8 @@ private void CoreWebView2_NewWindowRequested(object? sender, CoreWebView2NewWind } } } - private void OpenInDefaultBrowser(string uri) + + internal void OpenInDefaultBrowser(string uri) { try { @@ -145,4 +211,37 @@ internal void UpdateUnreadCount(int newTotal) UnreadCounterChanged?.Invoke(); } } + + [Serializable] + class WindowData + { + public double Top { get; set; } + public double Left { get; set; } + public double Width { get; set; } + public double Height { get; set; } + public bool Maximized { get; set; } + + public override string ToString() + { + return $"{Top} {Left} {Width} {Height} {Maximized}"; + } + + public static WindowData Parse(string strData) + { + if (string.IsNullOrEmpty(strData)) + return null; + + string[] values = strData.Split(' '); + WindowData windowData = new() + { + Top = double.Parse(values[0]), + Left = double.Parse(values[1]), + Width = double.Parse(values[2]), + Height = double.Parse(values[3]), + Maximized = bool.Parse(values[4]) + }; + + return windowData; + } + } } diff --git a/skiffWindowsApp/Skiff Desktop/PreferencesController.cs b/skiffWindowsApp/Skiff Desktop/PreferencesController.cs new file mode 100644 index 0000000..ef54d92 --- /dev/null +++ b/skiffWindowsApp/Skiff Desktop/PreferencesController.cs @@ -0,0 +1,76 @@ +using Microsoft.Win32; +using System.Reflection; +using System.Windows.Forms; + +namespace Skiff_Desktop +{ + internal class PreferencesController + { + public bool LaunchOnStartup { get; private set; } + public bool StartMinimized { get; private set; } + public bool MinimizeToTray { get; private set; } + public bool CloseToTray { get; private set; } + public WindowData WindowData { get; private set; } + + public string Version { get; private set; } + + private MainWindow _mainWindow; + + private RegistryKey _startupKey; + private RegistryKey _settingsPersistenceKey; + private const string Minimize_To_Tray_Name = "MinimizeToTray"; + private const string Close_To_Tray_Name = "CloseToTray"; + private const string Start_Minimized_Name = "StartMinimized"; + private const string Window_Pos_And_State_Name = "WindowsPosAndState"; + + + public PreferencesController(MainWindow mainWindow) + { + _mainWindow = mainWindow; + + _startupKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); + LaunchOnStartup = _startupKey.GetValue(Application.ProductName) != null; + + _settingsPersistenceKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\{Application.CompanyName}"); + MinimizeToTray = bool.Parse(_settingsPersistenceKey.GetValue(Minimize_To_Tray_Name) as string ?? bool.FalseString); + CloseToTray = bool.Parse(_settingsPersistenceKey.GetValue(Close_To_Tray_Name) as string ?? bool.FalseString); + StartMinimized = bool.Parse(_settingsPersistenceKey.GetValue(Start_Minimized_Name) as string ?? bool.FalseString); + WindowData = WindowData.Parse(_settingsPersistenceKey.GetValue(Window_Pos_And_State_Name) as string); + + Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + + public void SetLaunchOnStartup(bool enable) + { + if (enable) + _startupKey.DeleteValue(Application.ProductName, false); + else + _startupKey.SetValue(Application.ProductName, Application.ExecutablePath); + + LaunchOnStartup = enable; + } + + public void SetStartMinimized(bool enable) + { + _settingsPersistenceKey.SetValue(Start_Minimized_Name, enable); + StartMinimized = enable; + } + + public void SetMinimizeToTray(bool enable) + { + _settingsPersistenceKey.SetValue(Minimize_To_Tray_Name, enable); + MinimizeToTray = enable; + } + + public void SetCloseToTray(bool enable) + { + _settingsPersistenceKey.SetValue(Close_To_Tray_Name, enable); + CloseToTray = enable; + } + + public void SetWindowPosAndState(WindowData windowData) + { + _settingsPersistenceKey.SetValue(Window_Pos_And_State_Name, windowData.ToString()); + } + } +} diff --git a/skiffWindowsApp/Skiff Desktop/Skiff Desktop.csproj b/skiffWindowsApp/Skiff Desktop/Skiff Desktop.csproj index 72cf2db..53d51cb 100644 --- a/skiffWindowsApp/Skiff Desktop/Skiff Desktop.csproj +++ b/skiffWindowsApp/Skiff Desktop/Skiff Desktop.csproj @@ -8,8 +8,8 @@ enable true true - 1.0.0.3 - 1.0.0.3 + 1.0.0.5 + 1.0.0.5 diff --git a/skiffWindowsApp/Skiff Desktop/TrayController.cs b/skiffWindowsApp/Skiff Desktop/TrayController.cs index 05a7468..c77cd18 100644 --- a/skiffWindowsApp/Skiff Desktop/TrayController.cs +++ b/skiffWindowsApp/Skiff Desktop/TrayController.cs @@ -1,5 +1,11 @@ using System; +using System.Collections.Generic; +using System.ComponentModel; using System.Drawing; +using System.Linq; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Text.Json.Serialization; using System.Windows; using System.Windows.Forms; @@ -8,18 +14,26 @@ namespace Skiff_Desktop internal class TrayController { private NotifyIcon _trayIcon; - private ToolStripMenuItem _traySettingMenuItem; private Icon _iconNormal; private Icon _iconUnreadDot; - private MainWindow _mainWindow; + private ToolStripMenuItem _minimizeToTrayPreferenceMenuItem; + private ToolStripMenuItem _closeToTrayPreferenceMenuItem; + private ToolStripMenuItem _startupPreferenceMenuItem; + private ToolStripMenuItem _startMinimizedPreferenceMenuItem; + private ToolStripMenuItem _preferencesMenuItem; + private bool _closeFromTrayMenu; + private MainWindow _mainWindow; + private PreferencesController _preferencesController; - public TrayController(MainWindow mainWindow) + public TrayController(MainWindow mainWindow, PreferencesController preferencesController) { _mainWindow = mainWindow; _mainWindow.StateChanged += OnWindowStateChanged; _mainWindow.UnreadCounterChanged += UpdateTrayInfo; - _mainWindow.Closed += OnWindowClosed; + _mainWindow.Closing += OnWindowClosing; + + _preferencesController = preferencesController; InitIconsBitmaps(); InitTrayIcon(); @@ -46,8 +60,23 @@ private void InitIconsBitmaps() private void InitTrayIcon() { - _traySettingMenuItem = new ToolStripMenuItem("Minimize To Tray", null, OnMinimizeSettingChange); - _traySettingMenuItem.Checked = true; + _minimizeToTrayPreferenceMenuItem = new ToolStripMenuItem("Minimize To Tray", null, OnMinimizePreferenceChange); + _minimizeToTrayPreferenceMenuItem.Checked = _preferencesController.MinimizeToTray; + + _closeToTrayPreferenceMenuItem = new ToolStripMenuItem("Close To Tray", null, OnClosePreferenceChange); + _closeToTrayPreferenceMenuItem.Checked = _preferencesController.CloseToTray; + + _startupPreferenceMenuItem = new ToolStripMenuItem("Launch on Startup", null, OnLaunchOnStartupPreferenceChange); + _startupPreferenceMenuItem.Checked = _preferencesController.LaunchOnStartup; + + _startMinimizedPreferenceMenuItem = new ToolStripMenuItem("Start Minimized", null, OnStartMinimizedPreferenceChange); + _startMinimizedPreferenceMenuItem.Checked = _preferencesController.StartMinimized; + + _preferencesMenuItem = new ToolStripMenuItem("Preferences"); + _preferencesMenuItem.DropDownItems.Add(_minimizeToTrayPreferenceMenuItem); + _preferencesMenuItem.DropDownItems.Add(_closeToTrayPreferenceMenuItem); + _preferencesMenuItem.DropDownItems.Add(_startupPreferenceMenuItem); + _preferencesMenuItem.DropDownItems.Add(_startMinimizedPreferenceMenuItem); _trayIcon = new NotifyIcon() { @@ -56,15 +85,103 @@ private void InitTrayIcon() { Items = { - new ToolStripMenuItem("Show", null, OnOpenFromTray), - _traySettingMenuItem, + new ToolStripMenuItem("Show", null, OpenFromTray), + _preferencesMenuItem, + new ToolStripMenuItem("Check for Updates", null, CheckForUpdates), + new ToolStripMenuItem("About", null, About), new ToolStripSeparator(), - new ToolStripMenuItem("Quit", null, OnCloseFromTray) + new ToolStripMenuItem("Quit", null, CloseFromTray) } }, Visible = true, }; - _trayIcon.DoubleClick += OnOpenFromTray; + _trayIcon.DoubleClick += OpenFromTray; + } + + private void OnLaunchOnStartupPreferenceChange(object? sender, EventArgs e) + { + _preferencesController.SetLaunchOnStartup(_startupPreferenceMenuItem.Checked); + _startupPreferenceMenuItem.Checked = !_startupPreferenceMenuItem.Checked; + } + + private void OnStartMinimizedPreferenceChange(object? sender, EventArgs e) + { + _startMinimizedPreferenceMenuItem.Checked = !_startMinimizedPreferenceMenuItem.Checked; + _preferencesController.SetStartMinimized(_startMinimizedPreferenceMenuItem.Checked); + } + + [Serializable] + public class UpdateData + { + [JsonPropertyName("tag_name")] + public string Tag { get; set; } + [JsonPropertyName("html_url")] + public string Url { get; set; } + [JsonPropertyName("published_at")] + public DateTime ReleaseDate { get; set; } + + public string Version { get { return Tag.Replace("skiff-windows-", ""); } } + } + + private async void CheckForUpdates(object? sender, EventArgs e) + { + _mainWindow.HttpClient.Timeout = TimeSpan.FromSeconds(5); + _mainWindow.HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Skiff-Mail", "1.0")); + + var url = "https://api.github.com/repos/skiff-org/skiff-windows-app/releases"; + var response = await _mainWindow.HttpClient.GetAsync(url); + if (response.IsSuccessStatusCode) + { + var content = response.Content.ReadAsStringAsync().Result; + var updateData = JsonSerializer.Deserialize>(content); + + // Sort releases by date and retrieve latest. + updateData.Sort((a, b) => b.ReleaseDate.CompareTo(a.ReleaseDate)); + var latestRelease = updateData.FirstOrDefault(); + + bool updateAvailable = latestRelease.Version != _preferencesController.Version; + string msgBoxContent = $"Current version {_preferencesController.Version} is up to date."; + MessageBoxButton msgBoxButtons = MessageBoxButton.OK; + + if (updateAvailable) + { + msgBoxContent = + $"Current version {_preferencesController.Version} is outdated. \n" + + $"\n" + + $"Version {latestRelease.Version} is available. \n" + + $"Do you want to open the download page?"; + + msgBoxButtons = MessageBoxButton.YesNo; + } + + var result = System.Windows.MessageBox.Show( + msgBoxContent, + "About Skiff Mail Windows App", + msgBoxButtons, + MessageBoxImage.None); + + if (result == MessageBoxResult.Yes) + { + _mainWindow.OpenInDefaultBrowser(latestRelease.Url); + } + } + } + + private void About(object? sender, EventArgs e) + { + string content = + $"Skiff Mail Windows App \n" + + $"Version {_preferencesController.Version} \n" + + $"\n" + + $"Contact Skiff team: \n" + + $"https://skiff.com/mail \n" + + $"support@skiff.org"; + + System.Windows.MessageBox.Show( + content, + "About", + MessageBoxButton.OK, + MessageBoxImage.None); } private void UpdateTrayInfo() @@ -72,49 +189,67 @@ private void UpdateTrayInfo() if (_mainWindow.UnreadCount > 0) { _trayIcon.Icon = _iconUnreadDot; - _trayIcon.Text = $"Skiff Desktop ({_mainWindow.UnreadCount} Unread Emails)"; + _trayIcon.Text = $"Skiff Mail ({_mainWindow.UnreadCount} Unread)"; } else { _trayIcon.Icon = _iconNormal; - _trayIcon.Text = "Skiff Desktop"; + _trayIcon.Text = "Skiff Mail"; } } - private void OnMinimizeSettingChange(object? sender, EventArgs e) + private void OnMinimizePreferenceChange(object? sender, EventArgs e) { - _traySettingMenuItem.Checked = !_traySettingMenuItem.Checked; + _minimizeToTrayPreferenceMenuItem.Checked = !_minimizeToTrayPreferenceMenuItem.Checked; + _preferencesController.SetMinimizeToTray(_minimizeToTrayPreferenceMenuItem.Checked); } - private void OnOpenFromTray(object? sender, EventArgs e) + private void OnClosePreferenceChange(object? sender, EventArgs e) + { + _closeToTrayPreferenceMenuItem.Checked = !_closeToTrayPreferenceMenuItem.Checked; + _preferencesController.SetCloseToTray(_closeToTrayPreferenceMenuItem.Checked); + } + + private void OpenFromTray(object? sender, EventArgs e) { if (_mainWindow.WindowState == WindowState.Minimized) { _mainWindow.Show(); - _mainWindow.WindowState = WindowState.Normal; + _mainWindow.RestoreWindow(); _mainWindow.Activate(); } } private void OnWindowStateChanged(object? sender, EventArgs e) { - if (_mainWindow.WindowState == WindowState.Minimized && _traySettingMenuItem.Checked) + if (_mainWindow.WindowState == WindowState.Minimized && _minimizeToTrayPreferenceMenuItem.Checked) { _mainWindow.Hide(); } } - private void OnWindowClosed(object? sender, EventArgs e) + private void OnWindowClosing(object? sender, CancelEventArgs e) { - _trayIcon.Visible = false; - _trayIcon.Dispose(); + if (_closeToTrayPreferenceMenuItem.Checked && !_closeFromTrayMenu) + { + e.Cancel = true; + _mainWindow.WindowState = WindowState.Minimized; + _mainWindow.Hide(); + } + else + { + _mainWindow.StateChanged -= OnWindowStateChanged; + _mainWindow.UnreadCounterChanged -= UpdateTrayInfo; + _mainWindow.Closing -= OnWindowClosing; + + _trayIcon.Visible = false; + _trayIcon.Dispose(); + } } - private void OnCloseFromTray(object? sender, EventArgs e) + private void CloseFromTray(object? sender, EventArgs e) { - _trayIcon.Visible = false; - _trayIcon.Dispose(); - + _closeFromTrayMenu = true; _mainWindow.Close(); } } From 124f9232325d021989c4a4e3fe622fa179e6bc09 Mon Sep 17 00:00:00 2001 From: Marcos Date: Sat, 2 Sep 2023 22:25:17 -0300 Subject: [PATCH 2/4] Fix for http client params --- skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs | 3 +++ skiffWindowsApp/Skiff Desktop/TrayController.cs | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs b/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs index 0de7ff0..9fe9a96 100644 --- a/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs +++ b/skiffWindowsApp/Skiff Desktop/MainWindow.xaml.cs @@ -9,6 +9,7 @@ using ToastNotifications.Core; using CustomNotificationsExample.CustomMessage; using System.Net.Http; +using System.Net.Http.Headers; namespace Skiff_Desktop { @@ -50,6 +51,8 @@ public MainWindow() }); HttpClient = new HttpClient(); + HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Skiff-Mail", "1.0")); + _preferencesController = new PreferencesController(this); _trayController = new TrayController(this, _preferencesController); _messageProcessor = new MessageProcessor(this); diff --git a/skiffWindowsApp/Skiff Desktop/TrayController.cs b/skiffWindowsApp/Skiff Desktop/TrayController.cs index c77cd18..aac13f9 100644 --- a/skiffWindowsApp/Skiff Desktop/TrayController.cs +++ b/skiffWindowsApp/Skiff Desktop/TrayController.cs @@ -6,6 +6,7 @@ using System.Net.Http.Headers; using System.Text.Json; using System.Text.Json.Serialization; +using System.Threading; using System.Windows; using System.Windows.Forms; @@ -124,12 +125,10 @@ public class UpdateData } private async void CheckForUpdates(object? sender, EventArgs e) - { - _mainWindow.HttpClient.Timeout = TimeSpan.FromSeconds(5); - _mainWindow.HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Skiff-Mail", "1.0")); - + { + var timeoutSource = new CancellationTokenSource(5000); var url = "https://api.github.com/repos/skiff-org/skiff-windows-app/releases"; - var response = await _mainWindow.HttpClient.GetAsync(url); + var response = await _mainWindow.HttpClient.GetAsync(url, timeoutSource.Token); if (response.IsSuccessStatusCode) { var content = response.Content.ReadAsStringAsync().Result; From 3f015e469f341e96f65db8c13906094b996067c8 Mon Sep 17 00:00:00 2001 From: Marcos Date: Sat, 2 Sep 2023 22:37:25 -0300 Subject: [PATCH 3/4] Fix for version check Now we cast the version from the gihub API into System.Version for comparison with Assembly.Version. --- skiffWindowsApp/Skiff Desktop/PreferencesController.cs | 5 +++-- skiffWindowsApp/Skiff Desktop/TrayController.cs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/skiffWindowsApp/Skiff Desktop/PreferencesController.cs b/skiffWindowsApp/Skiff Desktop/PreferencesController.cs index ef54d92..d5fcff4 100644 --- a/skiffWindowsApp/Skiff Desktop/PreferencesController.cs +++ b/skiffWindowsApp/Skiff Desktop/PreferencesController.cs @@ -1,4 +1,5 @@ using Microsoft.Win32; +using System; using System.Reflection; using System.Windows.Forms; @@ -12,7 +13,7 @@ internal class PreferencesController public bool CloseToTray { get; private set; } public WindowData WindowData { get; private set; } - public string Version { get; private set; } + public Version Version { get; private set; } private MainWindow _mainWindow; @@ -37,7 +38,7 @@ public PreferencesController(MainWindow mainWindow) StartMinimized = bool.Parse(_settingsPersistenceKey.GetValue(Start_Minimized_Name) as string ?? bool.FalseString); WindowData = WindowData.Parse(_settingsPersistenceKey.GetValue(Window_Pos_And_State_Name) as string); - Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + Version = Assembly.GetExecutingAssembly().GetName().Version; } public void SetLaunchOnStartup(bool enable) diff --git a/skiffWindowsApp/Skiff Desktop/TrayController.cs b/skiffWindowsApp/Skiff Desktop/TrayController.cs index aac13f9..4c8107b 100644 --- a/skiffWindowsApp/Skiff Desktop/TrayController.cs +++ b/skiffWindowsApp/Skiff Desktop/TrayController.cs @@ -121,7 +121,7 @@ public class UpdateData [JsonPropertyName("published_at")] public DateTime ReleaseDate { get; set; } - public string Version { get { return Tag.Replace("skiff-windows-", ""); } } + public Version Version { get { return Version.Parse(Tag.Replace("skiff-windows-", "")); } } } private async void CheckForUpdates(object? sender, EventArgs e) @@ -132,13 +132,13 @@ private async void CheckForUpdates(object? sender, EventArgs e) if (response.IsSuccessStatusCode) { var content = response.Content.ReadAsStringAsync().Result; - var updateData = JsonSerializer.Deserialize>(content); + var updateData = JsonSerializer.Deserialize>(content); // Sort releases by date and retrieve latest. updateData.Sort((a, b) => b.ReleaseDate.CompareTo(a.ReleaseDate)); var latestRelease = updateData.FirstOrDefault(); - bool updateAvailable = latestRelease.Version != _preferencesController.Version; + bool updateAvailable = latestRelease.Version > _preferencesController.Version; string msgBoxContent = $"Current version {_preferencesController.Version} is up to date."; MessageBoxButton msgBoxButtons = MessageBoxButton.OK; From 15fa51f998ba544d28d934931bfde5455424ab9c Mon Sep 17 00:00:00 2001 From: Marcos Date: Sat, 2 Sep 2023 22:53:59 -0300 Subject: [PATCH 4/4] Removed dirty parsing from version string --- skiffWindowsApp/Skiff Desktop/TrayController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skiffWindowsApp/Skiff Desktop/TrayController.cs b/skiffWindowsApp/Skiff Desktop/TrayController.cs index 4c8107b..5f11af7 100644 --- a/skiffWindowsApp/Skiff Desktop/TrayController.cs +++ b/skiffWindowsApp/Skiff Desktop/TrayController.cs @@ -121,7 +121,7 @@ public class UpdateData [JsonPropertyName("published_at")] public DateTime ReleaseDate { get; set; } - public Version Version { get { return Version.Parse(Tag.Replace("skiff-windows-", "")); } } + public Version Version { get { return Version.Parse(Tag); } } } private async void CheckForUpdates(object? sender, EventArgs e)