Update push subscription model properties between sessions#1922
Merged
nan-li merged 6 commits intouser-model/mainfrom Dec 1, 2023
Merged
Update push subscription model properties between sessions#1922nan-li merged 6 commits intouser-model/mainfrom
nan-li merged 6 commits intouser-model/mainfrom
Conversation
emawby
approved these changes
Nov 30, 2023
Contributor
emawby
left a comment
There was a problem hiding this comment.
Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jennantilla, @jinliu9508, @jkasten2, @nan-li, and @shepherd-l)
Subscription Manager contains a method previously called `addOrUpdatePushSubscription` that is meant to be used in relation to updating push tokens. This method is renamed to `addOrUpdatePushSubscriptionToken` so as to not confuse with other updates on the push subscription such as detecting app version changes between app opens, which is a newly added feature
Subscription Model now has sdk, deviceOS, carrier, and appVersion as properties so that they can persist. The getter is defaulted to "" (the empty string) as these properties do not exist prior to v5.0.5. They are only read when detecting changes so it is ok that they default to "" as the empty string will not be sent.
Additionally set these properties when a push subscription model is created: - sdk, deviceOS, carrier, appVersion
Let the SubscriptionManager refresh the push subscription model on new sessions.
When hydrating an existing push subscription model, use existing local device-scoped information instead of remote information for: - sdk - deviceOS - carrier - appVersion This information should always come from the local device. The reason for this change is that on a new session, we may detect a change to one of these properties and we do not want to overwrite it with old remote data from the get_user response.
6328a5d to
7c8167d
Compare
Merged
jinliu9508
pushed a commit
that referenced
this pull request
Jan 31, 2024
Update push subscription model properties between sessions
jinliu9508
pushed a commit
that referenced
this pull request
Jan 31, 2024
Update push subscription model properties between sessions
jinliu9508
pushed a commit
that referenced
this pull request
Feb 6, 2024
Update push subscription model properties between sessions
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
On new sessions, we will update the server with changes to app version, sdk version, carrier, and device OS.
Details
Motivation
If app version or sdk version is updated, these updates should be sent to the server.
Scope
1. Add these properties to Subscription Model
First, these properties should exist on Subscription Model. It now has
sdk,deviceOS,carrier, andappVersionas properties so that they can persist. When push subscription models are initialized, these properties are now also set on the model.2. On new sessions, check for subscription property updates
Let the SubscriptionManager refresh the push subscription model on new sessions.
3. Don't hydrate this info for a push subscription model
When hydrating an existing push subscription model, use existing local data for these properties.
This information should always come from the local device. The reason for this change is that on a new session, we may detect a change to one of these properties and we do not want to overwrite it with old remote data from the get_user response.
There are other ways to implement this PR, and open to discussing another approach.
Testing
Unit testing
None, should consider adding a test that can test this.
Manual testing
Android 33 Emulator
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is