Athena — roomy-mobile/archive/changes/2026-01-05-fix-notification-permissions/tasks/002-update-preferences-dto.md


skill-level: junior status: done

Task: Update NotificationPreferencesDto with osPermissionGranted Field

End Goal

NotificationPreferencesDto has a nullable osPermissionGranted field to track whether the user has ever made a permission decision.

Currently

  • DTO has globalEnabled, shoppingEnabled, cleaningEnabled fields
  • No tracking of whether user has interacted with OS permission dialog

Should

  • New osPermissionGranted: bool? field added
  • null = undetermined (never asked)
  • true = user granted at some point
  • false = user denied at some point
  • Field included in JSON serialization
  • copyWith updated to support the new field
  • UpdateNotificationPreferencesRequest updated to include field

Constraints

  • [ ] Field must be nullable (null indicates undetermined)
  • [ ] Existing documents without field must default to null
  • [ ] Must regenerate JSON serialization code

Acceptance Criteria

  • [ ] osPermissionGranted field exists and is nullable
  • [ ] Existing Firestore documents work (missing field = null)
  • [ ] copyWith includes osPermissionGranted parameter
  • [ ] UpdateNotificationPreferencesRequest can update the field
  • [ ] JSON serialization/deserialization works correctly

Implementation Checklist

  • [x] 2.1 Add osPermissionGranted: bool? field to NotificationPreferencesDto
  • [x] 2.2 Add @JsonKey(defaultValue: null) annotation
  • [x] 2.3 Update constructor to include osPermissionGranted
  • [x] 2.4 Update create factory to set osPermissionGranted: null
  • [x] 2.5 Update copyWith method to include osPermissionGranted
  • [x] 2.6 Add osPermissionGranted: bool? to UpdateNotificationPreferencesRequest
  • [x] 2.7 Run ./scripts/run_build_generator.sh to regenerate
  • [x] 2.8 Run flutter analyze to verify no issues

Notes

  • The nullable field allows distinguishing "never asked" from "denied"
  • This is critical for showing/hiding the home banner correctly

Reacties

Nog geen reacties