Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
feat: improve update notification UX with auto-open
itsfatduck24c1b658ae62
diff --git a/optimizerDuck/Services/UpdaterService.cs b/optimizerDuck/Services/UpdaterService.csindex 0c9e397..e165ee2 100644--- a/optimizerDuck/Services/UpdaterService.cs+++ b/optimizerDuck/Services/UpdaterService.cs@@ -13,6 +13,9 @@ public class UpdaterService{private const string Owner = "itsfatduck";private const string Repo = "optimizerDuck";++ public const string LatestReleaseUrl = $"https://github.com/{Owner}/{Repo}/releases/latest";+private readonly HttpClient _httpClient;private readonly ILogger _logger;diff --git a/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.csindex 5c70e73..b3da499 100644--- a/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs+++ b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs@@ -27,7 +27,28 @@ public partial class DashboardViewModel : ViewModelprivate bool _isInitialized;[ObservableProperty] private bool _isLoading;- [ObservableProperty] private bool _hasUpdate;+ private bool _isUpdateInfoOpen;+ private bool _updateNotified; // phân biệt close do user++ public bool IsUpdateInfoOpen+ {+ get => _isUpdateInfoOpen;+ set+ {+ if (_isUpdateInfoOpen == value)+ return;++ _isUpdateInfoOpen = value;+ OnPropertyChanged();++ // User vừa bấm ❌+ if (!_isUpdateInfoOpen && _updateNotified)+ {+ OpenLatestRelease();+ }+ }+ }+[ObservableProperty] private RamInfo _runtimeRam = RamInfo.Unknown;[ObservableProperty] private SystemSnapshot _systemInfo = SystemSnapshot.Unknown;@@ -60,7 +81,11 @@ public partial class DashboardViewModel : ViewModelif (!_isInitialized){_systemInfoService.LogSummary();- HasUpdate = await _updaterService.CheckForUpdatesAsync();+ if (await _updaterService.CheckForUpdatesAsync())+ {+ _updateNotified = true;+ IsUpdateInfoOpen = true;+ }_isInitialized = true;}@@ -218,6 +243,31 @@ public partial class DashboardViewModel : ViewModel_logger.LogWarning(ex, "Failed to update runtime info");}}++ private void OpenLatestRelease()+ {+ try+ {+ Process.Start(new ProcessStartInfo+ {+ FileName = UpdaterService.LatestReleaseUrl,+ UseShellExecute = true+ });+ }+ catch (Exception ex)+ {+ _snackbarService.Show(+ Translations.Snackbar_OpenLinkFailed_Title,+ Translations.Snackbar_OpenLinkFailed_Message,+ ControlAppearance.Danger,+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },+ TimeSpan.FromSeconds(5)+ );+ _logger.LogError(ex, "Failed to open latest release page");+ }+ }+#endregion+}\ No newline at end of filediff --git a/optimizerDuck/UI/Views/Pages/DashboardPage.xaml b/optimizerDuck/UI/Views/Pages/DashboardPage.xamlindex d980c7a..fb16f9e 100644--- a/optimizerDuck/UI/Views/Pages/DashboardPage.xaml+++ b/optimizerDuck/UI/Views/Pages/DashboardPage.xaml@@ -49,12 +49,11 @@<!-- Header --><StackPanel Margin="0,0,0,20"><ui:InfoBar- IsOpen="True"+ IsOpen="{Binding ViewModel.IsUpdateInfoOpen, Mode=TwoWay}"Margin="0,0,0,10"Message="A new version of optimizerDuck is available."Severity="Warning"- Title="Update Available"- Visibility="{Binding ViewModel.HasUpdate, Converter={StaticResource BoolToVisibilityConverter}}" />+ Title="Update Available" /><Grid ColumnDefinitions="*,Auto"><ui:TextBlockFontTypography="Title"diff --git a/optimizerDuck/UI/Views/Pages/DashboardPage.xaml.cs b/optimizerDuck/UI/Views/Pages/DashboardPage.xaml.csindex 01ad799..8c3b43a 100644--- a/optimizerDuck/UI/Views/Pages/DashboardPage.xaml.cs+++ b/optimizerDuck/UI/Views/Pages/DashboardPage.xaml.cs@@ -1,5 +1,7 @@+using optimizerDuck.UI.ViewModels.Pages;using Wpf.Ui.Abstractions.Controls;+using Wpf.Ui.Input;namespace optimizerDuck.UI.Views.Pages;diff --git a/optimizerDuck/optimizerDuck.csproj b/optimizerDuck/optimizerDuck.csprojindex 2d17707..574737b 100644--- a/optimizerDuck/optimizerDuck.csproj+++ b/optimizerDuck/optimizerDuck.csproj@@ -11,7 +11,7 @@<ApplicationIcon>Logo.ico</ApplicationIcon><Company>fatDuck</Company><FileVersion>2.0.0</FileVersion>- <Version>2.0.0</Version>+ <Version>1.0.0</Version><Product>optimizerDuck</Product><Copyright>Copyright fatDuck 2026</Copyright><AssemblyTitle>optimizerDuck</AssemblyTitle>