11using Flow . Launcher . Infrastructure ;
2+ using Microsoft . Toolkit . Uwp . Notifications ;
23using System ;
34using System . IO ;
45using Windows . Data . Xml . Dom ;
@@ -8,10 +9,17 @@ namespace Flow.Launcher
89{
910 internal static class Notification
1011 {
12+ internal static bool legacy = Environment . OSVersion . Version . Build < 19041 ;
13+ [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Interoperability" , "CA1416:Validate platform compatibility" , Justification = "<Pending>" ) ]
14+ internal static void Uninstall ( )
15+ {
16+ if ( ! legacy )
17+ ToastNotificationManagerCompat . Uninstall ( ) ;
18+ }
19+
1120 [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Interoperability" , "CA1416:Validate platform compatibility" , Justification = "<Pending>" ) ]
1221 public static void Show ( string title , string subTitle , string iconPath )
1322 {
14- var legacy = Environment . OSVersion . Version . Build < 19041 ;
1523 // Handle notification for win7/8/early win10
1624 if ( legacy )
1725 {
@@ -24,13 +32,11 @@ public static void Show(string title, string subTitle, string iconPath)
2432 ? Path . Combine ( Constant . ProgramDirectory , "Images\\ app.png" )
2533 : iconPath ;
2634
27- var xml = $ "<?xml version=\" 1.0\" ?><toast><visual><binding template=\" ToastImageAndText04\" ><image id=\" 1\" src=\" { Icon } \" alt=\" meziantou\" /><text id=\" 1\" >{ title } </text>" +
28- $ "<text id=\" 2\" >{ subTitle } </text></binding></visual></toast>";
29- var toastXml = new XmlDocument ( ) ;
30- toastXml . LoadXml ( xml ) ;
31- var toast = new ToastNotification ( toastXml ) ;
32- ToastNotificationManager . CreateToastNotifier ( "Flow Launcher" ) . Show ( toast ) ;
33-
35+ new ToastContentBuilder ( )
36+ . AddText ( title , hintMaxLines : 1 )
37+ . AddText ( subTitle )
38+ . AddAppLogoOverride ( new Uri ( Icon ) )
39+ . Show ( ) ;
3440 }
3541
3642 private static void LegacyShow ( string title , string subTitle , string iconPath )
0 commit comments