Registration Defaults Manager
Component Detail
Description
Computes and provides pre-filled default values for the wizard, combining today's date and 30-minute duration constants with the last-used activity type retrieved from local preferences. Acts as a single source of truth for the 'zero-interaction happy path' that makes the feature feel like a check-in.
registration-defaults-manager
Summaries
The Registration Defaults Manager is a small but high-impact component that dramatically reduces the friction of logging an activity. By pre-filling today's date, a standard 30-minute duration, and the user's last-used activity type, it enables a one-tap check-in experience for users who perform the same activity regularly. Reducing required interactions increases daily engagement with the platform, which directly improves the quality and completeness of activity data used for performance reporting and compensation calculations. Higher data completeness reduces administrative overhead from manual corrections and improves employee trust in the accuracy of their records.
Registration Defaults Manager is a low-complexity component with a single dependency on the Registration Preferences Store, making it one of the earliest deliverables in the feature track. It can be built and unit-tested independently before the wizard UI or submission service are complete, which makes it a good candidate for early sprint inclusion to unblock Cubit initialisation work. The primary delivery risk is ensuring the async getLastUsedActivityType() call resolves within an acceptable latency budget on first app launch when preferences may be empty — a null-safe fallback must be defined. No server-side deployment is required; this component is entirely client-side and local-storage backed.
Registration Defaults Manager is a mobile-tier service component that acts as the initialisation source for the activity registration Cubit. getDefaults() is the primary entry point, returning a merged RegistrationDefaults object composed from three sources: getDefaultDate() (returns DateTime.now()), getDefaultDurationMinutes() (returns the constant 30), and getLastUsedActivityType() which performs an async read from RegistrationPreferencesStore. The async boundary is isolated to the activity-type lookup; callers should await getDefaults() once at Cubit init and cache the result for the session. When RegistrationPreferencesStore returns null (first-run scenario), the component must return a sensible fallback — likely the most common ActivityType or null with UI prompting user selection.
Depends on the activity-type data model for type-safety of the returned defaults object.
Responsibilities
- Return today's date as the default registration date
- Return 30 minutes as the default duration
- Load the last-used activity type from local preferences
- Provide a merged defaults object for Cubit initialisation
Interfaces
getDefaults() -> Future<RegistrationDefaults>
getDefaultDate() -> DateTime
getDefaultDurationMinutes() -> int
getLastUsedActivityType() -> Future<ActivityType?>
Relationships
Related Data Entities (1)
Data entities managed by this component