diff --git a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt index 06c90af..b444e8f 100644 --- a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt +++ b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/MainActivity.kt @@ -21,8 +21,6 @@ class MainActivity : FragmentActivity() { ImageService.context = this.applicationContext AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this) - DI.setRepository(SqliteBankingRepository()) - setContent { App() } diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt index 98870fc..c99509d 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt @@ -7,6 +7,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.sp import kotlinx.coroutines.launch +import net.codinux.banking.persistence.BankingRepository +import net.codinux.banking.persistence.SqliteBankingRepository import net.codinux.banking.ui.config.Colors import net.codinux.banking.ui.config.DI import net.codinux.banking.ui.model.settings.AppAuthenticationMethod @@ -21,9 +23,12 @@ private val typography = Typography( @Composable @Preview -fun App() { +fun App(repository: BankingRepository? = null) { LoggerFactory.defaultLoggerName = "net.codinux.banking.ui.Bankmeister" + DI.setRepository(repository ?: SqliteBankingRepository()) + + val colors = MaterialTheme.colors.copy(primary = Colors.Primary, primaryVariant = Colors.PrimaryDark, onPrimary = Color.White, secondary = Colors.Accent, secondaryVariant = Colors.Accent, onSecondary = Color.White) diff --git a/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/main.kt b/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/main.kt index 608dedd..c7f34ff 100644 --- a/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/main.kt +++ b/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/main.kt @@ -23,8 +23,6 @@ fun main() = application { icon = painterResource(Res.drawable.AppIcon_svg), state = WindowState(position = WindowPosition(Alignment.Center), size = DpSize(1000.dp, 800.dp)), ) { - DI.setRepository(SqliteBankingRepository()) - App() } } diff --git a/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/MainViewController.kt b/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/MainViewController.kt index 42015bb..9fb10f2 100644 --- a/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/MainViewController.kt +++ b/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/MainViewController.kt @@ -5,7 +5,5 @@ import net.codinux.banking.persistence.SqliteBankingRepository import net.codinux.banking.ui.config.DI fun MainViewController() = ComposeUIViewController { - DI.setRepository(SqliteBankingRepository()) - App() } \ No newline at end of file