diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs index a29f8accfb0..22eb065f534 100644 --- a/Flow.Launcher.Infrastructure/Http/Http.cs +++ b/Flow.Launcher.Infrastructure/Http/Http.cs @@ -220,5 +220,18 @@ public static async Task SendAsync(HttpRequestMessage reque return new HttpResponseMessage(HttpStatusCode.InternalServerError); } } + + public static async Task GetStringAsync(string url, CancellationToken token = default) + { + try + { + Log.Debug(ClassName, $"Url <{url}>"); + return await client.GetStringAsync(url, token); + } + catch (System.Exception e) + { + return string.Empty; + } + } } } diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 892045994bd..0a6429e07d8 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -33,7 +33,6 @@ public void Save() _storage.Save(); } - private string _theme = Constant.DefaultTheme; public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public string ColorScheme { get; set; } = "System"; @@ -64,6 +63,7 @@ public string Language OnPropertyChanged(); } } + private string _theme = Constant.DefaultTheme; public string Theme { get => _theme; @@ -79,6 +79,7 @@ public string Theme } public bool UseDropShadowEffect { get; set; } = true; public BackdropTypes BackdropType{ get; set; } = BackdropTypes.None; + public string ReleaseNotesVersion { get; set; } = string.Empty; /* Appearance Settings. It should be separated from the setting later.*/ public double WindowHeightSize { get; set; } = 42; diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index cb60251ed95..76c7a4911bf 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -84,6 +84,15 @@ public interface IPublicAPI /// Optional message subtitle void ShowMsgError(string title, string subTitle = ""); + /// + /// Show the error message using Flow's standard error icon. + /// + /// Message title + /// Message button content + /// Message button action + /// Optional message subtitle + void ShowMsgErrorWithButton(string title, string buttonText, Action buttonAction, string subTitle = ""); + /// /// Show the MainWindow when hiding /// @@ -127,6 +136,27 @@ public interface IPublicAPI /// when true will use main windows as the owner void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true); + /// + /// Show message box with button + /// + /// Message title + /// Message button content + /// Message button action + /// Message subtitle + /// Message icon path (relative path to your plugin folder) + void ShowMsgWithButton(string title, string buttonText, Action buttonAction, string subTitle = "", string iconPath = ""); + + /// + /// Show message box with button + /// + /// Message title + /// Message button content + /// Message button action + /// Message subtitle + /// Message icon path (relative path to your plugin folder) + /// when true will use main windows as the owner + void ShowMsgWithButton(string title, string buttonText, Action buttonAction, string subTitle, string iconPath, bool useMainWindowAsOwner = true); + /// /// Open setting dialog /// diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index cedced181f2..59e8cac202c 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -171,6 +171,8 @@ await API.StopwatchLogInfoAsync(ClassName, "Startup cost", async () => Current.Resources["SettingWindowFont"] = new FontFamily(_settings.SettingWindowFont); Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(_settings.SettingWindowFont); + Notification.Install(); + Ioc.Default.GetRequiredService().PreStartCleanUpAfterPortabilityUpdate(); API.LogInfo(ClassName, "Begin Flow Launcher startup ----------------------------------------------------"); diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 8d43eff9870..d75d15a217e 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -90,6 +90,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index c9fc3689271..f22afb20775 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -365,6 +365,13 @@ Info Setting Window Font + + See more release notes on GitHub + Failed to fetch release notes + Please check your network connection or ensure GitHub is accessible + Flow Launcher has been updated to {0} + Click here to view the release notes + Select File Manager Learn more diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index a77d6471c7a..1e855d19491 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -121,6 +121,9 @@ private void OnLoaded(object sender, RoutedEventArgs _) // Set First Launch to false _settings.FirstLaunch = false; + // Update release notes version + _settings.ReleaseNotesVersion = Constant.Version; + // Set Backdrop Type to Acrylic for Windows 11 when First Launch. Default is None if (Win32Helper.IsBackdropSupported()) _settings.BackdropType = BackdropTypes.Acrylic; @@ -132,6 +135,25 @@ private void OnLoaded(object sender, RoutedEventArgs _) welcomeWindow.Show(); } + if (_settings.ReleaseNotesVersion != Constant.Version) + { + // Update release notes version + _settings.ReleaseNotesVersion = Constant.Version; + + // Display message box with button + App.API.ShowMsgWithButton( + string.Format(App.API.GetTranslation("appUpdateTitle"), Constant.Version), + App.API.GetTranslation("appUpdateButtonContent"), + () => + { + Application.Current.Dispatcher.Invoke(() => + { + var releaseNotesWindow = new ReleaseNotesWindow(); + releaseNotesWindow.Show(); + }); + }); + } + // Initialize place holder SetupPlaceholderText(); _viewModel.PlaceholderText = _settings.PlaceholderText; diff --git a/Flow.Launcher/Msg.xaml b/Flow.Launcher/Msg.xaml index 35dd92314b5..f1c25c4b93d 100644 --- a/Flow.Launcher/Msg.xaml +++ b/Flow.Launcher/Msg.xaml @@ -1,41 +1,76 @@ - + - + - - + + - + - - + + - Title - sdfdsf + + Title + + + sdfdsf + - + \ No newline at end of file diff --git a/Flow.Launcher/MsgWithButton.xaml b/Flow.Launcher/MsgWithButton.xaml new file mode 100644 index 00000000000..02b389c4931 --- /dev/null +++ b/Flow.Launcher/MsgWithButton.xaml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Title + + + sdfdsf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +