Moved setting BankingRepository to App()
This commit is contained in:
parent
1f19da85f3
commit
7ce76d73ea
|
@ -21,8 +21,6 @@ class MainActivity : FragmentActivity() {
|
||||||
ImageService.context = this.applicationContext
|
ImageService.context = this.applicationContext
|
||||||
AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this)
|
AuthenticationService.biometricAuthenticationService = BiometricAuthenticationService(this)
|
||||||
|
|
||||||
DI.setRepository(SqliteBankingRepository())
|
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
App()
|
App()
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import kotlinx.coroutines.launch
|
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.Colors
|
||||||
import net.codinux.banking.ui.config.DI
|
import net.codinux.banking.ui.config.DI
|
||||||
import net.codinux.banking.ui.model.settings.AppAuthenticationMethod
|
import net.codinux.banking.ui.model.settings.AppAuthenticationMethod
|
||||||
|
@ -21,9 +23,12 @@ private val typography = Typography(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Preview
|
@Preview
|
||||||
fun App() {
|
fun App(repository: BankingRepository? = null) {
|
||||||
LoggerFactory.defaultLoggerName = "net.codinux.banking.ui.Bankmeister"
|
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,
|
val colors = MaterialTheme.colors.copy(primary = Colors.Primary, primaryVariant = Colors.PrimaryDark, onPrimary = Color.White,
|
||||||
secondary = Colors.Accent, secondaryVariant = Colors.Accent, onSecondary = Color.White)
|
secondary = Colors.Accent, secondaryVariant = Colors.Accent, onSecondary = Color.White)
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ fun main() = application {
|
||||||
icon = painterResource(Res.drawable.AppIcon_svg),
|
icon = painterResource(Res.drawable.AppIcon_svg),
|
||||||
state = WindowState(position = WindowPosition(Alignment.Center), size = DpSize(1000.dp, 800.dp)),
|
state = WindowState(position = WindowPosition(Alignment.Center), size = DpSize(1000.dp, 800.dp)),
|
||||||
) {
|
) {
|
||||||
DI.setRepository(SqliteBankingRepository())
|
|
||||||
|
|
||||||
App()
|
App()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,5 @@ import net.codinux.banking.persistence.SqliteBankingRepository
|
||||||
import net.codinux.banking.ui.config.DI
|
import net.codinux.banking.ui.config.DI
|
||||||
|
|
||||||
fun MainViewController() = ComposeUIViewController {
|
fun MainViewController() = ComposeUIViewController {
|
||||||
DI.setRepository(SqliteBankingRepository())
|
|
||||||
|
|
||||||
App()
|
App()
|
||||||
}
|
}
|
Loading…
Reference in New Issue