Skip to content
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

[5.0.0] Support multiple IAM + Notification Lifecycle Listeners #1278

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Jul 19, 2023

Description

One Line Summary

Support multiple IAM Lifecycle Listeners + Notification Foreground Lifecycle Listeners.

Details

Motivation

No API change, but under the hood, support adding multiple listeners that remained a TODO after these two PRs:

Scope

Letting app developers add and remove multiple listeners. When there are multiple notification foreground listeners, essentially first one wins. The first listener to call preventDefault and display will trigger these events.

In addition, added jsonRepresentation to IAM lifecycle events

  • so developers can call [event jsonRepresentation]
  • We only want to show the properties available on OSInAppMessage, however since OSInAppMessageInternal is a subclass of OSInAppMessage, we end up exposing the internal properties. Therefore, I renamed the method on OSInAppMessageInternal to jsonRepresentationInternal, which is used for debugging.

Testing

Manual testing

Tested on iPhone 13 device on iOS version 16.5

  • Tested adding and removing multiple listeners and that they are fired.
  • Tested multiple listeners being involved in the notification display, by calling display and preventDefault in various configurations.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

* Add `jsonRepresentation` method to the IAM lifecycle events so developers can call `[event jsonRepresentation]`
* We only want to show the properties available on OSInAppMessage, however since OSInAppMessageInternal is a subclass of OSInAppMessage, we end up exposing the internal properties as well when we ask the OSInAppMessage for its jsonRepresentation. Therefore, I made a separate method called `jsonRepresentationInternal` to OSInAppMessageInternal, which is used for debugging.
* Multiple listeners can be added and removed
* Multiple listeners can be added and removed
* Add to dropdown so it can be easily chosen as the target to run
@nan-li nan-li merged commit 208bc8d into major_release_5.0.0 Jul 19, 2023
1 check failed
@nan-li nan-li deleted the 5.0.0/support_multiple_listeners branch July 19, 2023 21:36
nan-li added a commit that referenced this pull request Oct 30, 2023
[5.0.0] Support multiple IAM + Notification Lifecycle Listeners
nan-li added a commit that referenced this pull request Oct 30, 2023
[5.0.0] Support multiple IAM + Notification Lifecycle Listeners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants