revert win toast to 0.0.2

This commit is contained in:
Dan Ballard 2023-06-02 10:02:38 -07:00 committed by Gitea
parent 81d62a06e3
commit 90625eacb5
3 changed files with 27 additions and 7 deletions

View File

@ -38,8 +38,10 @@ class WindowsNotificationManager implements NotificationsManager {
WindowsNotificationManager(Future<void> 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;
}
}*/
}
}
}

View File

@ -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:

View File

@ -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: