-
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
Fix IAM Preview Notification being handle as normal Notification #1376
Conversation
* Move inAppMessagePreviewHandled and inAppPreviewPushUUID method from NotificationBundleProcessor to OSInAppMessagePreviewHandler
* OSNotificationGenerationJob won't handle IAM state
* Encapsulate ProcessedBundleResult fields
* Handle IAM logic inside OSInAppMessagePreviewHandler * Display Notification if IAM Preview and app not in foreground * Remove Worker handling from IAM Preview since there is no images or DB logic needed
…7 test * Test was failing due to SDK version check; this check was only applying to IAMs notifications. Move the check to inAppMessagePreviewHandled
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.
👍 Nice overall cleanup. A few optional comments.
Reviewed 7 of 7 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @emawby and @Jeasmine)
OneSignalSDK/onesignal/src/main/java/com/onesignal/OSInAppMessagePreviewHandler.java, line 15 at r1 (raw file):
import static com.onesignal.NotificationBundleProcessor.PUSH_ADDITIONAL_DATA_KEY; class OSInAppMessagePreviewHandler {
Since this is a new class what do you think about using Kotlin instead?
OneSignalSDK/onesignal/src/main/java/com/onesignal/OSInAppMessagePreviewHandler.java, line 21 at r1 (raw file):
// Show In-App message preview it is in the payload & the app is in focus String previewUUID = inAppPreviewPushUUID(pushPayloadJson); if (previewUUID != null) {
Would be a bit easier to read if this was an early return instead.
if (previewUUID == null) {
return false;
}
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.
Reviewed 7 of 7 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Jeasmine and @nan-li)
* Refactor from Java to Kotlin
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.
Reviewed 2 of 2 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Jeasmine and @nan-li)
### Bug
IAM Notification was being handled as a normal notification; this means that notifications callbacks from the user were being called and receive receipt request was also made for this notification.
### Solution
Currently, we have IAM handling, but only if the app is in the foreground. Add Notification display to the same
inAppMessagePreviewHandled
method. This helped cleaning some code, checking if IAM is preview inside common notification display flow was removed.Review commit by commit to seeing the process of fixing
This change is