-
Notifications
You must be signed in to change notification settings - Fork 368
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
Add in app message lifecycle handler #1300
Conversation
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.
- Is this the case in the native SDKs as well or does it log in the expected order in native?
- I don't think the InAppMessage should be null. I can't think of a non-error scenario where it would be null
- This is fine I think
- Yes we probably should have the OSInAppMessage toJSONObject in native instead of RN so that we don't need to translate it in every wrapper. This will require native changes and release. Good call!
- I think your approach here looks good to me, but I will defer to the RN experts.
Reviewable status: 0 of 11 files reviewed, all discussions resolved (waiting on @Jeasmine, @jkasten2, and @rgomezp)
Agree with emawby on all points. Let's make sure to get the native change done with a |
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 other than the small nits and waiting for the changes related to the native JSON stringifier.
@emawby @rgomezp I have one more question: I gave the react-native
Should I name the native JSON stringifier for the public I believe the JSON keys must match over the bridge? |
Let's stick to |
Sounds good. Does this mean the native |
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 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @emawby, @Jeasmine, and @nan-li)
android/src/main/java/com/geektime/rnonesignalandroid/RNUtils.java, line 183 at r1 (raw file):
/** * Converts an OSInAppMessage into a JSON object as OSInAppMessage lacks a toJSONObject() method. * TODO: add toJSONObject() to OSInAppMessage and remove this method.
Adding a comment here to ensure address this comment before merging.
- add setInAppMessageLifecycleHandler method - add InAppMessage interface too - add InAppMessageLifecycleHandlerObject interface
e8c184f
to
bb60bbe
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.
Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @emawby, @Jeasmine, @nan-li, and @rgomezp)
Description
One Line Summary
Adds the In-App Message Lifecycle Handler which includes up to 4 callbacks for the displaying and dismissing of In-App Messages.
Details
Motivation
This handler was added to give customers visibility into the display lifecycle of IAMs: when an IAM will be displayed, and also when it has been dismissed.
Scope
Public API Changes
Yes, the documentation will need to be updated for react native to provide these new methods.
Previous WiP Questions
onWillDismissInAppMessage
is logged before theinAppMessageClicked
is logged even though clicking on the IAM is what causes it to be dismissed (is this problem?)InAppMessage
be null? -> no, it should not besendEvent
for all 4 lifecycle events even if the user has not set all 4. They are just not "caught" by the JavaScript if the user hasn't set the event handler for a particular lifecycle event (native logcat shows all 4).OSInAppMessage
classes addtoJSONObject
(Android) ortoDictionary
orjsonRepresentation
(iOS) as these exist on the other handler/observer objects -> yes, added.RNOneSignal
has different implementations for the other handlers and not sure what the differences are for (NotificationWillShowInForegroundHandler
,NotificationOpenedHandler
,ClickHandler
) and ifInAppMessageLifecycleHandler
should be done differently.Testing
Manual testing
Ran the code in example app on Android and iOS emulators.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)