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

Poll for notification permission changes #2112

Merged
merged 7 commits into from
Jun 14, 2024

Commits on Jun 13, 2024

  1. Poll for the permission status every second

    We will track the permission state as enabled
    and fire the handler when the state changes
    Use a constant from the ConfigModel to control the permission polling interval
    emawby committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    b74049b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7b71e1e View commit details
    Browse the repository at this point in the history
  3. have background polling interval set to 1 day to effectively pause it

    Use a waiter instead of waiterWithValue
    emawby committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    daae10b View commit details
    Browse the repository at this point in the history
  4. Create NotificationPermissionControllerTests

    Adding an initial test for the polling behavior
    Adding mocking for setting notifications as enabled/disabled in ShadowRoboNotificationManager
    Adding foregroundFetchNotificationPermissionInterval to the MockHelper configModel with a value of 1 ms
    emawby committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    4ee0250 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8feeda8 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2024

  1. Start with polling interval as the background value

    This protects init in the background
    onFocus is called immediately if the app is in focus and wakes so we start polling correctly
    
    update unit test to account for this
    emawby committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    4cb7cb1 View commit details
    Browse the repository at this point in the history
  2. mock notificationsEnabled so that it can be reset between tests

    set delay to be 100 ms to fix flakiness
    emawby committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    99d3094 View commit details
    Browse the repository at this point in the history