diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 9dad6925d..78ae8476b 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -22,6 +22,7 @@ Google Customise UWP uwp +Uwp Bokmal Bokm uninstallation @@ -89,3 +90,8 @@ Noresult wpftk mkv flac +IPublic +keyevent +KListener +requery +vkcode diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt index 2f4ff418d..903714aef 100644 --- a/.github/actions/spelling/patterns.txt +++ b/.github/actions/spelling/patterns.txt @@ -115,3 +115,6 @@ #http/https (?:\b(?:https?|ftp|file)://)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|] + +# UWP +[Uu][Ww][Pp] diff --git a/Flow.Launcher/Notification.cs b/Flow.Launcher/Notification.cs index 57c1e88f2..64db5c213 100644 --- a/Flow.Launcher/Notification.cs +++ b/Flow.Launcher/Notification.cs @@ -1,7 +1,9 @@ using Flow.Launcher.Infrastructure; +using Flow.Launcher.Infrastructure.Logger; using Microsoft.Toolkit.Uwp.Notifications; using System; using System.IO; +using System.Windows; using Windows.Data.Xml.Dom; using Windows.UI.Notifications; @@ -17,8 +19,16 @@ namespace Flow.Launcher ToastNotificationManagerCompat.Uninstall(); } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")] public static void Show(string title, string subTitle, string iconPath = null) + { + Application.Current.Dispatcher.Invoke(() => + { + ShowInternal(title, subTitle, iconPath); + }); + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")] + private static void ShowInternal(string title, string subTitle, string iconPath = null) { // Handle notification for win7/8/early win10 if (legacy) @@ -32,11 +42,33 @@ namespace Flow.Launcher ? Path.Combine(Constant.ProgramDirectory, "Images\\app.png") : iconPath; - new ToastContentBuilder() - .AddText(title, hintMaxLines: 1) - .AddText(subTitle) - .AddAppLogoOverride(new Uri(Icon)) - .Show(); + try + { + new ToastContentBuilder() + .AddText(title, hintMaxLines: 1) + .AddText(subTitle) + .AddAppLogoOverride(new Uri(Icon)) + .Show(); + } + catch (InvalidOperationException e) + { + // Temporary fix for the Windows 11 notification issue + // Possibly from 22621.1413 or 22621.1485, judging by post time of #2024 + Log.Exception("Flow.Launcher.Notification|Notification InvalidOperationException Error", e); + if (Environment.OSVersion.Version.Build >= 22621) + { + return; + } + else + { + throw; + } + } + catch (Exception e) + { + Log.Exception("Flow.Launcher.Notification|Notification Error", e); + throw; + } } private static void LegacyShow(string title, string subTitle, string iconPath) diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index ec997f537..e5b3e1f61 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -68,6 +68,7 @@ namespace Flow.Launcher UpdateManager.RestartApp(Constant.ApplicationFileName); } + [Obsolete("Typo")] public void RestarApp() => RestartApp(); public void ShowMainWindow() => _mainVM.Show(); @@ -92,10 +93,7 @@ namespace Flow.Launcher public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true) { - Application.Current.Dispatcher.Invoke(() => - { - Notification.Show(title, subTitle, iconPath); - }); + Notification.Show(title, subTitle, iconPath); } public void OpenSettingDialog()