Moved setting BankingRepository to App()

This commit is contained in:
dankito 2024-09-20 00:35:37 +02:00
parent 1f19da85f3
commit 7ce76d73ea
4 changed files with 6 additions and 7 deletions

View File

@ -21,8 +21,6 @@ class MainActivity : FragmentActivity() {
ImageService.context = this.applicationContext
AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this)
DI.setRepository(SqliteBankingRepository())
setContent {
App()
}

View File

@ -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)

View File

@ -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()
}
}

View File

@ -5,7 +5,5 @@ import net.codinux.banking.persistence.SqliteBankingRepository
import net.codinux.banking.ui.config.DI
fun MainViewController() = ComposeUIViewController {
DI.setRepository(SqliteBankingRepository())
App()
}