Fix legacy player ID was not cached properly when upgrading from v3#1345
Merged
Fix legacy player ID was not cached properly when upgrading from v3#1345
Conversation
We were not saving the OSUD_PUSH_SUBSCRIPTION_ID to user defaults when we detected a legacy player ID and proceed with upgrading. It was only saved from create user responses that hydrate the subscription model, which does not happen on v3 -> v5 upgrade.
Because of a bug prior to v5.0.5, players that upgraded from v3 -> v5 were missing the player ID in cache for sending to notification opened and notification received endpoints. Now, every time app cold starts, as part of the push subscription model checking itself for updates, we will cache its subscription ID if non-empty.
jkasten2
approved these changes
Dec 1, 2023
Member
jkasten2
left a comment
There was a problem hiding this comment.
This fixes the bug for new v3 -> v5 migrations for all cases, but it doesn't fix confirmed deliveries for those who already upgrade. Also it probably doesn't fix the not notification open REST API call if someone opens the app for the first time after the v3->v5 upgrade via push, due to the update() code running to late
This was referenced Dec 1, 2023
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Correctly cache push subscription ID when upgrading from v3 for use in receive receipts and notification opened requests.
Details
Correctly cache push subscription ID when upgrading from v3
We were not saving the
OSUD_PUSH_SUBSCRIPTION_IDto user defaults when we detected a legacy player ID and proceed with upgrading.It was only saved from create user responses that hydrate the subscription model, which does not happen on v3 -> v5 upgrade.
Receive receipts and notification opened requests use this value from the cache.
Save push subscription ID on app start
Because of the bug that this PR aims to fix, players that upgraded from v3 -> v5 were missing the player ID in cache for sending to notification opened and notification received endpoints.
Now, to remedy, every time app cold starts, as part of the push subscription model checking itself for updates, we will cache its subscription ID if non-empty.
Future Work
Consider some sort of migration in Core that the extension and user manager can utilize.
Also, this will not fix the issue for users that updated their app and did not open it yet.
Motivation
It was brought up by other team members that many receive receipts and notification opened requests are missing the player ID.
Scope
Sending non-null player ID to receive receipts and notification opened endpoints.
Testing
Unit testing
None, should consider adding
Manual testing
iPhone 13 on iOS 17.1
Scenario 1 Tested mimics v3 -> v5 -> this PR
a. see player created in dashboard
mainwhich is v5.0.4, prior to this PRa. see legacy player get migrated in SDK
b. player in dashboard remains the same but with sdk version updated to 5.0.4
c. Receive receipts and notification opened will be missing player ID
a. Now receive receipts and notification opened will have player ID
Scenario 2 Tested mimics v3 -> this PR
Scenario 3 Tested using new app install
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is