Athena — roomy-mobile/archive/changes/2026-01-05-fix-notification-permissions/specs/notification-preferences/spec.md

ADDED Requirements

Requirement: Notification Preferences Storage

The system SHALL store per-user notification preferences in Firestore, including OS permission decision history.

Scenario: Default preferences on first access

  • GIVEN a user has not configured notification preferences
  • WHEN their preferences are read
  • THEN all notification categories SHALL default to enabled
  • AND osPermissionGranted SHALL be null (undetermined)

Scenario: Preference persistence

  • GIVEN a user updates their notification preferences
  • WHEN the update is saved
  • THEN the preferences SHALL be persisted to Firestore
  • AND subsequent reads SHALL return the updated values

Scenario: OS permission decision tracking

  • GIVEN a user grants or denies OS notification permission
  • WHEN the permission dialog completes
  • THEN osPermissionGranted SHALL be set to true or false accordingly
  • AND globalEnabled SHALL be updated to match the OS permission state

Requirement: Notification Preferences UI

The system SHALL provide a settings interface for managing notification preferences with OS permission awareness.

Scenario: Access notification settings with permission granted

  • GIVEN a user has granted OS notification permission
  • WHEN they navigate to notification settings
  • THEN they SHALL see toggles for each notification category
  • AND toggles SHALL reflect Firestore preference state

Scenario: Access notification settings with permission denied

  • GIVEN a user has denied OS notification permission
  • WHEN they navigate to notification settings
  • THEN the global toggle SHALL be disabled
  • AND an info message SHALL explain that permission is required
  • AND an "Open Settings" button SHALL be displayed

Scenario: Open Settings button action

  • GIVEN a user is on notification settings with OS permission denied
  • WHEN they tap the "Open Settings" button
  • THEN the system Settings app SHALL open to the app's notification settings

Scenario: Toggle state synchronized with OS permission

  • GIVEN a user views notification settings
  • WHEN OS permission status changes externally (via system Settings)
  • THEN the toggle state SHALL update on next view load to match OS state

Requirement: Notification Permission Consent Flow

The system SHALL prompt users to grant notification permission through a consent flow on the home screen.

Scenario: Banner display for undetermined permission

  • GIVEN a user has never been asked for notification permission
  • WHEN they view the home screen
  • THEN a CTA banner SHALL be displayed
  • AND the banner SHALL include promotional copy about notifications

Scenario: Banner hidden for determined permission

  • GIVEN a user has previously granted or denied notification permission
  • WHEN they view the home screen
  • THEN the CTA banner SHALL NOT be displayed

Scenario: Banner tap opens consent sheet

  • GIVEN the notification CTA banner is displayed
  • WHEN the user taps the banner
  • THEN a consent bottom sheet SHALL be presented
  • AND the sheet SHALL contain artwork, Cancel button (outline), and Accept button (primary)

Scenario: Accept triggers permission request

  • GIVEN the consent bottom sheet is displayed
  • WHEN the user taps Accept
  • THEN the OS permission dialog SHALL be triggered immediately

Scenario: Permission granted flow

  • GIVEN the user taps Accept and grants OS permission
  • WHEN the permission is granted
  • THEN a success toast SHALL be shown
  • AND the bottom sheet SHALL close
  • AND the CTA banner SHALL be hidden

Scenario: Permission denied flow

  • GIVEN the user taps Accept and denies OS permission
  • WHEN the permission is denied
  • THEN a denied toast SHALL be shown
  • AND the bottom sheet SHALL close

Scenario: Cancel dismisses sheet

  • GIVEN the consent bottom sheet is displayed
  • WHEN the user taps Cancel or swipes to dismiss
  • THEN the sheet SHALL close
  • AND the CTA banner SHALL remain visible

Requirement: OS Permission Sync on App Startup

The system SHALL synchronize Firestore preferences with OS permission status on app startup.

Scenario: Permission revoked externally

  • GIVEN a user previously granted OS permission (osPermissionGranted is true)
  • AND they revoke permission via system Settings
  • WHEN the app starts
  • THEN globalEnabled SHALL be updated to false in Firestore

Scenario: Permission granted externally

  • GIVEN a user previously denied OS permission (osPermissionGranted is false)
  • AND they grant permission via system Settings
  • WHEN the app starts
  • THEN globalEnabled SHALL be updated to true in Firestore

Scenario: Undetermined permission skipped

  • GIVEN a user has never been asked for permission (osPermissionGranted is null)
  • WHEN the app starts
  • THEN no sync SHALL occur
  • AND globalEnabled SHALL remain at its default value

Requirement: Notification Permission Analytics

The system SHALL track analytics events for the notification permission flow.

Scenario: Banner impression tracked

  • GIVEN the notification CTA banner is displayed
  • WHEN the banner becomes visible
  • THEN a notification_banner_shown event SHALL be logged

Scenario: Banner tap tracked

  • GIVEN a user taps the notification CTA banner
  • WHEN the tap occurs
  • THEN a notification_banner_tapped event SHALL be logged

Scenario: Consent sheet impression tracked

  • GIVEN the consent bottom sheet is displayed
  • WHEN the sheet becomes visible
  • THEN a notification_consent_sheet_shown event SHALL be logged

Scenario: Accept action tracked

  • GIVEN a user taps Accept in the consent sheet
  • WHEN the tap occurs
  • THEN a notification_consent_accepted event SHALL be logged

Scenario: Cancel action tracked

  • GIVEN a user taps Cancel or dismisses the consent sheet
  • WHEN the dismissal occurs
  • THEN a notification_consent_cancelled event SHALL be logged

Scenario: Permission granted tracked

  • GIVEN a user grants OS notification permission
  • WHEN the grant is confirmed
  • THEN a notification_permission_granted event SHALL be logged

Scenario: Permission denied tracked

  • GIVEN a user denies OS notification permission
  • WHEN the denial is confirmed
  • THEN a notification_permission_denied event SHALL be logged

Reacties

Nog geen reacties