Loading app/core/src/main/java/com/fsck/k9/Core.kt +0 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ object Core : KoinComponent { fun init(context: Context) { BinaryTempFileBody.setTempDirectory(context.cacheDir) LocalKeyStore.setKeyStoreLocation(context.getDir("KeyStore", Context.MODE_PRIVATE).toString()) setServicesEnabled(context) registerReceivers(context) Loading app/core/src/main/java/com/fsck/k9/KoinModule.kt +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,10 @@ package com.fsck.k9 import android.content.Context import com.fsck.k9.helper.Contacts import com.fsck.k9.mail.power.PowerManager import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory import com.fsck.k9.mail.ssl.LocalKeyStore import com.fsck.k9.mail.ssl.TrustManagerFactory import com.fsck.k9.mail.ssl.TrustedSocketFactory import com.fsck.k9.mailstore.LocalStoreProvider import com.fsck.k9.mailstore.StorageManager import com.fsck.k9.power.TracingPowerManager Loading @@ -15,4 +19,8 @@ val mainModule = applicationContext { bean { LocalStoreProvider() } bean { TracingPowerManager.getPowerManager(get()) as PowerManager } bean { Contacts.getInstance(get()) } bean { LocalKeyStore.createInstance(get()) } bean { TrustManagerFactory.createInstance(get()) } bean { LocalKeyStoreManager(get()) } bean { DefaultTrustedSocketFactory(get(), get()) as TrustedSocketFactory } } app/core/src/main/java/com/fsck/k9/LocalKeyStoreManager.kt +7 −9 Original line number Diff line number Diff line Loading @@ -7,18 +7,17 @@ import java.security.cert.CertificateException import java.security.cert.X509Certificate class LocalKeyStoreManager( val localKeyStore: LocalKeyStore private val localKeyStore: LocalKeyStore ) { /** * Add a new certificate for the incoming or outgoing server to the local key store. */ @Throws(CertificateException::class) fun addCertificate(account: Account, direction: MailServerDirection, certificate: X509Certificate) { val uri: Uri if (direction === MailServerDirection.INCOMING) { uri = Uri.parse(account.storeUri) val uri = if (direction === MailServerDirection.INCOMING) { Uri.parse(account.storeUri) } else { uri = Uri.parse(account.transportUri) Uri.parse(account.transportUri) } localKeyStore.addCertificate(uri.host, uri.port, certificate) } Loading @@ -29,11 +28,10 @@ class LocalKeyStoreManager( * old host/port. */ fun deleteCertificate(account: Account, newHost: String, newPort: Int, direction: MailServerDirection) { val uri: Uri if (direction === MailServerDirection.INCOMING) { uri = Uri.parse(account.storeUri) val uri = if (direction === MailServerDirection.INCOMING) { Uri.parse(account.storeUri) } else { uri = Uri.parse(account.transportUri) Uri.parse(account.transportUri) } val oldHost = uri.host val oldPort = uri.port Loading app/core/src/main/java/com/fsck/k9/notification/CoreKoinModule.kt +0 −2 Original line number Diff line number Diff line Loading @@ -22,8 +22,6 @@ val coreNotificationModule = applicationContext { ) } bean { AccountPreferenceSerializer(get(), get()) } bean { LocalKeyStore.getInstance() } bean { LocalKeyStoreManager(get()) } bean { CertificateErrorNotifications(get(), get(), get()) } bean { AuthenticationErrorNotifications(get(), get(), get()) } bean { SyncNotifications(get(), get(), get()) } Loading app/k9mail/src/main/java/com/fsck/k9/backends/ImapBackendFactory.kt +5 −3 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import com.fsck.k9.mail.ServerSettings import com.fsck.k9.mail.oauth.OAuth2TokenProvider import com.fsck.k9.mail.power.PowerManager import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory import com.fsck.k9.mail.ssl.TrustedSocketFactory import com.fsck.k9.mail.store.imap.ImapStore import com.fsck.k9.mail.transport.smtp.SmtpTransport import com.fsck.k9.mail.transport.smtp.SmtpTransportUriCreator Loading @@ -21,7 +22,8 @@ import com.fsck.k9.mailstore.K9BackendStorageFactory class ImapBackendFactory( private val context: Context, private val powerManager: PowerManager, private val backendStorageFactory: K9BackendStorageFactory private val backendStorageFactory: K9BackendStorageFactory, private val trustedSocketFactory: TrustedSocketFactory ) : BackendFactory { override val transportUriPrefix = "smtp" Loading @@ -39,7 +41,7 @@ class ImapBackendFactory( return ImapStore( serverSettings, account, DefaultTrustedSocketFactory(context), trustedSocketFactory, context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager, oAuth2TokenProvider ) Loading @@ -48,7 +50,7 @@ class ImapBackendFactory( private fun createSmtpTransport(account: Account): SmtpTransport { val serverSettings = decodeTransportUri(account.transportUri) val oauth2TokenProvider: OAuth2TokenProvider? = null return SmtpTransport(serverSettings, account, DefaultTrustedSocketFactory(context), oauth2TokenProvider) return SmtpTransport(serverSettings, account, trustedSocketFactory, oauth2TokenProvider) } override fun decodeStoreUri(storeUri: String): ServerSettings { Loading Loading
app/core/src/main/java/com/fsck/k9/Core.kt +0 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ object Core : KoinComponent { fun init(context: Context) { BinaryTempFileBody.setTempDirectory(context.cacheDir) LocalKeyStore.setKeyStoreLocation(context.getDir("KeyStore", Context.MODE_PRIVATE).toString()) setServicesEnabled(context) registerReceivers(context) Loading
app/core/src/main/java/com/fsck/k9/KoinModule.kt +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,10 @@ package com.fsck.k9 import android.content.Context import com.fsck.k9.helper.Contacts import com.fsck.k9.mail.power.PowerManager import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory import com.fsck.k9.mail.ssl.LocalKeyStore import com.fsck.k9.mail.ssl.TrustManagerFactory import com.fsck.k9.mail.ssl.TrustedSocketFactory import com.fsck.k9.mailstore.LocalStoreProvider import com.fsck.k9.mailstore.StorageManager import com.fsck.k9.power.TracingPowerManager Loading @@ -15,4 +19,8 @@ val mainModule = applicationContext { bean { LocalStoreProvider() } bean { TracingPowerManager.getPowerManager(get()) as PowerManager } bean { Contacts.getInstance(get()) } bean { LocalKeyStore.createInstance(get()) } bean { TrustManagerFactory.createInstance(get()) } bean { LocalKeyStoreManager(get()) } bean { DefaultTrustedSocketFactory(get(), get()) as TrustedSocketFactory } }
app/core/src/main/java/com/fsck/k9/LocalKeyStoreManager.kt +7 −9 Original line number Diff line number Diff line Loading @@ -7,18 +7,17 @@ import java.security.cert.CertificateException import java.security.cert.X509Certificate class LocalKeyStoreManager( val localKeyStore: LocalKeyStore private val localKeyStore: LocalKeyStore ) { /** * Add a new certificate for the incoming or outgoing server to the local key store. */ @Throws(CertificateException::class) fun addCertificate(account: Account, direction: MailServerDirection, certificate: X509Certificate) { val uri: Uri if (direction === MailServerDirection.INCOMING) { uri = Uri.parse(account.storeUri) val uri = if (direction === MailServerDirection.INCOMING) { Uri.parse(account.storeUri) } else { uri = Uri.parse(account.transportUri) Uri.parse(account.transportUri) } localKeyStore.addCertificate(uri.host, uri.port, certificate) } Loading @@ -29,11 +28,10 @@ class LocalKeyStoreManager( * old host/port. */ fun deleteCertificate(account: Account, newHost: String, newPort: Int, direction: MailServerDirection) { val uri: Uri if (direction === MailServerDirection.INCOMING) { uri = Uri.parse(account.storeUri) val uri = if (direction === MailServerDirection.INCOMING) { Uri.parse(account.storeUri) } else { uri = Uri.parse(account.transportUri) Uri.parse(account.transportUri) } val oldHost = uri.host val oldPort = uri.port Loading
app/core/src/main/java/com/fsck/k9/notification/CoreKoinModule.kt +0 −2 Original line number Diff line number Diff line Loading @@ -22,8 +22,6 @@ val coreNotificationModule = applicationContext { ) } bean { AccountPreferenceSerializer(get(), get()) } bean { LocalKeyStore.getInstance() } bean { LocalKeyStoreManager(get()) } bean { CertificateErrorNotifications(get(), get(), get()) } bean { AuthenticationErrorNotifications(get(), get(), get()) } bean { SyncNotifications(get(), get(), get()) } Loading
app/k9mail/src/main/java/com/fsck/k9/backends/ImapBackendFactory.kt +5 −3 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import com.fsck.k9.mail.ServerSettings import com.fsck.k9.mail.oauth.OAuth2TokenProvider import com.fsck.k9.mail.power.PowerManager import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory import com.fsck.k9.mail.ssl.TrustedSocketFactory import com.fsck.k9.mail.store.imap.ImapStore import com.fsck.k9.mail.transport.smtp.SmtpTransport import com.fsck.k9.mail.transport.smtp.SmtpTransportUriCreator Loading @@ -21,7 +22,8 @@ import com.fsck.k9.mailstore.K9BackendStorageFactory class ImapBackendFactory( private val context: Context, private val powerManager: PowerManager, private val backendStorageFactory: K9BackendStorageFactory private val backendStorageFactory: K9BackendStorageFactory, private val trustedSocketFactory: TrustedSocketFactory ) : BackendFactory { override val transportUriPrefix = "smtp" Loading @@ -39,7 +41,7 @@ class ImapBackendFactory( return ImapStore( serverSettings, account, DefaultTrustedSocketFactory(context), trustedSocketFactory, context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager, oAuth2TokenProvider ) Loading @@ -48,7 +50,7 @@ class ImapBackendFactory( private fun createSmtpTransport(account: Account): SmtpTransport { val serverSettings = decodeTransportUri(account.transportUri) val oauth2TokenProvider: OAuth2TokenProvider? = null return SmtpTransport(serverSettings, account, DefaultTrustedSocketFactory(context), oauth2TokenProvider) return SmtpTransport(serverSettings, account, trustedSocketFactory, oauth2TokenProvider) } override fun decodeStoreUri(storeUri: String): ServerSettings { Loading