Add discard parameter to preventDefault() #2094
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Add the ability to immediately discard a notification by calling preventDefault(discard: true)
Details
Adding an overload to the
preventDefault
method in theNotificationWillDisplayEvent
andNotificationReceivedEvent
that adds a boolean parameterdiscard
When true this parameter results in dropping the notification immediately instead of waiting to see if
display()
will be called within the next 30 seconds.This is equivalent to calling the completion handler with no notification in the player model SDK.
Motivation
This fixes a bug/behavior where if the app is closed before the preventDefault waiter times out, the notification is not marked as dismissed in the local database and will be displayed when the app is next opened.
Scope
notification will display and received event handling
Testing
Unit testing
added unit tests to validate we don't wait for display() to be called prior to marking the notification as dismissed.
Manual testing
Tested the will display in foreground flow with discard both false and true. Verified that it fixed the redisplay on next open behavior.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is