Active Role State Repository
Component Detail
Data Layer
low complexity
mobile
0
Dependencies
2
Dependents
1
Entities
0
Integrations
Description
Persists the selected active role and organizational context across app sessions using secure device storage (Keychain on iOS, Keystore on Android). Exposes a reactive stream of role context changes so BLoC/Riverpod listeners can update navigation and data-scoping providers automatically on switch or app restart.
active-role-state-repository
Responsibilities
- Write the selected UserRoleContext (role slug, org ID, association ID) to secure local storage
- Restore the persisted role context on app startup before any authenticated navigation
- Expose a Stream<UserRoleContext?> for reactive listeners across the app
- Clear persisted role context on logout
Interfaces
saveActiveRoleContext(UserRoleContext context) → Future<void>
loadActiveRoleContext() → Future<UserRoleContext?>
clearActiveRoleContext() → Future<void>
watchActiveRoleContext() → Stream<UserRoleContext?>
Relationships
Dependents (2)
Components that depend on this component