-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.0.0] Push subscription related fixes (3) #1289
Merged
Merged
Conversation
This file contains 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
* Properties on the push subscription can change between app opens such as app version, SDK version, or device OS * These changes aren't driven by changes in the SDK and previously wouldn't be detected as changed * Now, on each new session, we will ask the push subscription model to check itself for updates and enqueue those changes.
- Create the push sub model with the notification_types at time of creation - This is so that on the first app open, we can receive push prompt IAMs (server expects to have an appropriate notification_type to determine eligibility)
* On a new session, we fetch the user. If we detect our push subscription missing from the user (indicating the push subscription may be deleted), we send a create subscription request for the device's push sub.
* On the user manager * We access the push subscription model via the model store instead of via `user.pushSubscriptionModel`. * If privacy consent is set in a wrong order, we may have sent requests, but hydrate on a mock user. * However, we want to set tokens and subscription ID on the actual push subscription model.
* If a createUser fails, let's pause the operation repo. We will still poll, but we won't flush it is paused. * After a create user request is uncached, update the `originalPushToken` property to be the push token associated with this request. Because, we update the push subscription before sending this request.
* On a new session, we will trigger the user executor to execute any pending requests, in case there is a failed create user request that should be retried. We can't rely on the operation repo flushing to trigger the user executor as it bypasses the operation repo.
nan-li
changed the title
5.0.0/push sub fixes
[5.0.0] Push subscription related fixes (3)
Aug 9, 2023
emawby
approved these changes
Aug 9, 2023
The JS dismiss event is being sent to the SDK twice. Make sure we don't dismiss twice or the second IAM in the queue will be dismissed before it is displayed
* Each executor manages its own background task * For attributed sessions, define another background task to send the session_time to update user (in addition to the existing request to the outcomes endpoint)
* When app is backgrounded, flush the operation repo and let each executor and request manage its background task * don't end background tasks until requests return * Processing the queues will take in another flag called `inBackground`
* Add callbacks before ending the background task to send attributed session time, and save unsent time as zero only after a success callback * This waits 30 seconds in the background
* When app is backgrounded, create a background task and send the session_time to the user endpoint * Have callbacks, bypassing the operation repo * This is done both for unattributed sessions that send the request right away and for attributed sessions that wait 30 seconds before sending
* Remove messy logging * Add informational log for background task expiring
* When we set tags and it goes over limit, we don't delete them locally. * Let's do the same for added aliases that can't be added to the user due to conflict * The SDK will refresh itself on new sessions * We will need better systematic way to address these types of failure cases
[5.0.0] Fix background tasks
[User model] Fix in app display
[5.0.0] Allow the SDK the chance to recover from failed Create User
* Rename `OSBackgroundTaskManagerDelegate` -> `OSBackgroundTaskHandler` because it is not truly a delegate, but is a concrete implementation that is injected
Base automatically changed from
5.0.0/fix_session_influence
to
major_release_5.0.0
August 10, 2023 17:46
This was referenced Aug 10, 2023
Merged
nan-li
added a commit
that referenced
this pull request
Oct 30, 2023
[5.0.0] Push subscription related fixes (3)
nan-li
added a commit
that referenced
this pull request
Oct 30, 2023
[5.0.0] Push subscription related fixes (3)
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
Three fixes that are push subscription related:
app_version
orsdk
Details
Motivation
1. Check for push subscription updates on new sessions
app_version
,sdk
version, ordevice_os
app_version
particularly is important to keep updated for app developers2. Initialize the push subscription model with a
notification_type
notification_types
at time of creationnotification_type
to determine eligibility)ERROR_PUSH_DELEGATE_NEVER_FIRED
or-14
3. Recreate a push subscription to the server when we detect it is deleted
4. On the user manager, add a convenience accessor to the push subscription model
user.pushSubscriptionModel
user.pushSubscriptionModel
may operate on a mock push subscription.Testing
Unit testing
No
Manual testing
Tested on physical iPhone 13 on iOS 16.6
Scenario 1: Send push subscription changes that were not captured before such as
app_version
orsdk
app_version
andsdk
versionapp_version
andsdk
version and reopen appapp_version
andsdk
version is sent to serverScenario 2: Initialize push subscriptions with a notification type
Scenario 3: Send create push subscription request if we detect it has been deleted
subscription_id
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is