-
Notifications
You must be signed in to change notification settings - Fork 267
Late setNotificationOpenedHandler call processing #826
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
Late setNotificationOpenedHandler call processing #826
Conversation
Test failure is due to log size in TravisCI. I confirmed all tests passed locally. |
if (!notificationOpenedHandler) | ||
return; | ||
|
||
for(OSNotificationOpenedResult* notification in [self getUnprocessedOpenedNotifis]) { |
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.
space after the for 🙏
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.
Good catch! I always do that 🤣
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.
Created fixup commit 4e0fc0c to address this.
@@ -358,8 +379,10 @@ + (void)handleNotificationAction:(OSNotificationActionType)actionType actionID:( | |||
|
|||
[OneSignalTrackFirebaseAnalytics trackOpenEvent:result]; | |||
|
|||
if (!notificationOpenedHandler) | |||
if (!notificationOpenedHandler) { | |||
[[self getUnprocessedOpenedNotifis] addObject:result]; |
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.
maybe have this addObject in a method, to have the UnprocessedOpenedNotifis mutations centralized?
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.
Created fixup commit 4e0fc0c to address this.
* If OneSignal.setNotificationOpenedHandler is called after didFinishLaunchingWithOptions then we still want their handler to fire. - So basicly the OneSignal SDK will hold onto the event for them and fire it as soon as handler is setup. * This means more flexability on where / when the developer wants to call setNotificationOpenedHandler. * This is the exact behavior provided in the Android SDK in this commit. - OneSignal/OneSignal-Android-SDK@ce5ad7d#diff-2708f86f77e539cab647ecede9d5fcbead3bf0f954d7f9e536eafbc78ba760d6R340-R344
4e0fc0c
to
1a59df2
Compare
Ran |
Changes
OneSignal.setNotificationOpenedHandler
is called afterdidFinishLaunchingWithOptions then we still want their handler to fire.
and fire it as soon as handler is setup.
setNotificationOpenedHandler
.OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java
Manual Testing
Tested on iOS 14.2 with the following steps.
OneSignal.setNotificationOpenedHandler
with a delay of 3 secondsWhen to merge
This change is