:data

Purpose: Repository implementations that sit between ViewModels and storage/auth sources: Room, JSON DataStore, Firebase Auth and Firestore, with an optional REST source available for extensions. Observable data uses Flow; one-time operations return Result<T>.

Key APIs

APIWhat it does
HomeRepository / HomeRepositoryImplOffline-first repo for Jetpack — Room is the only thing read by the UI, Firestore is a sync target only, implements Syncable
AuthRepository / AuthRepositoryImplSaved-credential, email/password and Google authentication; successful auth updates local profile preferences
ProfileRepositoryImpl, SettingsRepositoryImplLocal-only repos — DataStore (+ Firebase Auth for sign-out), no Room, no sync
SyncManager, Syncable, SyncProgress (utils/SyncUtils.kt)Scheduler interface (SyncManager), repository contract (Syncable), and progress model; :sync implements the manager, HomeRepositoryImpl implements Syncable
RepositoryModuleOne @Binds per repository, @Singleton

Interface excerpt; the inherited sync() contract is defined by Syncable.

// data/src/main/kotlin/dev/atick/data/repository/home/HomeRepository.kt
interface HomeRepository : Syncable {
fun getJetpacks(): Flow<List<Jetpack>>
fun getJetpack(id: String): Flow<Jetpack>
suspend fun createOrUpdateJetpack(jetpack: Jetpack): Result<Unit>
suspend fun markJetpackAsDeleted(jetpack: Jetpack): Result<Unit>
}

Gotchas

  • HomeRepositoryImpl.sync() returns a cold progress flow; collection executes the push/pull. SyncWorker in :sync collects it. Calling the suspend method alone does not execute the phases.

  • SyncAction (core/room) is NONE, UPSERT, DELETE. There is no CREATE/UPDATE.

  • Home writes update Room before requesting work. Local persistence/requesting work can fail; a successful Result does not acknowledge remote delivery. A failed enqueue can leave a local change committed. See repository behavior.

  • Sync takes one pending snapshot, then pushes and pulls. It does not protect concurrent edits or guarantee a follow-up pass after a dropped request. See delivery limitations.

Related Documentation

Packages

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard