Offline Terminology Cache Ensures Consistent Labels Without Connectivity
Peer mentors from Blindeforbundet conduct home visits in all regions of Norway, often with intermittent connectivity. The TerminologyCacheAdapter persists the most recently synced label configuration to local storage, providing immediate offline access. The TerminologyRepository's offline read path ensures the Riverpod providers always have a valid label map to expose, so the TerminologyAwareTextWidget renders correctly regardless of network state. The cache is invalidated and refreshed on the next successful sync.
User Story
Acceptance Criteria
- Given a peer mentor's device has no internet connection, When they open the app, Then all terminology labels render from the local cache with no errors or placeholders
- Given the app was previously used with connectivity and terminology was synced, When the peer mentor goes offline and registers an activity, Then all form labels, button text, and navigation items use the cached organization terminology
- Given the device regains connectivity, When the TerminologySyncService detects the connection, Then it automatically refreshes the terminology cache in the background without interrupting the user
- Given the cached terminology is stale by more than 7 days, When the app next has connectivity, Then a background sync is triggered with elevated priority to refresh the configuration
- Given the cache read fails due to a storage error, When the app initializes, Then a safe fallback to default labels is applied and an error is logged without user-facing disruption
Business Value
Blindeforbundet peer mentors conduct home visits in geographically dispersed areas across large Norwegian counties where connectivity is unreliable. HLF peer mentors similarly operate in community settings. A reliable offline cache for terminology labels ensures volunteers are never presented with broken or confusing UI during the critical moments of documenting peer support work, maintaining trust in the application.
Components
- Terminology Local Cache Adapter data
- Terminology Repository data
- Terminology Sync Service service
- Terminology Riverpod Providers infrastructure
- Organization Labels Notifier service
- Terminology-Aware Text Widget ui