[5.0.0] Migrating SDK 3.x players#1243
Conversation
- when someone calls `optOut`, fire the push sub observer with that change BEFORE setting `notification_types` (which will also fire the push sub observer but won't have any effect)
* Remove the call to `removeFromQueue(request)` here. It was too early and would remove the request even for a retry-able error.
* Not sure where it is stored so remove from both standard and shared user defaults
* Split `OSUD_PUSH_SUBSCRIPTION_ID` into `OSUD_LEGACY_PLAYER_ID` and `OSUD_PUSH_SUBSCRIPTION_ID` so we can track any legacy player IDs
* Add another path in the `start()` method of the User Manager that will detect legacy players and create a new user from that information.
* This is needed to migrate legacy players within the SDK
* Refactor and reuse `setNewInternalUser` and `createDefaultPushSubscription` in `createUserFromLegacyPlayer` * Make a helper method `isCurrentUser` to wrap checking if a user is the current one.
emawby
left a comment
There was a problem hiding this comment.
Reviewed 4 of 5 files at r1, all commit messages.
Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @jennantilla, @jkasten2, @nan-li, and @shepherd-l)
iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift line 193 at r1 (raw file):
} firePushSubscriptionChanged(.isDisabled(oldValue)) notificationTypes = -2
What is the significance of this change?
@emawby This was to fix this issue: The app has notification permission already and What was happening was we update the So now, once the This is confusing without drawing it out but hope its still somewhat clear. |
[5.0.0] Migrating SDK 3.x players
[5.0.0] Migrating SDK 3.x players
Description
One Line Summary
Migrates a cached 3.x player to a 5.x user with the player ID becoming the new push subscription ID.
Details
Motivation
Handles migrating someone using SDK 3.x to the new user model, who may not uninstall and reinstall the app.
Scope
Affects migrating old players. If there is a cached player ID, we will create a new user with that player ID as the new push subscription ID, and fetch this subscription ID's identity.
Error handling server responses will be part of another PR.
Testing
Unit testing
None
Manual testing
Tested on iPhone 13 physical device with iOS 16.x.
Tested on iPhone 13 physical device with iOS 16.x. Testing the request is cached
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is