Add discard parameter to preventDefault() #2094
Merged
Conversation
Must use function overload instead of default parameter due to java limitation. @jvmoverloads does not work when the default parameter is defined in an interface
6c891a7 to
066deda
Compare
This is identical to the NotificationWillDisplay event parameter and logic in the generationProcessor
066deda to
64b309c
Compare
jkasten2
approved these changes
May 28, 2024
Merged
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
preventDefaultmethod in theNotificationWillDisplayEventandNotificationReceivedEventthat adds a boolean parameterdiscardWhen 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