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

[Bug] Some pending properties can be sent to new user incorrectly, when users change #1418

Merged
merged 13 commits into from
Apr 30, 2024

Commits on Apr 29, 2024

  1. remove properties model reference from Update User request

    * We don't need the reference to the property model for an Update User request, and this reference has gone unused so far
    * We don't hydrate from the response as the response is not the full user, just the property that was updated.
    * The request still has a reference to the identity model it is operating on
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    c2be80a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f062013 View commit details
    Browse the repository at this point in the history
  3. [tests] add waiting for background threads to run

    * OneSignalCoreMocks now has XCTest dependency
    * It uses a waiter to allow the test to wait for any async calls to run, because we don't have control over all threads. For example, a test may need to wait for operation repo to run everything in the dispatch queue
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    f9ce88e View commit details
    Browse the repository at this point in the history
  4. [tests] add some user mocking

    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    7ab2abe View commit details
    Browse the repository at this point in the history
  5. [tests] extend NSDictionary for testing

    * We will need to know if a particular payload exists in a dictionary to confirm what requests are sending
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    9caff5c View commit details
    Browse the repository at this point in the history
  6. [tests] add assert helpers to Mock Client

    * Adds additional property to track if all requests have been handled by mock responses set
    * Adds method to use in asserts to confirm if there is only one executed request that contains the payload provided, and the url matches the path provided.f
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    f235b8b View commit details
    Browse the repository at this point in the history
  7. [tests] update schemes for testing

    * Change OneSignalUserTests build configs to "Test"
    * Add OS_TEST preprocessor macro (Test) to OneSignalOSCore which is needed for the reduced flush interval
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    bde68d1 View commit details
    Browse the repository at this point in the history
  8. [tests] Add test for switching users with adding tags

    * Starts with anon user, log into 2 users via Identify User and Create User
    * Add tags to each user
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    b89b243 View commit details
    Browse the repository at this point in the history
  9. Add Identity Model ID to Deltas to track which user

    * The model on a Delta for property change is the properties model. However, the identity is needed to send the request.
    * We have been setting the identity model as the current user's when these Deltas become Requests.
    * However, the timing can be buggy when we flush Deltas when users change. The Operation Repo and Property Executor use a dispatch queue so by the time the request is made, the user may have changed.
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    88e31f5 View commit details
    Browse the repository at this point in the history
  10. Have an Identity Model Repo for models still being used

    * Introduce OSIdentityModelRepo managed by the User Manager where a dictionary of identity models live
    * This will hold identity models added when users change
    * When requests are uncached, their identity models will also be added as they are still being used.
    * This is a lightweight option over modifying the Identity Model Store (which is an option if we wish to use the model store to manage all identity models)
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    f9cf364 View commit details
    Browse the repository at this point in the history
  11. Uncaching in executors will use the Identity Model Repo

    * When Requests are uncached in the executors, hook them up to the same identity model instance via the Identity Model Repo
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    a0df196 View commit details
    Browse the repository at this point in the history
  12. [nits] ran swiftlint

    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    975076e View commit details
    Browse the repository at this point in the history
  13. [tests] add more to reset User Manager state between tests

    * Also move its reset methods into an extension
    nan-li committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    ef9d2c6 View commit details
    Browse the repository at this point in the history