From 4bc8da8ee119de36cc021b3a7270f78f4571a1d3 Mon Sep 17 00:00:00 2001 From: PJ Date: Sun, 26 Apr 2026 15:56:15 +0700 Subject: [PATCH] feat(folio-core): annotate Repository and SqlLedgerStore with @Inject --- .../src/commonMain/kotlin/app/folio/core/data/Repository.kt | 2 ++ .../src/commonMain/kotlin/app/folio/core/data/SqlLedgerStore.kt | 2 ++ 2 files changed, 4 insertions(+) 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)