refactor(folio): build AppGraph from platform entry points

MainActivity (Android) and MainViewController (iOS) now own the
suspend DriverFactory.create() and feed the resulting LedgerDatabase
into Metro's createGraphFactory<AppGraph.Factory>().
This commit is contained in:
pj committed 2026-04-26 16:05:58 +07:00
1 parent 02f28aeac1
commit 85e7d7ad48
2 files changed
+14 -2

No files matched your search

@@ -2,7 +2,10 @@ package app.folio
import androidx.compose.ui.window.ComposeUIViewController
import app.folio.core.data.DriverFactory
import app.folio.db.LedgerDatabase
import app.folio.di.AppGraph
import app.folio.ui.IosBackGesture
import dev.zacsweers.metro.createGraphFactory
import kotlinx.cinterop.BetaInteropApi
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.ObjCAction
@@ -28,7 +31,10 @@ private val backGestureTarget = BackGestureTarget()
@OptIn(ExperimentalForeignApi::class)
fun MainViewController(): UIViewController {
val driverFactory = DriverFactory()
val vc = ComposeUIViewController { App(driverFactory) }
val graphFactory = createGraphFactory<AppGraph.Factory>()
val vc = ComposeUIViewController {
App(graphBuilder = { graphFactory.create(LedgerDatabase(driverFactory.create())) })
}
val gesture = UIScreenEdgePanGestureRecognizer(
target = backGestureTarget,
action = NSSelectorFromString("handleGesture:"),