-
Notifications
You must be signed in to change notification settings - Fork 275
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
Rewrite notifications and add its tests #906
Conversation
Codecov Report
@@ Coverage Diff @@
## main #906 +/- ##
==========================================
- Coverage 73.56% 70.38% -3.18%
==========================================
Files 17 27 +10
Lines 1755 2161 +406
Branches 278 323 +45
==========================================
+ Hits 1291 1521 +230
- Misses 464 640 +176
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Try now @tupaschoal |
Works like a charm now, thanks :) Let me do the full review of the code |
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.
Ok, there's a lot going on, I reviewed all of the code and some of the tests (save for menus
and main-window
tests). Will pick up on that later.
return createNotification(getCurrentTranslation('$Notification.time-to-leave'), [dismissBtn]) | ||
.addListener('action', (response) => | ||
{ | ||
// Actions are only supported on macOS |
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.
Did we then lose functionality of the dismiss button for Windows?
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.
Actions are not available on the current version of Electron, but once it's updated the commented code can be used. Otherwise we would've had to deal with two libraries
Hi @ochan12, have you had a chance of looking at the comments I left in the review? |
Hey @tupaschoal sorry, I've been a little behind with these comments, couldn't find any time to do it. Will do it during this week |
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
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.
Seems like a few functions are failing consistently on macos and windows tests:
✕ Should quit on click
✕ Should create notification on click
✕ Should show dialog for importing db
✕ Should show fail dialog for importing db
✕ Should show fail dialog for importing db
✕ Should not show dialog for clearing db
Hey @tupaschoal ! I see it. Test are passing locally for me, so gonna have to investigate further |
Fixed now @tupaschoal :) |
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.
Sorry it took us a while @ochan12 , but I'm glad we got it through and am very happy not only with the issues being fixed, but also with the great increase in code coverage, a huge thanks!
\changelog-update |
\changelog-update |
Related issue
Closes #865
Closes #883
Closes #811
Context / Background
In order to stop using SnoreToast we need to favor Electron Notifications on top of
node-notifier
package.Also, there was an exception being thrown because it was trying to use jQuery on main process.
What change is being introduced by this PR?
Remove usage of
$("#leave-by")
fromjs/notifications.js
and fetch it through ipcRenderer.Remove usage of node-notifier to use Electron Notifications to avoid having SnoreToast.exe on top.
Added event listener on notification to open app or dissmiss notifications
NOTE: Actions on windows will be disabled until Electron is upgraded at least 12.0.0. Once it's upgraded we can use the commented section with
toastXml
constructor.How will this be tested?
I added a test for showing the notification. I had to do a little hack to emit a notification instead of showing it for
linux
tests, since it was failing. This will only happen on CI and Linux, I ran tests on linux with no problem.