:firebase:firestore
Purpose: The remote sync target for :data's offline-first home feature — read/write access to a per-user Firestore collection.
Key APIs
| API | What it does |
|---|---|
FirebaseDataSource / FirebaseDataSourceImpl | pullJetpacks(userId, syncedAfterNanos), createOrUpdateJetpack, deleteJetpack against /dev.atick.jetpack/{userId}/jetpacks/{jetpackId} |
FirebaseJetpack | 8-field remote model (id, name, price, userId, lastUpdated, lastSynced, serverUpdatedAt, deleted) validated by the example rules linked below when deployed |
serverUpdatedAtNanos() | Reads serverUpdatedAt as nanoseconds since the epoch — the pull cursor :data stores |
// firebase/firestore/src/main/kotlin/dev/atick/firebase/firestore/model/FirebaseJetpack.kt
@get:ServerTimestamp
var serverUpdatedAt: Timestamp? = nullGotchas
Current Home screens observe Room through
HomeRepository; that repository calls this source during synchronization. No current screen queries Firestore directly.The repository upload mapping leaves
serverUpdatedAtasnull: Firestore substitutes its timestamp for a null@ServerTimestampproperty, and that server clock — neverlastUpdated, which belongs to the writing device — is what orderspullJetpacks. See Data Layer.It is not a constructor parameter, so
:datanever needscom.google.firebase.Timestampon its compile classpath. This module declares the SDK withimplementation, notapi, and moving the property into the constructor would break that boundary.Rule rejection fails the remote operation during sync; the worker logs errors and may retry. A successful local repository write does not establish remote acceptance.
Pull uses default-source
get()and a strict server-timestamp filter. Cached results do not establish server completeness; missing timestamp fields are excluded, and equal-timestamp interruption can skip records. Remote hard deletes supply no deletion feed. See delivery limitations and upgrade requirements.
Related Documentation
Firebase Setup § Firestore Security Rules — the full rule set and field validation
Data Layer — the two-way sync algorithm this module participates in