OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
496 stars 263 forks source link

[Feat] Use only OneSignal ID for requests #1464

Closed nan-li closed 3 months ago

nan-li commented 3 months ago

Description

One Line Summary

Use only OneSignal ID for requests, no longer using any External ID for requests.

Details

Motivation

Move away from using External ID in request URLs, only using OneSignal ID.

Scope

Making requests

Testing

Unit testing

Manual testing

Device: iPhone 13 on iOS 17.5.1

Identify User with success (external ID applied successfully) 1. Start with anonymous user in the SDK 2. Add a tag and an email 3. Login to a new user (brand new external ID) 4. The Identify User request is successful 5. Fetch User by OSID happens 6. Local state is correct and contains the tag and email
Identify User with 409 conflict 1. Start with anonymous user and login to an existing EUID 2. Receive 409 conflict response 3. If the user is the current user, it will make a CreateUser request with the external ID and push subscription in the payload 4. If the user is now different, it will make a CreateUser request with the external ID only for hydration of the OneSignal ID, for any pending requests for that previous user
SDK Upgrade: There is a cached Transfer Subscription for the current user 1. Reproduce this on `main` by login to an existing EUID 2. The Identify User happens and receives 409 conflict response 3. The subsequent Fetch User by EUID and Transfer Subscription are generated and cached, but do not get sent 4. Upgrade SDK to this version 5. During uncaching, the Fetch User is dropped and the Transfer Subscription is converted to a CreateUser containing the external ID and push subscription. 6. User observer fires and everything looks correct.
SDK Upgrade: There is a cached Transfer Subscription for a previous user 1. Reproduce this on `main` by login to an existing EUID `userA` 2. The Identify User happens and receives 409 conflict response 3. The subsequent Fetch User by EUID and Transfer Subscription are generated and cached, but do not get sent 4. Now login to another user `userB`, which enqueues a CreateUser request 5. Upgrade SDK to this version 6. During uncaching, the Fetch User is dropped and the Transfer Subscription is dropped, only the CreateUser remains 7. The CreateUser is sent and the state in the SDK seems correct for `userB`.

Affected code checklist

Checklist

Overview

Testing

Final pass


This change is Reviewable