OneSignal-iOS-SDK icon indicating copy to clipboard operation
OneSignal-iOS-SDK copied to clipboard

Add `OneSignal-Subscription-Id` to Create User request

Open nan-li opened this issue 1 year ago • 1 comments

Description

One Line Summary

Add the OneSignal-Subscription-Id header to Create User requests.

Details

Motivation

  • This was an ask of the SDK to support improved last_active tracking subscriptions that were actually active
  • What is currently happening is all subscriptions for this user were getting last_active updated.
  • Now, only the subscription that made the create user request is updated.
  • Also, changed a detail of User Update request to not be blocked if subscription ID header could not be added (may be missing subscription ID for example)

Scope

  • Changed the Update User requests to not be blocked if missing subscription-ID
  • A header in Create User requests for backend to process
  • I tested with server changes that only the device making the call has last_active updated.

Testing

Unit testing

None, we can add in future to make sure headers are included.

Manual testing

  1. Building and running on iPhone 13 with iOS 17.2.
  2. Change SDK version and call login while already logged into an identified user (this will send a Create User request)
  3. With debug on, confirm the subscription ID is added to the request
  4. Checked dashboard that only this subscription is updated

Affected code checklist

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

Checklist

Overview

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

Testing

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

Final pass

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

This change is Reviewable

nan-li avatar Feb 15 '24 21:02 nan-li

Just tested today with server changes completed that last_active is now only updating the subscription making the request, instead of all subscriptions for the user.

nan-li avatar Feb 24 '24 01:02 nan-li