diff --git a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapSettings.kt b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapSettings.kt index d5c5e1efb..b5cf30197 100644 --- a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapSettings.kt +++ b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapSettings.kt @@ -1,36 +1,22 @@ -package com.fsck.k9.mail.store.imap; - -import com.fsck.k9.mail.AuthType; -import com.fsck.k9.mail.ConnectionSecurity; +package com.fsck.k9.mail.store.imap +import com.fsck.k9.mail.AuthType +import com.fsck.k9.mail.ConnectionSecurity /** - * Settings source for IMAP. Implemented in order to remove coupling between {@link ImapStore} and {@link ImapConnection}. + * Settings source for IMAP. Implemented in order to remove coupling between [ImapStore] and [ImapConnection]. */ -interface ImapSettings { - String getHost(); +internal interface ImapSettings { + val host: String + val port: Int + val connectionSecurity: ConnectionSecurity + val authType: AuthType + val username: String + val password: String? + val clientCertificateAlias: String? + fun useCompression(): Boolean - int getPort(); - - ConnectionSecurity getConnectionSecurity(); - - AuthType getAuthType(); - - String getUsername(); - - String getPassword(); - - String getClientCertificateAlias(); - - boolean useCompression(); - - String getPathPrefix(); - - void setPathPrefix(String prefix); - - String getPathDelimiter(); - - void setPathDelimiter(String delimiter); - - void setCombinedPrefix(String prefix); + var pathPrefix: String? + var pathDelimiter: String? + fun setCombinedPrefix(prefix: String?) } diff --git a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/SimpleImapSettings.kt b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/SimpleImapSettings.kt index 66c1d3487..5a74db0b9 100644 --- a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/SimpleImapSettings.kt +++ b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/SimpleImapSettings.kt @@ -4,47 +4,19 @@ import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ConnectionSecurity internal class SimpleImapSettings( - private val host: String, - private val port: Int = 0, - private val connectionSecurity: ConnectionSecurity = ConnectionSecurity.NONE, - private val authType: AuthType, - private val username: String, - private val password: String? = null, + override val host: String, + override val port: Int = 0, + override val connectionSecurity: ConnectionSecurity = ConnectionSecurity.NONE, + override val authType: AuthType, + override val username: String, + override val password: String? = null, private val useCompression: Boolean = false ) : ImapSettings { - private var pathPrefix: String? = null - private var pathDelimiter: String? = null - private var combinedPrefix: String? = null - - override fun getHost(): String = host - - override fun getPort(): Int = port - - override fun getConnectionSecurity(): ConnectionSecurity = connectionSecurity - - override fun getAuthType(): AuthType = authType - - override fun getUsername(): String = username - - override fun getPassword(): String? = password - - override fun getClientCertificateAlias(): String? = null - + override val clientCertificateAlias: String? = null override fun useCompression(): Boolean = useCompression - override fun getPathPrefix(): String? = pathPrefix + override var pathPrefix: String? = null + override var pathDelimiter: String? = null - override fun setPathPrefix(prefix: String?) { - pathPrefix = prefix - } - - override fun getPathDelimiter(): String? = pathDelimiter - - override fun setPathDelimiter(delimiter: String?) { - pathDelimiter = delimiter - } - - override fun setCombinedPrefix(prefix: String?) { - combinedPrefix = prefix - } + override fun setCombinedPrefix(prefix: String?) = Unit }