From 90625eacb568e67a465e0d3843b3e8b7299de16a Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 2 Jun 2023 10:02:38 -0700 Subject: [PATCH] revert win toast to 0.0.2 --- lib/notification_manager.dart | 24 ++++++++++++++++++++---- pubspec.lock | 4 ++-- pubspec.yaml | 6 +++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/lib/notification_manager.dart b/lib/notification_manager.dart index 34ffe402..95fe93ef 100644 --- a/lib/notification_manager.dart +++ b/lib/notification_manager.dart @@ -38,8 +38,10 @@ class WindowsNotificationManager implements NotificationsManager { WindowsNotificationManager(Future Function(String, int) notificationSelectConvo) { this.notificationSelectConvo = notificationSelectConvo; scheduleMicrotask(() async { - //initialized = await WinToast.instance().initialize(clsid: 'cwtch', displayName: 'Cwtch', aumId: 'Open Privacy Research Society', iconPath: ''); - // initialize toast with you aumId, displayName and iconPath + initialized = await WinToast.instance().initialize(appName: 'cwtch', productName: 'Cwtch', companyName: 'Open Privacy Research Society'); + /* + * WinToast 0.3.0 code for when we can compile it + * var init = await WinToast.instance().initialize( aumId: 'OpenPrivacyResearchSociety.Cwtch', displayName: 'Cwtch', @@ -56,7 +58,7 @@ class WindowsNotificationManager implements NotificationsManager { /* it failed, is ok, may have been 'close'? */ } } - }); + });*/ initialized = true; }); } @@ -65,6 +67,20 @@ class WindowsNotificationManager implements NotificationsManager { if (initialized && !globalAppState.focus) { if (!active) { active = true; + WinToast.instance().clear(); + final toast = await WinToast.instance().showToast( + type: ToastType.text01, title: message); + toast?.eventStream.listen((event) { + if (event is ActivatedEvent) { + WinToast.instance().bringWindowToFront(); + } + active = false; + }); + } + + /* + * WinToast 0.3.0 code for when we can compile it + * WinToast.instance().clear(); await WinToast.instance().showToast( toast: Toast( @@ -90,7 +106,7 @@ class WindowsNotificationManager implements NotificationsManager { ]), ])); active = false; - } + }*/ } } } diff --git a/pubspec.lock b/pubspec.lock index bec166ba..91de4add 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -924,10 +924,10 @@ packages: dependency: "direct main" description: name: win_toast - sha256: "371d62b17b30489cad41e831e6340c2777202d2b4b2fd55a14ffc566b3df7518" + sha256: "6349ef17a487d2ebf9caa51da1cb5a325f4cd7e5a601935ced456f3c00d1e64f" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.0.2" window_manager: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index e631836b..989ec65f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,7 +44,11 @@ dependencies: url_launcher: ^6.0.18 window_manager: ^0.3.2 # notification plugins - win_toast: ^0.3.0 + ## Somewhere between 0.0.2 and 0.3 they introduced a dependancy on a new Windows RT feature + ## Which can only be linked to with a new VC 17 compiler and we're suspicious only work on + ## Windows 2022 and newer... we can't seem to automate compiling on win server 2019 containers + ## So pinning to 0.0.2 for the forseeable future or until we change plugins + win_toast: ^0.0.2 flutter_local_notifications: ^14.0.0+2 dbus: ^0.7.8 connectivity_plus: