0
0
mirror of https://github.com/thunderbird/thunderbird-android.git synced 2024-09-19 19:52:14 +02:00

Disable koin override behaviour and fix doubled Clock.System inject definition

This commit is contained in:
Wolf-Martell Montwé 2023-11-10 17:36:27 +01:00
parent ebf03d3a01
commit b9370bc6f3
No known key found for this signature in database
GPG Key ID: 6D45B21512ACBF72
6 changed files with 15 additions and 5 deletions

View File

@ -10,6 +10,7 @@ class FeatureApplication : Application() {
super.onCreate()
startKoin {
allowOverride(false)
androidContext(this@FeatureApplication)
modules(featureModule)
}

View File

@ -11,6 +11,7 @@ class CatalogApplication : Application() {
super.onCreate()
startKoin {
allowOverride(false)
androidContext(this@CatalogApplication)
modules(catalogUiModule)
}

View File

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

View File

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

View File

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

View File

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