-
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
Desktop support (Linux, Windows) #746
Comments
As the plugin implements a federated plugin structure, the ability to add support for other platforms is open to the community to do so. It sounds like you're interested in leveraging that work, if so then I would suggest you contribute back by adding support for the other platforms. |
Yes, I'll try to help you as soon as I get free time. |
Note that I'm not familiar with either Win32 or Linux. As far as I know, they require using C++, which I'm not particularly familiar with so I'm not well-positioned to implement this myself, though I could probably scrap bits of knowledge here and there to review code if needed |
In general, any language that supports FFI can be used. But C++ is probably the easiest option. |
Although it might be worth using Dart + FFI (but it still beta). |
Hi! Our team want to help with this issue (windows part of it). Is there any new information about this feature? |
If you want to help then the best way is to submit a PR. There's a draft one for Linux support #888 that you help the author with, help test out etc |
We have some decision for windows notifications. It uses a process_run plugin and powershell commands. It works perfectly in debug, but in realise version of the app there are some problems. If you interesting you can find our variant here. |
For linux i found a lib using gnome/gtk notification model https://github.com/canonical/desktop_notifications.dart, might want to take a peek. Saw a pr that already tried to use this model but had some issues iirc, maybe this one could work better. |
This still an issue!! |
@jinfagang this wasn't closed and has a needs help label even so as mentioned before in #1183, support for this would need a PRs/contributions from the community |
A PoC of notification plugin on Android/iOS/Windows/Linux/macOS: https://github.com/woodemi/quick_notify |
I'll be taking over Linux (and possibly Windows) support shortly. Thanks @Sunbreak, I will use your example implementation as a starting point to adapt the |
Started on working #1208 |
Duplicated from #1208 (comment): At the moment I'm planning on using |
https://github.com/canonical/desktop_notifications.dart is great and it is maintained by Canonical, the company of Ubuntu
There're still something to implement within |
Do you mean to use it inside |
@proninyaroslav you could take advantage of |
@proninyaroslav agreed, the only dependency this plugin should take is to use |
Linux support implementation is ready, I invite everyone to take part in the review and testing #1208 |
The Linux implementation was swiftly removed again in v 7.0 because of a conflict with the web builds. Is this going to be a trivial issue to fix or should I not expect Linux notification support anytime soon? |
There's an open PR on this already #1249. Once that is merged in though, I'm going to look to have Linux support be in a pre-release instead to be safe given how it went last time and to let it "bake" for bit longer |
I'm currently taking a crack at Windows implementation, however I am struggling with calling WinRT API in a win32 context. Calls to WinRT APIs always throws What I've doneI have followed this page to enable calling WinRT API from win32 programs, by making the following changes in
set(NUGET_PACKAGES_PATH "${CMAKE_BINARY_DIR_WIN_STYLE_PATH}\\packages")
function(install_nuget_package pkg ver)
exec_program(${NUGET}
ARGS install ${pkg}
-ExcludeVersion
-Version ${ver}
-Source "https://api.nuget.org/v3/index.json"
-OutputDirectory ${NUGET_PACKAGES_PATH})
target_link_libraries(${PLUGIN_NAME} PRIVATE "${NUGET_PACKAGES_PATH}\\${pkg}\\build\\native\\${pkg}.targets")
endfunction()
install_nuget_package("Microsoft.Windows.CppWinRT" 2.0.210722.2)
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden
VS_GLOBAL_TargetFramework "net5.0-windows10.0.17763.0"
VS_GLOBAL_CppWinRTPath "${NUGET_PACKAGES_PATH}\\Microsoft.Windows.CppWinRT\\bin\\"
)
target_compile_options(${PLUGIN_NAME} PRIVATE /bigobj /await) Related issues: |
Commented at #746 (comment) |
I set |
@kennethnym Alright! Let me know how I can help you. I want to see this landing as soon as possible. This is one of the most used Flutter dependencies, and I know that many apps would be unblocked by this work. |
If it uses something official then sure. As an example, the Linux implementation uses the dbus package maintained by Canonical |
Does windows notification avaiable now? |
Not yet, still a WIP |
Not sure what is your blocking issue. But BTW WinRT Notification is not available on Windows 7 if I record correctly |
My visual studio install broke recently. I am trying to get it fixed. |
Quick update: Flutter now bundles winrt so I no longer need to pull the winrt package manually from nuget. However, the bundled winrt seems to behave differently. I was able to send notifications successfully with the nuget version of winrt. WIth the bundled version of winrt, Windows shows "New notifications" as the content of the notification, instead of the body that I passed to it. I need to investigate further. Edit: for context i am using VS 2022 with Windows 11. |
I believe it is not Flutter that does this, but the Windows SDK itself. There is a C++/WinRT version there, but you should always use the latest from nuget.org. I have a snippet that helps installing it on cmake: Let me know if this helps you. |
That is very helpful. Thanks for the info! |
Unfortunately, I am still having the same issue. If I use XML template to show notification, nothing would happen; if I use one of the default templates, only "New notifications" would appear. |
Could you share the code so I can take a look? |
I will make a draft PR. |
Is it coming soon? |
It will still take a while. Appreciate your patience! |
Hello, what is the state of this issue? With full support for desktop, this library is now a must for a lot of apps. |
Hello, I'd love to close this as soon as possible, but I am still currently stuck at some issues (more in #1473 ). If someone could step in and help that would be great. |
Looking forwards to the implementation. |
What is the current status for the Windows support? What is still a problem which needs to be fixed? |
Hello, |
Any updates on windows implementation? |
I would love to see Windows support!! |
Any updates on Windows? |
sorry, i haven't worked with flutter in a long while, but anyone is free to pick up where i left off :) |
Thanks to @kennethnym and @lightrabbit, I'm currently working on #2349. Aiming to finish sometime this or next week. |
Update: Going really well so far. I've decided to support raw XML and Dart-based enums and classes for further support. Example in progress: final action = WindowsNotificationAction(
content: "Submit",
arguments: "submit_picture",
);
final details = WindowsNotificationDetails(actions: [action]);
await plugin.show(_id++, "Title", "Body", notificationDetails: details); Clicking the button sends the string |
Update: I've transcribed the entirety of the Windows Toast Notification API to Flutter. Here's a more complex example: final profilePic = WindowsImage(
source: File(r"C:\Users\KDAB\Downloads\image1.jpg"),
altText: "The first image",
crop: WindowsImageCrop.circle,
placement: WindowsImagePlacement.appLogoOverride,
);
final bigImage = WindowsImage(
source: File(r"C:\Users\KDAB\Downloads\image2.jpg"),
altText: "The second image",
);
final likeButton = WindowsAction(
content: "Like",
arguments: "like_post|post_id",
);
final commentButton = WindowsAction(
content: "View Comments",
arguments: "comment_on_post|post_id",
);
const input = WindowsTextInput(
id: "input-id",
hintText: "Send a reply",
);
final sendButton = WindowsAction(
content: "Send",
arguments: "send_reply|post_id",
inputId: "input-id",
);
final progress = WindowsProgressBar(status: "Syncing...", value: 0.75);
final details = WindowsNotificationDetails(
actions: [likeButton, commentButton, sendButton],
images: [bigImage, profilePic],
inputs: [input],
progressBars: [progress],
);
await plugin.show(
_id++,
"Adam Wilson tagged you in a photo",
"Isn't it great?",
notificationDetails: details,
); Raw XML is also supported. I've updated #2349 and marked it as ready for review. It's not 100% ready yet, and there's a TODO on the PR, but if you'd like to use it temporarily, you can put this in for now and remove it once everything is finished: dependency_overrides:
flutter_local_notifications:
git:
url: https://github.com/Levi-Lesches/flutter_local_notifications.git
ref: windows-impl |
Update: My branch is ready for use. Can't guarantee I won't break anything yet, but you can try out the On a non-MSIX, you can't search for or cancel specific notifications, and Windows doesn't support repeating notifications at all, but everything else (and a lot more) has been implemented in the example. If you want to guarantee not being broken until the feature is officially ready to release, change the ref parameter from my previous comment to a full commit hash instead of just the branch name |
I see that you are trying to implement macOS support and it would be appropriate to add Windows and Linux as well. Windows has a native Win32 API, while Linux uses
libnotify
library, which covers cases for different desktop environments.The text was updated successfully, but these errors were encountered: