Offline Data Support
Feature Detail
Description
Offline Data Support provides the mobile app with an encrypted local database layer that persists all operational data on-device, enabling peer mentors and coordinators to continue working without an active network connection. The system uses Drift with SQLCipher for encrypted local storage, a mutation outbox that queues writes made offline, a conflict resolver for handling concurrent edits, and an ID-mapping layer that reconciles temporary offline-created entity IDs with server-assigned IDs once connectivity returns. Optimistic mutations allow UI updates to appear instant while the outbox retries delivery with exponential backoff, and failed mutations are automatically rolled back to keep local state consistent with server truth.
Sources & reasoning
Lines 300-304 describe the offline-first architecture explicitly with Drift+SQLCipher, mutation outbox, conflict resolver, and optimistic mutations - these are the precise capabilities this feature implements. Line 185 confirms Drift as the chosen technology. The blueprint assigns MVP, consistent with the source doc's framing of offline-first as a core architectural pattern, not an optional add-on, and the priority matrix placing activity registration as a MUST HAVE in Phase 1.
-
docs/source/likeperson.md · line 185Tech: Flutter, Riverpod (no codegen), Drift (offline), WCAG 2.2 AA
-
docs/source/likeperson.md · line 300-304Offline-first persistence (Drift + SQLCipher encrypted local DB, mutation outbox, sync queue with retry/backoff, ID mapping for offline-created entities, conflict resolver) - Optimistic mutations with automatic rollback on failure (contact edits and
Analysis
Peer mentors often conduct home visits and activities in locations with poor or absent connectivity. Without offline support the entire activity-registration flow - the platform's single highest-priority capability - would be unusable in the field, directly undermining Bufdir reporting completeness. The encrypted local store also satisfies GDPR and data minimisation obligations for sensitive contact and assignment data held on personal devices. Because all four organisations explicitly prioritised low-friction registration, any dependency on network availability would introduce friction that drives the underreporting the platform is designed to eliminate. Offline-first is therefore a prerequisite for the platform's core value proposition, not a quality-of-life enhancement.
Built on Drift (type-safe SQLite ORM for Flutter) with SQLCipher for AES-256 at-rest encryption. The mutation outbox is a local queue table that records every write operation with its payload and retry count; a background isolate drains it when connectivity is detected. Conflict resolution follows a last-write-wins strategy at the field level, with coordinator-initiated overrides surfaced via a UI flag. The ID-mapping table links client-generated UUIDs to server IDs returned on first successful sync, transparently rewriting references in dependent records. Riverpod state notifiers expose optimistic-mutation APIs; the rollback path restores previous state from a snapshot held in memory before the mutation was applied. SQLCipher key derivation uses the platform secure store (Keychain on iOS, Keystore on Android).
Components (8)
Shared Components
These components are reused across multiple features
User Stories
No user stories have been generated for this feature yet.