-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flutter_local_notifications] Windows support #2349
Conversation
Also, I built off the work from Kenneth and lightrabbit, but I was wondering about a v2 of this plugin with pigeon or FFI. Since this version is already functional, let's try to get this out first, but just a thought for later. |
@MaikuB All done! I don't anticipate making any more API changes from here, maybe just some more comprehensive documentation in some spots. |
Thanks. Note I do want to prioritise a beta that includes changes like bumping the minimum Flutter version and potentially get rid of deprecated properties that are on Android side. When I can look at this one, it's possible I reach out here on how to test as well as I've not been involved in Windows development since UWP was first introduced |
Sounds reasonable, I'll do my best to keep this PR up to date with any potential merge conflicts.
I've updated the example to showcase all the new features version is capable of and hide unsupported examples when running on Windows, so if you have one, testing is as easy as Do you have an ETA on a review? No rush, because I'm using a pub override to my local copy, but I'm still thinking of possibly rewriting this as an FFI plugin (C++ logic would stay the same, but we'd drop all the serialization and method channel logic). However, I'm satisfied with how the plugin works now (adding FFI won't change the functionality), and it's about time I got back to the project that needed Windows notifications in the first place, so a rough timeline of when you want to go through this would be helpful. |
I mentioned I might reach as I think your original message mentioned some limitations that relate to MSIX (?)
If there's a plan to rewrite this to use FFI then I'd prefer to wait until that is done. Reason for this is because I maintain as a spare-time effort (e.g. check PRs on weekends) so would be better for me to avoid reviewing and test functionality twice |
I pinged you there, but for people following, I pushed #2366 for the FFI version. TL;DR, it's much cleaner, less Flutter magic, safer, and faster to write with automatically generated bindings. The (minor) downsides are needing a C-compatible API (no vectors or maps for data that really wants it), and notification callbacks needing Dart 3.1 or higher. |
Closing for now with the FFI implementation in #2366. I like the code there much better, but there's an important note there about Dart versions. |
Hi, I'm picking this up from @kennethnym and @lightrabbit. From their work, we already have basic initialization set up. I'm referring to https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=appsdk and https://learn.microsoft.com/en-us/uwp/schemas/tiles/toastschema/schema-root for the rest of my implementation.
@MaikuB, There's a small TODO below, but feel free to start reviewing!
TODO:
Check Windows version before playing audiogetActiveNotifications
on Windows MSIXpendingNotificationRequests
platformSpecifics
from method channelGET_NOTIFICATION_APP_LAUNCH_DETAILS
supportNote:
WindowsImage
requires a Windows-formatted URI of an absolute path. Instead of putting that on the user, I accept adart:io
File
object and do that internally. That marks the first use ofdart:io
inside this package, but:dart:io
does not crash a build anymore, but using it does.toXml()
is called, which is only called by the Windows plugin.If, in the future, this package supports web, people can still use
File
in theirWindowsNotificationsDetails
, and the app will compile, but the absolute path will not be looked up unless they're on Windows.