Merge pull request #7397 from thunderbird/fix_koin_setup
Fix Koin setup
This commit is contained in:
commit
f2259c3fb0
6 changed files with 15 additions and 5 deletions
|
@ -10,6 +10,7 @@ class FeatureApplication : Application() {
|
|||
super.onCreate()
|
||||
|
||||
startKoin {
|
||||
allowOverride(false)
|
||||
androidContext(this@FeatureApplication)
|
||||
modules(featureModule)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ class CatalogApplication : Application() {
|
|||
super.onCreate()
|
||||
|
||||
startKoin {
|
||||
allowOverride(false)
|
||||
androidContext(this@CatalogApplication)
|
||||
modules(catalogUiModule)
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@ object DI {
|
|||
private const val DEBUG = false
|
||||
|
||||
@JvmStatic
|
||||
fun start(application: Application, modules: List<Module>) {
|
||||
fun start(application: Application, modules: List<Module>, allowOverride: Boolean = false) {
|
||||
startKoin {
|
||||
allowOverride(allowOverride)
|
||||
|
||||
if (BuildConfig.DEBUG && DEBUG) {
|
||||
androidLogger()
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.fsck.k9.mail.ssl.TrustedSocketFactory
|
|||
import com.fsck.k9.mailstore.LocalStoreProvider
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.datetime.Clock
|
||||
import org.koin.core.qualifier.named
|
||||
import org.koin.dsl.module
|
||||
|
||||
|
@ -32,7 +31,6 @@ val mainModule = module {
|
|||
single { TrustManagerFactory.createInstance(get()) }
|
||||
single { LocalKeyStoreManager(get()) }
|
||||
single<TrustedSocketFactory> { DefaultTrustedSocketFactory(get(), get()) }
|
||||
single<Clock> { Clock.System }
|
||||
factory { EmailAddressValidator() }
|
||||
factory { ServerSettingsSerializer() }
|
||||
}
|
||||
|
|
|
@ -20,7 +20,11 @@ class TestApp : Application() {
|
|||
Core.earlyInit()
|
||||
|
||||
super.onCreate()
|
||||
DI.start(this, coreModules + storageModule + testModule)
|
||||
DI.start(
|
||||
application = this,
|
||||
modules = coreModules + storageModule + testModule,
|
||||
allowOverride = true,
|
||||
)
|
||||
|
||||
K9.init(this)
|
||||
Core.init(this)
|
||||
|
|
|
@ -11,7 +11,11 @@ class TestApp : Application() {
|
|||
Core.earlyInit()
|
||||
|
||||
super.onCreate()
|
||||
DI.start(this, coreModules + storageModule + testModule)
|
||||
DI.start(
|
||||
application = this,
|
||||
modules = coreModules + storageModule + testModule,
|
||||
allowOverride = true,
|
||||
)
|
||||
|
||||
K9.init(this)
|
||||
Core.init(this)
|
||||
|
|
Loading…
Reference in a new issue