Jetpack
Domain model representing a Jetpack library item in the application's data layer.
This is the core domain model used throughout the app for representing Jetpack library entries. It sits between the database layer (JetpackEntity) and the remote layer (FirebaseJetpack), serving as the single source of truth that the UI layer observes.
The model supports offline-first architecture with sync tracking:
lastUpdated: Timestamp when the item was modified locally
lastSynced: Timestamp of the last successful sync with Firebase
needsSync: Flag indicating if local changes need to be pushed to Firebase
Mapping extensions are provided to convert between layers:
toJetpackEntity: Convert to Room database entity for local storage
toFirebaseJetpack: Convert to Firebase document for remote storage
JetpackEntity.toJetpack: Convert from Room entity to domain model
FirebaseJetpack.toJetpackEntity: Convert from Firebase to Room entity
Usage context:
UI layer displays lists and details of Jetpack items via dev.atick.feature.home.ui.home.HomeViewModel
Repository returns Flow
> as the single source of truth ViewModel wraps Jetpack data in dev.atick.feature.home.ui.home.HomeScreenData
Background sync uses needsSync flag to identify items requiring upload
Parameters
Unique identifier (UUID) for the Jetpack item, consistent across all layers.
Display name of the Jetpack library (e.g., "Compose", "Room", "Hilt").
Numeric value representing the item's price (demo field for CRUD operations).
Unix timestamp (milliseconds) of the last local modification.
Unix timestamp (milliseconds) of the last successful Firebase sync.
Boolean flag indicating if local changes haven't been synced to Firebase.
Human-readable date string derived from lastUpdated for UI display.
See also
Room database entity representing local storage
Firestore document representing remote storage
Repository providing Jetpack operations
ViewModel consuming Jetpack data
Constructors
Functions
Extension function to map a Jetpack to a FirebaseJetpack.
Extension function to map a Jetpack to a JetpackEntity.