skill-level: medior
status: done
Task: Update Notification Settings View with Permission State
End Goal
Notification Settings view shows disabled state with "Open Settings" button when OS permission is denied.
Currently
- Toggles reflect Firestore preferences only
- No awareness of OS permission status
- User can enable toggle but notifications won't arrive if OS denied
Should
- When OS permission DENIED:
- Global toggle is disabled (cannot interact)
- Info message explains permission is required
- "Open Settings" button displayed
- Category toggles also disabled
- When OS permission GRANTED:
- Toggles work as before
- Sync with Firestore preferences
- When OS permission UNDETERMINED:
- Request permission when global toggle is turned on
- Then proceed with normal toggle behavior
Constraints
- [ ] Use
NotificationPermissionService for status checks
- [ ] Use existing toggle components
- [ ] Info message and button styled consistently with app
- [ ] Opening Settings uses
NotificationPermissionService.openAppSettings()
Acceptance Criteria
- [ ] Denied state shows disabled toggle + info + Open Settings button
- [ ] Open Settings button launches system Settings
- [ ] Granted state allows normal toggle interaction
- [ ] Undetermined state requests permission on toggle enable
- [ ] Toggle state reflects OS permission accurately
Implementation Checklist
- [x] 7.1 Add
NotificationPermissionService dependency to NotificationSettingsViewModel
- [x] 7.2 Add
permissionStatus informer (Informer)
- [x] 7.3 Check permission status in
initialise()
- [x] 7.4 Add
isPermissionDenied getter
- [x] 7.5 Add
isPermissionUndetermined getter
- [x] 7.6 Modify
onGlobalEnabledChanged() to request permission if undetermined
- [x] 7.7 Add
onOpenSettingsPressed() method
- [x] 7.8 Update view to show disabled state when denied
- [x] 7.9 Add info text widget explaining permission is needed
- [x] 7.10 Add "Open Settings" button below info text
- [x] 7.11 Add localized strings for info text and button
- [x] 7.12 Run
flutter analyze to verify no issues
Notes
- The view should refresh permission status when returning from Settings
- Consider using
WidgetsBindingObserver to detect app resume
Reacties