-
Notifications
You must be signed in to change notification settings - Fork 102
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
dexc-desktop: Desktop notifications #2599
Conversation
I'd be glad to assist. You can focus on other operating systems, I'll implement for macOS. PS: I have something already, but it seems the work in this PR is not fully fleshed out so I'll wait. |
Windows and Linux work, the macOS bit is left to be sorted. Thanks for looking into it! |
515b3bd
to
daa7f89
Compare
@ukane-philemon have you been able to look into this? |
Yes. I'll push to a branch soon. PS: Does |
The HTML5 Notification API doesn't work, hence the |
I encountered a blocker while implementing this but already asked for suggestions here: progrium/darwinkit#231 |
No, it gets silently ignored - the notification API isn't implemented in webview (which kind of makes sense), this is why I use the
Thanks for posting this. I noticed some functions like |
In the macdrive repo? |
No, to the test case in the progrium post. Could you point me at your full code please? |
daa7f89
to
8591fe6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Linux and Mac.
On Mac, the notification doesn't have our icon.
browserNtfnSettings[noteType] = enabled | ||
State.storeLocal(browserNotificationsSettingsKey(), browserNtfnSettings) | ||
export function updateNtfnSetting (noteType: string, enabled: boolean) { | ||
fetchDesktopNtfnSettings() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary, right?
yh. We’re currently using beep. |
beeep doesn't support icons on macOS. |
766e478
to
45c264e
Compare
Signed-off-by: Philemon Ukane <[email protected]>
45c264e
to
c509a3f
Compare
We'll leave this as in need of a solution for now then. I'll open an issue. I'm sure there's a way to avoid beeep and use system calls of some kind. |
This PR changes the way desktop notifications are sent when running in WebView. Instead of the HTML5 Notifications API the
sendDesktopNotification
call is used.Tested on Firefox, Chrome, Safari, Edge.
dexc-desktop
tested on Linux, Windows 10, Windows 11, macOS.macOS solution is implemented in #2631Closes #2576
Edit:
A recent update of Edge removed the ability to request notification permission from JS (
Notification.requestPermission
). The supported way now, apparently, is to have the user grant the permission in the browser settings.https://answers.microsoft.com/en-us/microsoftedge/forum/all/webpush-notifications-blocked/a65a0e3e-dd0f-427f-b16e-31a98d60b0c4
This leaves us with 2 choices; a) when running in Edge, disable the "Enable desktop notifications" checkbox and display a note about how to change the settings, b) leave it as is and revise in a later iteration. I'm leaning towards b) as Edge has a 12% market share and this PR is already rather large but if this is important I'll do another PR.