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

[User model] update public api for new event names #57

Merged
merged 27 commits into from
Jun 29, 2023

Conversation

emawby
Copy link
Contributor

@emawby emawby commented May 26, 2023

Description

One Line Summary

This PR makes changes to the public api to reflect naming changes for event listeners.

Details

  • Renamed RequiresPrivacyConsent and PrivacyConsent to ConsentRequired and ConsentGiven
  • Updated trigger value to be string instead of object and updated method signatures
  • Updating Notifications to use addClickListener and addForegroundLifecycleListener from the native code. The WillDisplay and Click event handlers now fire with new arguments. The WillDisplayEvent args allow you to prevent default display of the notification by calling preventDefault() and then use notification.display() to display the notification after having prevented default.
  • The subscription observer is now a PushSubscriptionObserver. The changed event now provides the previous and current push subscription states.
  • In app message click events now have a Click Result instead of a click action.
  • Added PermissionNative() to get the exact permission type for iOS devices
  • Removed Default shared instance from public api. Instead all fields can be accessed statically on the OneSignal class.

This PR also makes some fixes to the project to get the sample app to run as well as a bash script for copying over binaries for native repos.

The migration guide has been updated in this PR to reflect the changes made.

Motivation

naming updates

Scope

Public APIs

Testing

Unit testing

N/A

Manual testing

tested on Android emulator and physical iOS device. All callbacks were tested including preventingDefault/Display

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
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • 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.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

@emawby emawby changed the base branch from main to user-model/main May 26, 2023 19:22
The OneSignal class now has static fields for all OneSignal functionality. Under the hood it is still using the default instance. The static fields forward the calls onto the singleton instance.
@emawby emawby requested review from nan-li and shepherd-l June 15, 2023 17:18
@emawby emawby merged commit 73a6a4b into user-model/main Jun 29, 2023
@emawby emawby deleted the user_model/update_events branch June 29, 2023 20:08
@emawby emawby mentioned this pull request Jun 29, 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