Skip to content
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 21 commits into from
Aug 10, 2023

Commits on Aug 8, 2023

  1. check for push subscription updates on new sessions

    * 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.
    nan-li committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    b7f070c View commit details
    Browse the repository at this point in the history
  2. Create the push sub model with a notification type

    - 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)
    nan-li committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    2fe55b3 View commit details
    Browse the repository at this point in the history
  3. Recreate a push subscription when we detect it is removed

    * 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.
    nan-li committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    ea6c30c View commit details
    Browse the repository at this point in the history
  4. Add convenience accessor to the push subscription model

    * 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.
    nan-li committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    7d7f13d View commit details
    Browse the repository at this point in the history
  5. Allow the operation repo to be paused

    * 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.
    nan-li committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    0d033d4 View commit details
    Browse the repository at this point in the history
  6. On new session, user executor executes, and unpause operation repo

    * 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 committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    ec27d63 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    af02758 View commit details
    Browse the repository at this point in the history
  8. [nits]

    * Use the existing `isCurrentUser` method
    * remove extraneous logging that make the logs messy
    nan-li committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    0291cfa View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2023

  1. Always remove the window when an IAM is dismissed

    Cherry pick #1276
    emawby committed Aug 9, 2023
    Configuration menu
    Copy the full SHA
    9641884 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2023

  1. Ignore the second JS dismiss event

    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
    emawby committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    c34fc63 View commit details
    Browse the repository at this point in the history
  2. Define more background tasks

    * 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)
    nan-li committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    f9ac55d View commit details
    Browse the repository at this point in the history
  3. Background flush of operation repo

    * 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`
    nan-li committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    ff6c5fa View commit details
    Browse the repository at this point in the history
  4. Background sending of session ending outcomes

    * 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
    nan-li committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    5a309b1 View commit details
    Browse the repository at this point in the history
  5. Update background sending session_time to user

    * 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
    nan-li committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    c6cfcda View commit details
    Browse the repository at this point in the history
  6. [nits] logging

    * Remove messy logging
    * Add informational log for background task expiring
    nan-li committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    2202fe7 View commit details
    Browse the repository at this point in the history
  7. Don't handle addAlias conflict

    * 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
    nan-li committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    eb16f40 View commit details
    Browse the repository at this point in the history
  8. Merge pull request #1300 from OneSignal/5.0.0/rehaul_background_tasks

    [5.0.0] Fix background tasks
    emawby committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    cc22dee View commit details
    Browse the repository at this point in the history
  9. Merge pull request #1294 from OneSignal/user_model/fix_in_app_display

    [User model] Fix in app display
    emawby committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    c2a9be3 View commit details
    Browse the repository at this point in the history
  10. Merge pull request #1290 from OneSignal/5.0.0/create_user_error

    [5.0.0] Allow the SDK the chance to recover from failed Create User
    emawby committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    be65c89 View commit details
    Browse the repository at this point in the history
  11. [nits] rename Background Task Delegate to Handler

    * Rename `OSBackgroundTaskManagerDelegate` -> `OSBackgroundTaskHandler` because it is not truly a delegate, but is a concrete implementation that is injected
    nan-li committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    1c8f185 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    bef92f7 View commit details
    Browse the repository at this point in the history