Skip to content

Add public getTags method#1338

Merged
nan-li merged 3 commits intomainfrom
add_get_tags
Nov 29, 2023
Merged

Add public getTags method#1338
nan-li merged 3 commits intomainfrom
add_get_tags

Conversation

@nan-li
Copy link
Copy Markdown
Contributor

@nan-li nan-li commented Nov 14, 2023

Description

One Line Summary

Add public OneSignal.User.getTags() method to return local tags for the current user.

Details

  • Add getTags public method that will return local tags for the current user
  • Rename an existing internal getTags method used for IAM processing by appending the internal keyword. I chose not to combine these two methods as one may be called without privacy consent while the public one should be guarded for privacy consent.

Motivation

We removed the getTags method in v5 of the iOS SDK to discourage use of OneSignal tags as a data store. We have heard feedback from app developers that they have a need for this method still, so we are adding back an implementation to return the local tags.

Scope

Keep note it returns the local tags and not via a server fetch so any tags added mid-session through the REST API will not be reflected.

Testing

Unit testing

None

Manual testing

iPhone 13 on iOS 17.1.1 that the following scenarios behave appropriately

  1. Add some tags and call getTags()
  2. Login to another user that has existing tags and call getTags()
  3. Add more tags and call getTags()

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 `getTags` public method that will return local tags for the current user
* Rename an existing internal `getTags` method used for IAM processing by appending the internal keyword. I chose not to combine these two methods as one may be called without privacy consent while the public one should be guarded for privacy consent.
@nan-li nan-li merged commit 95f2c0e into main Nov 29, 2023
@nan-li nan-li deleted the add_get_tags branch November 29, 2023 21:47
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