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] IAM Click Listener - API update #1261

Merged

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Apr 29, 2023

Description

One Line Summary

IAM Click Listener - API update

Details

Motivation

IAM Click Listener - API update

Scope

  • Rename click block to OSInAppMessageClickListener
  • Rename setClickHandler to addClickListener
  • Add a remove method for the click listener
  • OSInAppMessageAction has basically been renamed to OSInAppMessageClickResult
  • OSInAppMessageClickEvent will be passed to developers instead of OSInAppMessageAction and the event will contain an in app message and a click result.
  • Supports adding and removing multiple click listeners

Public API

OneSignal.InAppMessages namespace
    + (void)addClickListener:(NSObject<OSInAppMessageClickListener> *_Nullable)listener
    + (void)removeClickListener:(NSObject<OSInAppMessageClickListener> *_Nullable)listener
OSInAppMessageClickListener
    - (void)onClickInAppMessage:(OSInAppMessageClickEvent *_Nonnull)event
    func onClick(event: OSNotificationClickEvent) // For Swift API refined
OSInAppMessageClickEvent
    @property (nonatomic, readonly, nonnull) OSInAppMessage *message
    @property (nonatomic, readonly, nonnull) OSInAppMessageClickResult *result
    - (NSDictionary *_Nonnull)jsonRepresentation
OSInAppMessageClickResult
    @property (strong, nonatomic, nullable) NSString *actionId
    @property (strong, nonatomic, nullable) NSString *url
    @property (nonatomic) BOOL closingMessage
    @property (nonatomic) OSInAppMessageActionUrlType urlTarget
    - (NSDictionary *_Nonnull)jsonRepresentation
OSInAppMessageActionUrlType
    typedef NS_ENUM(NSUInteger, OSInAppMessageActionUrlType) 
        OSInAppMessageActionUrlTypeSafari
        OSInAppMessageActionUrlTypeWebview
        OSInAppMessageActionUrlTypeReplaceContent

Testing

Manual testing

Manual testing with iPhone 13 physical device running iOS 16.x.

  • test click listener fired, adding, removing multiple, and inspecting the properties and objects on the event and jsonRepresentation of them.

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

* Rename click block to `OSInAppMessageClickListener`
* Rename `setClickHandler` to  `addClickListener`
* Add a remove method for the click listener
* OSInAppMessageAction has basically been renamed to OSInAppMessageClickResult
* OSInAppMessageClickEvent will be passed to developers instead of OSInAppMessageAction and the event will contain an in app message and a click result.
@nan-li nan-li changed the title IAM Click Listener - API update [5.0.0] IAM Click Listener - API update Apr 29, 2023
OSInAppMessageDelegate  and handleMessageAction not used by anything
@nan-li nan-li force-pushed the 5.0.0/iam_click_listener_api branch from 6723898 to 58cad6f Compare April 29, 2023 01:10
@nan-li nan-li requested review from emawby, jkasten2, shepherd-l and jennantilla and removed request for emawby April 29, 2023 01:10
nan-li and others added 3 commits April 30, 2023 01:52
* We have some legacy logic about IAM direct influence but if there are multiple click listeners added, we only want this to update once, and not for every listener.
* Rename setNotificationOpenedHandler -> addClickListener, removeClickListener
* Rename object `OSNotificationOpenedResult` -> `OSNotificationClickEvent`
* Rename object `OSNotificationAction` -> `OSNotificationClickResult`
* Support having multiple listeners
…ener_api

[5.0.0] Notification Click Listener - API update
@emawby emawby merged commit 494bf10 into 5.0.0/push_subscription_observer_api May 1, 2023
@emawby emawby deleted the 5.0.0/iam_click_listener_api branch May 1, 2023 20:11
@emawby emawby mentioned this pull request May 1, 2023
nan-li pushed a commit that referenced this pull request Oct 30, 2023
nan-li pushed a commit that referenced this pull request Oct 30, 2023
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