Persist Cognitive Accessibility Preferences Across Sessions
AccessibilityPreferencesRepository persists the cognitive mode flag, font scale, and contrast theme as a per-user record in the Supabase backend. CognitiveModeService reads this record on app startup before the first screen renders, ensuring the simplified layout is applied from the very first screen the user sees. Settings are synchronized across devices if the same user signs in on a different phone.
User Story
As a
user
I want
my cognitive accessibility settings to be saved to my profile and automatically restored every time I open the app
So that
So that I do not need to re-configure accessibility settings on every session, which would itself be a cognitively demanding task that undermines the purpose of the feature
Acceptance Criteria
- Given a user has enabled cognitive mode and then fully closes and reopens the app, when the app initializes, then cognitive mode is active before the home screen renders
- Given a user signs in on a second device, when their preferences load from the backend, then cognitive mode state is consistent with what they set on their primary device
- Given a user disables cognitive mode and closes the app, when they reopen it, then cognitive mode is inactive and the standard layout is shown
- Given the Supabase backend is temporarily unreachable at app startup, when preferences cannot be fetched, then the app defaults to the last locally cached preference value rather than falling back to standard mode without warning
- Given a new user with no saved preferences, when they first open the app, then cognitive mode is disabled by default and they are not prompted to enable it on every launch
Business Value
Cognitive accessibility features are only effective if they are reliably applied. Requiring users to reconfigure settings on each session is itself a cognitive burden that invalidates the feature for its intended audience — stroke patients and users with memory impairments who are most in need of a persistent simplified layout.
Components
- Accessibility Preferences Repository data
- Cognitive Mode Service service
- Supabase Client Service service
- Preferences Service service