-
Notifications
You must be signed in to change notification settings - Fork 369
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
Allow preventDefault
to be fired up to two times
#2138
Conversation
* The preventDefault(discard) method can now be called up to two times with false and then true. * This is necessary for the `NotificationWillDisplayEvent` for wrappers which may need to call this twice, once to capture the event internally and once from the developer's intent. * For consistency, this ability is added to the `NotificationReceivedEvent` as well.
* There is a lot of duplicated setup code, so let's extract common ones into a helper class * There are no logic changes in this commit.
preventDefault
to be fired up to two timespreventDefault
to be fired up to two times
* The tests ensure calling preventDefault twice work when called in different threads * And a followup call to display does not display the notification
7d4391d
to
9b7b91d
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.
Looks good to me to account for the wrapper use-case. Would be a nice to have if preventDefault(false)
could be called any number of times, but that is pretty minor and shouldn't hold up getting this PR out there.
|
Description
One Line Summary
Allow
preventDefault
to be fired up to two times with thediscard
parameter offalse
and thentrue
, for the Received Event and the Display Event.Details
discard
parameter is read when the callback returns. Then the logic continues on with that state.preventDefault(true)
had no effect.preventDefault(false)
can be called multiple times and has no effects due to no state change.Motivation
To allow #2094 to work for wrappers.
Scope
Calling preventDefault twice where the first does not discard and the second discards.
Testing
Unit testing
Manual testing
NotificationLifecycleListener
for the will display event.preventDefault()
preventDefault(true)
display()
NotificationServiceExtension
for the received event.Also test there is no breaking of current behavior when preventDefault(discard: false) is called followed by display, will display the notification.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is