Closed cyfrost closed 3 years ago
@cyfrost Push notifications in Gmail Desktop have been a long standing pain point for me (see #15 and #38). Because the notifications use the default "browser-style" notifications and not native electron notifications, they limit what we are able to do with them.
One approach I've considered but haven't had a chance to try is listening to network traffic and creating our own notifications when those requests are received. This would open an interesting door as we would then be able to fully customize notification content, support sticky and disabled notifications, and potentially fix issues with custom styles in windows opened when clicking on notifications.
This GitHub project has an example of what I'm referring to, although much more in-depth than what would probably be necessary: https://github.com/KartikTalwar/gmail.js/blob/9e69719b294c7386017b41bb37539c9588e4701f/src/gmail.js#L1164
Point 1 is now handled by cd951ca.
Point 2 could be solved by reloading Gmail when the machine wakes up. Wdyt?
Hi, push notifications for new emails are a great feature, thanks for building it.
I've observed a few scenarios where it may not work as intended:
Scene 1:
Ideally, the app should listen to network changes and connect to Gmail when connection is back online and also display any missed push notifications for emails since launch time.
Scene 2:
The push notifications don't come through at all or sometimes arrive minutes later (can stem from kernel refreshing existing sockets periodically).
Please note that the reproducing Scene #2 may not always work, in which case, we can either try reproducing it reliably or drop it as a non-issue.
Possible solution
Subscribe to network changes and handle them appropriately. Fortunately, Electron already has these APIs.
I'm working on this bug and will soon open a PR. Any thoughts?