diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs index a29f8accf..22eb065f5 100644 --- a/Flow.Launcher.Infrastructure/Http/Http.cs +++ b/Flow.Launcher.Infrastructure/Http/Http.cs @@ -220,5 +220,18 @@ namespace Flow.Launcher.Infrastructure.Http 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 892045994..0a6429e07 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -33,7 +33,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings _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 @@ namespace Flow.Launcher.Infrastructure.UserSettings OnPropertyChanged(); } } + private string _theme = Constant.DefaultTheme; public string Theme { get => _theme; @@ -79,6 +79,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings } 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 cb60251ed..76c7a4911 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -84,6 +84,15 @@ namespace Flow.Launcher.Plugin /// 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 @@ namespace Flow.Launcher.Plugin /// 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 cedced181..59e8cac20 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -171,6 +171,8 @@ namespace Flow.Launcher 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 8d43eff98..d75d15a21 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 c9fc36892..f22afb207 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 a77d6471c..1e855d194 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -121,6 +121,9 @@ namespace Flow.Launcher // 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 @@ namespace Flow.Launcher 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 35dd92314..f1c25c4b9 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 000000000..02b389c49 --- /dev/null +++ b/Flow.Launcher/MsgWithButton.xaml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Title + + + sdfdsf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +