diff --git a/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/Repository.kt b/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/Repository.kt index 4a0fb1a..5c0a3d4 100644 --- a/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/Repository.kt +++ b/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/Repository.kt @@ -1,8 +1,10 @@ package app.folio.core.data import app.folio.core.platform.Platform +import dev.zacsweers.metro.Inject import kotlinx.coroutines.flow.StateFlow +@Inject class Repository(private val store: LedgerStore) { val accounts: StateFlow> = store.accounts val transactions: StateFlow> = store.transactions diff --git a/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/SqlLedgerStore.kt b/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/SqlLedgerStore.kt index 7f0fe4d..9fab65f 100644 --- a/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/SqlLedgerStore.kt +++ b/examples/folio/core/src/commonMain/kotlin/app/folio/core/data/SqlLedgerStore.kt @@ -5,6 +5,7 @@ import app.cash.sqldelight.coroutines.asFlow import app.cash.sqldelight.coroutines.mapToList import app.cash.sqldelight.coroutines.mapToOneOrNull import app.folio.db.LedgerDatabase +import dev.zacsweers.metro.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob @@ -13,6 +14,7 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn +@Inject class SqlLedgerStore(db: LedgerDatabase) : LedgerStore { private val queries = db.ledgerQueries private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)