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

Fix pre-existing notification delegate #926

Merged
merged 8 commits into from
May 18, 2021

Commits on May 12, 2021

  1. Fixed swizzling test to not create side effects

    * Issue was that the DummyNotificationCenterDelegate was going out of
    scope and getting removed.
       - This created an issue where OneSignal swizzling was no longer
       wroking, which broke any notification open tests.
    jkasten2 committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e3ebcec View commit details
    Browse the repository at this point in the history

Commits on May 13, 2021

  1. mv swizzling of delegate into its own method

    * Moved swizzling logic in setOneSignalUNDelegate into
    swizzleSelectorsOnDelegate
       - No logic changes just a move.
    * This cleans up code a bit and also makes it more testable.
    jkasten2 committed May 13, 2021
    Configuration menu
    Copy the full SHA
    45b4c1b View commit details
    Browse the repository at this point in the history
  2. Added restoreDelegateAsOneSignal

    * Added this method on a new helper to undo swizzling in test
    * This way there is zero carry over side-effects on other tests
    jkasten2 committed May 13, 2021
    Configuration menu
    Copy the full SHA
    8735eda View commit details
    Browse the repository at this point in the history
  3. mv testAUNUserNotificationCenterDelegateAssigningDoesSwizzle

    * Moved this test into it's own testing file.
       - We will be adding more swizzling tests in (a) up comming commit(s)
    jkasten2 committed May 13, 2021
    Configuration menu
    Copy the full SHA
    b2869cb View commit details
    Browse the repository at this point in the history
  4. mv registerAsUNNotificationCenterDelegate

    * Moved registerAsUNNotificationCenterDelegate out of OneSignalHelper
    and into OneSignalUNUserNotificationCenter
       - This better encapsulates this logic
    * Added a new setup method that OneSignal class.
       - Before OneSignal had to call two methods which as client
       shouldn't have to know or care about it at that level.
    jkasten2 committed May 13, 2021
    Configuration menu
    Copy the full SHA
    8d3d779 View commit details
    Browse the repository at this point in the history
  5. Failing test of pre-existing delegate issue

    * OneSignal is normally loaded into memory and it performs swizzling
    before any code is exlcude as it happens in +load.
    This is not always the case however so this simulates so other
    code winning the setDelegate race.
    * Added putIntoPreloadedState helper to simulate OneSignal class
    not being loaded into memory yet.
    jkasten2 committed May 13, 2021
    Configuration menu
    Copy the full SHA
    fd084ff View commit details
    Browse the repository at this point in the history
  6. Fixed Pre-existing Notification Delegate

    * This happens when another library's delegate is
    loaded before OneSignal's delegate code.
    * This commit solves it by reassigning the pre loaded
    delegate to swizzle in OneSignal's logic
    jkasten2 committed May 13, 2021
    Configuration menu
    Copy the full SHA
    14c11ba View commit details
    Browse the repository at this point in the history
  7. Improved registerDelegate comment

    * Updated the comment to better fit what we added in the else
    statement from our last commit.
    jkasten2 committed May 13, 2021
    Configuration menu
    Copy the full SHA
    a2322e7 View commit details
    Browse the repository at this point in the history