Add trailing comma allowance to code style
This commit is contained in:
parent
aebfd33add
commit
29d5220995
487 changed files with 1923 additions and 1889 deletions
|
@ -8,6 +8,8 @@ insert_final_newline = true
|
|||
|
||||
[*.{kt,kts}]
|
||||
ij_kotlin_imports_layout = *,^*
|
||||
ij_kotlin_allow_trailing_comma = true
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = true
|
||||
|
||||
[*.{yml,yaml,json,toml}]
|
||||
indent_size = 2
|
||||
|
|
|
@ -15,5 +15,5 @@ data class DiscoveredServerSettings(
|
|||
val port: Int,
|
||||
val security: ConnectionSecurity,
|
||||
val authType: AuthType?,
|
||||
val username: String?
|
||||
val username: String?,
|
||||
)
|
||||
|
|
|
@ -15,7 +15,7 @@ import timber.log.Timber
|
|||
|
||||
class ProvidersXmlDiscovery(
|
||||
private val xmlProvider: ProvidersXmlProvider,
|
||||
private val oAuthConfigurationProvider: OAuthConfigurationProvider
|
||||
private val oAuthConfigurationProvider: OAuthConfigurationProvider,
|
||||
) : ConnectionSettingsDiscovery {
|
||||
|
||||
override fun discover(email: String): DiscoveryResults? {
|
||||
|
@ -151,6 +151,6 @@ class ProvidersXmlDiscovery(
|
|||
val incomingUriTemplate: String,
|
||||
val incomingUsernameTemplate: String,
|
||||
val outgoingUriTemplate: String,
|
||||
val outgoingUsernameTemplate: String
|
||||
val outgoingUsernameTemplate: String,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class ProvidersXmlDiscoveryTest : RobolectricTest() {
|
|||
@Test
|
||||
fun discover_withUnknownDomain_shouldReturnNull() {
|
||||
val connectionSettings = providersXmlDiscovery.discover(
|
||||
"user@not.present.in.providers.xml.example"
|
||||
"user@not.present.in.providers.xml.example",
|
||||
)
|
||||
|
||||
assertThat(connectionSettings).isNull()
|
||||
|
@ -48,14 +48,14 @@ class ProvidersXmlDiscoveryTest : RobolectricTest() {
|
|||
scopes = listOf("irrelevant"),
|
||||
authorizationEndpoint = "irrelevant",
|
||||
tokenEndpoint = "irrelevant",
|
||||
redirectUri = "irrelevant"
|
||||
redirectUri = "irrelevant",
|
||||
)
|
||||
|
||||
return OAuthConfigurationProvider(
|
||||
configurations = mapOf(
|
||||
listOf("imap.gmail.com", "smtp.gmail.com") to googleConfig
|
||||
listOf("imap.gmail.com", "smtp.gmail.com") to googleConfig,
|
||||
),
|
||||
googleConfiguration = googleConfig
|
||||
googleConfiguration = googleConfig,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class MiniDnsSrvResolver : SrvResolver {
|
|||
val result = ResolverApi.INSTANCE.resolveSrv(
|
||||
DnsLabel.from(type.label),
|
||||
SrvProto.tcp.dnsLabel,
|
||||
DnsName.from(domain)
|
||||
DnsName.from(domain),
|
||||
)
|
||||
|
||||
val security = if (type.assumeTls) SSL_TLS_REQUIRED else STARTTLS_REQUIRED
|
||||
|
@ -22,7 +22,7 @@ class MiniDnsSrvResolver : SrvResolver {
|
|||
host = it.target.toString(),
|
||||
port = it.port,
|
||||
priority = it.priority,
|
||||
security = security
|
||||
security = security,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.fsck.k9.mail.AuthType
|
|||
import com.fsck.k9.mail.ConnectionSecurity
|
||||
|
||||
class SrvServiceDiscovery(
|
||||
private val srvResolver: MiniDnsSrvResolver
|
||||
private val srvResolver: MiniDnsSrvResolver,
|
||||
) : ConnectionSettingsDiscovery {
|
||||
|
||||
override fun discover(email: String): DiscoveryResults? {
|
||||
|
@ -36,7 +36,7 @@ fun newServerSettings(service: MailService, email: String): DiscoveredServerSett
|
|||
service.port,
|
||||
service.security,
|
||||
AuthType.PLAIN,
|
||||
email
|
||||
email,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ enum class SrvType(val label: String, val protocol: String, val assumeTls: Boole
|
|||
SUBMISSIONS("_submissions", "smtp", true),
|
||||
SUBMISSION("_submission", "smtp", false),
|
||||
IMAPS("_imaps", "imap", true),
|
||||
IMAP("_imap", "imap", false)
|
||||
IMAP("_imap", "imap", false),
|
||||
}
|
||||
|
||||
data class MailService(
|
||||
|
@ -52,5 +52,5 @@ data class MailService(
|
|||
val host: String,
|
||||
val port: Int,
|
||||
val priority: Int,
|
||||
val security: ConnectionSecurity
|
||||
val security: ConnectionSecurity,
|
||||
)
|
||||
|
|
|
@ -24,8 +24,8 @@ class SrvServiceDiscoveryTest {
|
|||
val srvResolver = newMockSrvResolver(
|
||||
imapServices = listOf(newMailService(port = 143, srvType = SrvType.IMAP)),
|
||||
imapsServices = listOf(
|
||||
newMailService(port = 993, srvType = SrvType.IMAPS, security = ConnectionSecurity.SSL_TLS_REQUIRED)
|
||||
)
|
||||
newMailService(port = 993, srvType = SrvType.IMAPS, security = ConnectionSecurity.SSL_TLS_REQUIRED),
|
||||
),
|
||||
)
|
||||
|
||||
val srvServiceDiscovery = SrvServiceDiscovery(srvResolver)
|
||||
|
@ -42,14 +42,14 @@ class SrvServiceDiscoveryTest {
|
|||
newMailService(
|
||||
port = 25,
|
||||
srvType = SrvType.SUBMISSION,
|
||||
security = ConnectionSecurity.STARTTLS_REQUIRED
|
||||
security = ConnectionSecurity.STARTTLS_REQUIRED,
|
||||
),
|
||||
newMailService(
|
||||
port = 465,
|
||||
srvType = SrvType.SUBMISSIONS,
|
||||
security = ConnectionSecurity.SSL_TLS_REQUIRED
|
||||
)
|
||||
)
|
||||
security = ConnectionSecurity.SSL_TLS_REQUIRED,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val srvServiceDiscovery = SrvServiceDiscovery(srvResolver)
|
||||
|
@ -68,15 +68,15 @@ class SrvServiceDiscoveryTest {
|
|||
port = 25,
|
||||
srvType = SrvType.SUBMISSION,
|
||||
security = ConnectionSecurity.STARTTLS_REQUIRED,
|
||||
priority = 0
|
||||
priority = 0,
|
||||
),
|
||||
newMailService(
|
||||
host = "smtp2.example.com",
|
||||
port = 25,
|
||||
srvType = SrvType.SUBMISSION,
|
||||
security = ConnectionSecurity.STARTTLS_REQUIRED,
|
||||
priority = 1
|
||||
)
|
||||
priority = 1,
|
||||
),
|
||||
),
|
||||
submissionsServices = listOf(
|
||||
newMailService(
|
||||
|
@ -84,15 +84,15 @@ class SrvServiceDiscoveryTest {
|
|||
port = 465,
|
||||
srvType = SrvType.SUBMISSIONS,
|
||||
security = ConnectionSecurity.SSL_TLS_REQUIRED,
|
||||
priority = 0
|
||||
priority = 0,
|
||||
),
|
||||
newMailService(
|
||||
host = "smtp4.example.com",
|
||||
port = 465,
|
||||
srvType = SrvType.SUBMISSIONS,
|
||||
security = ConnectionSecurity.SSL_TLS_REQUIRED,
|
||||
priority = 1
|
||||
)
|
||||
priority = 1,
|
||||
),
|
||||
),
|
||||
imapServices = listOf(
|
||||
newMailService(
|
||||
|
@ -100,15 +100,15 @@ class SrvServiceDiscoveryTest {
|
|||
port = 143,
|
||||
srvType = SrvType.IMAP,
|
||||
security = ConnectionSecurity.STARTTLS_REQUIRED,
|
||||
priority = 0
|
||||
priority = 0,
|
||||
),
|
||||
newMailService(
|
||||
host = "imap2.example.com",
|
||||
port = 143,
|
||||
srvType = SrvType.IMAP,
|
||||
security = ConnectionSecurity.STARTTLS_REQUIRED,
|
||||
priority = 1
|
||||
)
|
||||
priority = 1,
|
||||
),
|
||||
),
|
||||
imapsServices = listOf(
|
||||
newMailService(
|
||||
|
@ -116,16 +116,16 @@ class SrvServiceDiscoveryTest {
|
|||
port = 993,
|
||||
srvType = SrvType.IMAPS,
|
||||
security = ConnectionSecurity.SSL_TLS_REQUIRED,
|
||||
priority = 0
|
||||
priority = 0,
|
||||
),
|
||||
newMailService(
|
||||
host = "imaps2.example.com",
|
||||
port = 993,
|
||||
srvType = SrvType.IMAPS,
|
||||
security = ConnectionSecurity.SSL_TLS_REQUIRED,
|
||||
priority = 1
|
||||
)
|
||||
)
|
||||
priority = 1,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val srvServiceDiscovery = SrvServiceDiscovery(srvResolver)
|
||||
|
@ -136,18 +136,18 @@ class SrvServiceDiscoveryTest {
|
|||
"smtp3.example.com",
|
||||
"smtp1.example.com",
|
||||
"smtp4.example.com",
|
||||
"smtp2.example.com"
|
||||
"smtp2.example.com",
|
||||
),
|
||||
result?.outgoing?.map { it.host }
|
||||
result?.outgoing?.map { it.host },
|
||||
)
|
||||
assertEquals(
|
||||
listOf(
|
||||
"imaps1.example.com",
|
||||
"imap1.example.com",
|
||||
"imaps2.example.com",
|
||||
"imap2.example.com"
|
||||
"imap2.example.com",
|
||||
),
|
||||
result?.incoming?.map { it.host }
|
||||
result?.incoming?.map { it.host },
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ class SrvServiceDiscoveryTest {
|
|||
priority: Int = 0,
|
||||
security: ConnectionSecurity = ConnectionSecurity.STARTTLS_REQUIRED,
|
||||
srvType: SrvType,
|
||||
port: Int
|
||||
port: Int,
|
||||
): MailService {
|
||||
return MailService(srvType, host, port, priority, security)
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ class SrvServiceDiscoveryTest {
|
|||
submissionServices: List<MailService> = listOf(),
|
||||
submissionsServices: List<MailService> = listOf(),
|
||||
imapServices: List<MailService> = listOf(),
|
||||
imapsServices: List<MailService> = listOf()
|
||||
imapsServices: List<MailService> = listOf(),
|
||||
): MiniDnsSrvResolver {
|
||||
return mock {
|
||||
on { lookup(host, SrvType.SUBMISSION) } doReturn submissionServices
|
||||
|
|
|
@ -13,7 +13,7 @@ class ThunderbirdAutoconfigUrlProvider {
|
|||
createProviderUrl(domain, email),
|
||||
createDomainUrl(scheme = "https", domain),
|
||||
createDomainUrl(scheme = "http", domain),
|
||||
createIspDbUrl(domain)
|
||||
createIspDbUrl(domain),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.fsck.k9.autodiscovery.api.DiscoveryResults
|
|||
class ThunderbirdDiscovery(
|
||||
private val urlProvider: ThunderbirdAutoconfigUrlProvider,
|
||||
private val fetcher: ThunderbirdAutoconfigFetcher,
|
||||
private val parser: ThunderbirdAutoconfigParser
|
||||
private val parser: ThunderbirdAutoconfigParser,
|
||||
) : ConnectionSettingsDiscovery {
|
||||
|
||||
override fun discover(email: String): DiscoveryResults? {
|
||||
|
|
|
@ -162,11 +162,11 @@ class ThunderbirdAutoconfigTest {
|
|||
port = 993,
|
||||
security = ConnectionSecurity.SSL_TLS_REQUIRED,
|
||||
authType = AuthType.PLAIN,
|
||||
username = "test@metacode.biz"
|
||||
)
|
||||
username = "test@metacode.biz",
|
||||
),
|
||||
),
|
||||
listOf()
|
||||
)
|
||||
listOf(),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class ThunderbirdAutoconfigUrlProviderTest {
|
|||
"https://autoconfig.domain.example/mail/config-v1.1.xml?emailaddress=test%40domain.example",
|
||||
"https://domain.example/.well-known/autoconfig/mail/config-v1.1.xml",
|
||||
"http://domain.example/.well-known/autoconfig/mail/config-v1.1.xml",
|
||||
"https://autoconfig.thunderbird.net/v1.1/domain.example"
|
||||
"https://autoconfig.thunderbird.net/v1.1/domain.example",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -613,41 +613,42 @@ class Account(override val uuid: String) : BaseAccount {
|
|||
ALL,
|
||||
FIRST_CLASS,
|
||||
FIRST_AND_SECOND_CLASS,
|
||||
NOT_SECOND_CLASS
|
||||
NOT_SECOND_CLASS,
|
||||
}
|
||||
|
||||
enum class SpecialFolderSelection {
|
||||
AUTOMATIC,
|
||||
MANUAL
|
||||
MANUAL,
|
||||
}
|
||||
|
||||
enum class ShowPictures {
|
||||
NEVER,
|
||||
ALWAYS,
|
||||
ONLY_FROM_CONTACTS
|
||||
ONLY_FROM_CONTACTS,
|
||||
}
|
||||
|
||||
enum class Searchable {
|
||||
ALL,
|
||||
DISPLAYABLE,
|
||||
NONE
|
||||
NONE,
|
||||
}
|
||||
|
||||
enum class QuoteStyle {
|
||||
PREFIX,
|
||||
HEADER
|
||||
HEADER,
|
||||
}
|
||||
|
||||
enum class MessageFormat {
|
||||
TEXT,
|
||||
HTML,
|
||||
AUTO
|
||||
AUTO,
|
||||
}
|
||||
|
||||
enum class Expunge {
|
||||
EXPUNGE_IMMEDIATELY,
|
||||
EXPUNGE_MANUALLY,
|
||||
EXPUNGE_ON_POLL;
|
||||
EXPUNGE_ON_POLL,
|
||||
;
|
||||
|
||||
fun toBackendExpungePolicy(): ExpungePolicy = when (this) {
|
||||
EXPUNGE_IMMEDIATELY -> ExpungePolicy.IMMEDIATELY
|
||||
|
@ -660,7 +661,8 @@ class Account(override val uuid: String) : BaseAccount {
|
|||
NEVER(0),
|
||||
SEVEN_DAYS(1),
|
||||
ON_DELETE(2),
|
||||
MARK_AS_READ(3);
|
||||
MARK_AS_READ(3),
|
||||
;
|
||||
|
||||
companion object {
|
||||
fun fromInt(initialSetting: Int): DeletePolicy {
|
||||
|
@ -676,7 +678,7 @@ class Account(override val uuid: String) : BaseAccount {
|
|||
SORT_SENDER(true),
|
||||
SORT_UNREAD(true),
|
||||
SORT_FLAGGED(true),
|
||||
SORT_ATTACHMENT(true);
|
||||
SORT_ATTACHMENT(true),
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -23,7 +23,7 @@ import timber.log.Timber
|
|||
class AccountPreferenceSerializer(
|
||||
private val storageManager: StorageManager,
|
||||
private val resourceProvider: CoreResourceProvider,
|
||||
private val serverSettingsSerializer: ServerSettingsSerializer
|
||||
private val serverSettingsSerializer: ServerSettingsSerializer,
|
||||
) {
|
||||
|
||||
@Synchronized
|
||||
|
@ -31,10 +31,10 @@ class AccountPreferenceSerializer(
|
|||
val accountUuid = account.uuid
|
||||
with(account) {
|
||||
incomingServerSettings = serverSettingsSerializer.deserialize(
|
||||
storage.getString("$accountUuid.$INCOMING_SERVER_SETTINGS_KEY", "")
|
||||
storage.getString("$accountUuid.$INCOMING_SERVER_SETTINGS_KEY", ""),
|
||||
)
|
||||
outgoingServerSettings = serverSettingsSerializer.deserialize(
|
||||
storage.getString("$accountUuid.$OUTGOING_SERVER_SETTINGS_KEY", "")
|
||||
storage.getString("$accountUuid.$OUTGOING_SERVER_SETTINGS_KEY", ""),
|
||||
)
|
||||
oAuthState = storage.getString("$accountUuid.oAuthState", null)
|
||||
localStorageProviderId = storage.getString("$accountUuid.localStorageProvider", storageManager.defaultProviderId)
|
||||
|
@ -69,7 +69,7 @@ class AccountPreferenceSerializer(
|
|||
val draftsFolderSelection = getEnumStringPref<SpecialFolderSelection>(
|
||||
storage,
|
||||
"$accountUuid.draftsFolderSelection",
|
||||
SpecialFolderSelection.AUTOMATIC
|
||||
SpecialFolderSelection.AUTOMATIC,
|
||||
)
|
||||
setDraftsFolderId(draftsFolderId, draftsFolderSelection)
|
||||
|
||||
|
@ -77,7 +77,7 @@ class AccountPreferenceSerializer(
|
|||
val sentFolderSelection = getEnumStringPref<SpecialFolderSelection>(
|
||||
storage,
|
||||
"$accountUuid.sentFolderSelection",
|
||||
SpecialFolderSelection.AUTOMATIC
|
||||
SpecialFolderSelection.AUTOMATIC,
|
||||
)
|
||||
setSentFolderId(sentFolderId, sentFolderSelection)
|
||||
|
||||
|
@ -85,7 +85,7 @@ class AccountPreferenceSerializer(
|
|||
val trashFolderSelection = getEnumStringPref<SpecialFolderSelection>(
|
||||
storage,
|
||||
"$accountUuid.trashFolderSelection",
|
||||
SpecialFolderSelection.AUTOMATIC
|
||||
SpecialFolderSelection.AUTOMATIC,
|
||||
)
|
||||
setTrashFolderId(trashFolderId, trashFolderSelection)
|
||||
|
||||
|
@ -93,7 +93,7 @@ class AccountPreferenceSerializer(
|
|||
val archiveFolderSelection = getEnumStringPref<SpecialFolderSelection>(
|
||||
storage,
|
||||
"$accountUuid.archiveFolderSelection",
|
||||
SpecialFolderSelection.AUTOMATIC
|
||||
SpecialFolderSelection.AUTOMATIC,
|
||||
)
|
||||
setArchiveFolderId(archiveFolderId, archiveFolderSelection)
|
||||
|
||||
|
@ -101,7 +101,7 @@ class AccountPreferenceSerializer(
|
|||
val spamFolderSelection = getEnumStringPref<SpecialFolderSelection>(
|
||||
storage,
|
||||
"$accountUuid.spamFolderSelection",
|
||||
SpecialFolderSelection.AUTOMATIC
|
||||
SpecialFolderSelection.AUTOMATIC,
|
||||
)
|
||||
setSpamFolderId(spamFolderId, spamFolderSelection)
|
||||
|
||||
|
@ -147,8 +147,8 @@ class AccountPreferenceSerializer(
|
|||
vibration = NotificationVibration(
|
||||
isEnabled = storage.getBoolean("$accountUuid.vibrate", false),
|
||||
pattern = VibratePattern.deserialize(storage.getInt("$accountUuid.vibratePattern", 0)),
|
||||
repeatCount = storage.getInt("$accountUuid.vibrateTimes", 5)
|
||||
)
|
||||
repeatCount = storage.getInt("$accountUuid.vibrateTimes", 5),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ class AccountPreferenceSerializer(
|
|||
signatureUse = signatureUse,
|
||||
signature = signature,
|
||||
description = description,
|
||||
replyTo = replyTo
|
||||
replyTo = replyTo,
|
||||
)
|
||||
newIdentities.add(identity)
|
||||
gotOne = true
|
||||
|
@ -228,7 +228,7 @@ class AccountPreferenceSerializer(
|
|||
email = email,
|
||||
signatureUse = signatureUse,
|
||||
signature = signature,
|
||||
description = email
|
||||
description = email,
|
||||
)
|
||||
newIdentities.add(identity)
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ class AccountPreferenceSerializer(
|
|||
"Unable to convert preference key [%s] value [%s] to enum of type %s",
|
||||
key,
|
||||
stringPref,
|
||||
defaultEnum.declaringJavaClass
|
||||
defaultEnum.declaringJavaClass,
|
||||
)
|
||||
|
||||
defaultEnum
|
||||
|
@ -603,7 +603,7 @@ class AccountPreferenceSerializer(
|
|||
val identity = Identity(
|
||||
signatureUse = false,
|
||||
signature = resourceProvider.defaultSignature(),
|
||||
description = resourceProvider.defaultIdentityDescription()
|
||||
description = resourceProvider.defaultIdentityDescription(),
|
||||
)
|
||||
identities.add(identity)
|
||||
|
||||
|
@ -612,7 +612,7 @@ class AccountPreferenceSerializer(
|
|||
isRingEnabled = true,
|
||||
ringtone = DEFAULT_RINGTONE_URI,
|
||||
light = NotificationLight.Disabled,
|
||||
vibration = NotificationVibration.DEFAULT
|
||||
vibration = NotificationVibration.DEFAULT,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package com.fsck.k9
|
||||
|
||||
data class AppConfig(
|
||||
val componentsToDisable: List<Class<*>>
|
||||
val componentsToDisable: List<Class<*>>,
|
||||
)
|
||||
|
|
|
@ -70,7 +70,7 @@ object Core : EarlyInit {
|
|||
} else {
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
},
|
||||
PackageManager.DONT_KILL_APP
|
||||
PackageManager.DONT_KILL_APP,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ val coreModules = listOf(
|
|||
preferencesModule,
|
||||
connectivityModule,
|
||||
powerModule,
|
||||
loggingModule
|
||||
loggingModule,
|
||||
)
|
||||
|
|
|
@ -40,5 +40,5 @@ interface EarlyInit
|
|||
// Copied from ComponentCallbacks.inject()
|
||||
inline fun <reified T : Any> EarlyInit.inject(
|
||||
qualifier: Qualifier? = null,
|
||||
noinline parameters: ParametersDefinition? = null
|
||||
noinline parameters: ParametersDefinition? = null,
|
||||
) = lazy { getKoin().get<T>(qualifier, parameters) }
|
||||
|
|
|
@ -21,7 +21,7 @@ class EmailAddressValidator {
|
|||
|
||||
private val EMAIL_ADDRESS_PATTERN = Pattern.compile(
|
||||
"^($ATEXT+(\\.$ATEXT+)*|\"$QCONTENT+\")" +
|
||||
"\\@$HOST_NAME"
|
||||
"\\@$HOST_NAME",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ data class Identity(
|
|||
val email: String? = null,
|
||||
val signature: String? = null,
|
||||
val signatureUse: Boolean = false,
|
||||
val replyTo: String? = null
|
||||
val replyTo: String? = null,
|
||||
) : Parcelable {
|
||||
// TODO remove when callers are converted to Kotlin
|
||||
fun withName(name: String?) = copy(name = name)
|
||||
|
|
|
@ -345,7 +345,7 @@ object K9 : EarlyInit {
|
|||
|
||||
lockScreenNotificationVisibility = storage.getEnum(
|
||||
"lockScreenNotificationVisibility",
|
||||
LockScreenNotificationVisibility.MESSAGE_COUNT
|
||||
LockScreenNotificationVisibility.MESSAGE_COUNT,
|
||||
)
|
||||
|
||||
splitViewMode = storage.getEnum("splitViewMode", SplitViewMode.NEVER)
|
||||
|
@ -507,7 +507,7 @@ object K9 : EarlyInit {
|
|||
enum class NotificationQuickDelete {
|
||||
ALWAYS,
|
||||
FOR_SINGLE_MSG,
|
||||
NEVER
|
||||
NEVER,
|
||||
}
|
||||
|
||||
enum class LockScreenNotificationVisibility {
|
||||
|
@ -515,7 +515,7 @@ object K9 : EarlyInit {
|
|||
SENDERS,
|
||||
MESSAGE_COUNT,
|
||||
APP_NAME,
|
||||
NOTHING
|
||||
NOTHING,
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -524,6 +524,6 @@ object K9 : EarlyInit {
|
|||
enum class SplitViewMode {
|
||||
ALWAYS,
|
||||
NEVER,
|
||||
WHEN_IN_LANDSCAPE
|
||||
WHEN_IN_LANDSCAPE,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ val mainModule = module {
|
|||
Preferences(
|
||||
storagePersister = get(),
|
||||
localStoreProvider = get(),
|
||||
accountPreferenceSerializer = get()
|
||||
accountPreferenceSerializer = get(),
|
||||
)
|
||||
}
|
||||
single { get<Context>().resources }
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.security.cert.CertificateException
|
|||
import java.security.cert.X509Certificate
|
||||
|
||||
class LocalKeyStoreManager(
|
||||
private val localKeyStore: LocalKeyStore
|
||||
private val localKeyStore: LocalKeyStore,
|
||||
) {
|
||||
/**
|
||||
* Add a new certificate for the incoming or outgoing server to the local key store.
|
||||
|
|
|
@ -12,7 +12,8 @@ enum class NotificationLight {
|
|||
Blue,
|
||||
Yellow,
|
||||
Cyan,
|
||||
Magenta;
|
||||
Magenta,
|
||||
;
|
||||
|
||||
fun toColor(account: Account): Int? {
|
||||
return when (this) {
|
||||
|
|
|
@ -7,5 +7,5 @@ data class NotificationSettings(
|
|||
val isRingEnabled: Boolean = false,
|
||||
val ringtone: String? = null,
|
||||
val light: NotificationLight = NotificationLight.Disabled,
|
||||
val vibration: NotificationVibration = NotificationVibration.DEFAULT
|
||||
val vibration: NotificationVibration = NotificationVibration.DEFAULT,
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9
|
|||
data class NotificationVibration(
|
||||
val isEnabled: Boolean,
|
||||
val pattern: VibratePattern,
|
||||
val repeatCount: Int
|
||||
val repeatCount: Int,
|
||||
) {
|
||||
val systemPattern: LongArray
|
||||
get() = getSystemPattern(pattern, repeatCount)
|
||||
|
@ -30,14 +30,15 @@ enum class VibratePattern(
|
|||
/**
|
||||
* These are "off, on" patterns, specified in milliseconds.
|
||||
*/
|
||||
val vibrationPattern: LongArray
|
||||
val vibrationPattern: LongArray,
|
||||
) {
|
||||
Default(vibrationPattern = longArrayOf(300, 200)),
|
||||
Pattern1(vibrationPattern = longArrayOf(100, 200)),
|
||||
Pattern2(vibrationPattern = longArrayOf(100, 500)),
|
||||
Pattern3(vibrationPattern = longArrayOf(200, 200)),
|
||||
Pattern4(vibrationPattern = longArrayOf(200, 500)),
|
||||
Pattern5(vibrationPattern = longArrayOf(500, 500));
|
||||
Pattern5(vibrationPattern = longArrayOf(500, 500)),
|
||||
;
|
||||
|
||||
fun serialize(): Int = when (this) {
|
||||
Default -> 0
|
||||
|
|
|
@ -28,7 +28,7 @@ class Preferences internal constructor(
|
|||
private val storagePersister: StoragePersister,
|
||||
private val localStoreProvider: LocalStoreProvider,
|
||||
private val accountPreferenceSerializer: AccountPreferenceSerializer,
|
||||
private val backgroundDispatcher: CoroutineDispatcher = Dispatchers.IO
|
||||
private val backgroundDispatcher: CoroutineDispatcher = Dispatchers.IO,
|
||||
) : AccountManager {
|
||||
private val accountLock = Any()
|
||||
private val storageLock = Any()
|
||||
|
|
|
@ -37,7 +37,7 @@ private val JSON_KEYS = JsonReader.Options.of(
|
|||
KEY_AUTHENTICATION_TYPE,
|
||||
KEY_USERNAME,
|
||||
KEY_PASSWORD,
|
||||
KEY_CLIENT_CERTIFICATE_ALIAS
|
||||
KEY_CLIENT_CERTIFICATE_ALIAS,
|
||||
)
|
||||
|
||||
private class ServerSettingsAdapter : JsonAdapter<ServerSettings>() {
|
||||
|
@ -90,7 +90,7 @@ private class ServerSettingsAdapter : JsonAdapter<ServerSettings>() {
|
|||
username,
|
||||
password,
|
||||
clientCertificateAlias,
|
||||
extra
|
||||
extra,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@ enum class SwipeAction(val removesItem: Boolean) {
|
|||
Archive(removesItem = true),
|
||||
Delete(removesItem = true),
|
||||
Spam(removesItem = true),
|
||||
Move(removesItem = true)
|
||||
Move(removesItem = true),
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ class TimberLogger : Logger {
|
|||
Timber.Tree::class.java.name,
|
||||
Timber.DebugTree::class.java.name,
|
||||
TimberLogger::class.java.name,
|
||||
com.fsck.k9.logging.Timber::class.java.name
|
||||
com.fsck.k9.logging.Timber::class.java.name,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ data class AutocryptDraftStateHeader(
|
|||
val isReply: Boolean,
|
||||
val isByChoice: Boolean,
|
||||
val isPgpInline: Boolean,
|
||||
val parameters: Map<String, String> = mapOf()
|
||||
val parameters: Map<String, String> = mapOf(),
|
||||
) {
|
||||
|
||||
fun toHeaderValue(): String {
|
||||
|
@ -54,7 +54,7 @@ data class AutocryptDraftStateHeader(
|
|||
cryptoStatus.isReplyToEncrypted,
|
||||
cryptoStatus.isUserChoice(),
|
||||
cryptoStatus.isPgpInlineModeEnabled,
|
||||
mapOf()
|
||||
mapOf(),
|
||||
)
|
||||
}
|
||||
return AutocryptDraftStateHeader(
|
||||
|
@ -63,7 +63,7 @@ data class AutocryptDraftStateHeader(
|
|||
cryptoStatus.isReplyToEncrypted,
|
||||
cryptoStatus.isUserChoice(),
|
||||
cryptoStatus.isPgpInlineModeEnabled,
|
||||
mapOf()
|
||||
mapOf(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class BackendManager(private val backendFactories: Map<String, BackendFactory>)
|
|||
backendCache[account.uuid] = BackendContainer(
|
||||
backend,
|
||||
account.incomingServerSettings,
|
||||
account.outgoingServerSettings
|
||||
account.outgoingServerSettings,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class BackendManager(private val backendFactories: Map<String, BackendFactory>)
|
|||
private data class BackendContainer(
|
||||
val backend: Backend,
|
||||
val incomingServerSettings: ServerSettings,
|
||||
val outgoingServerSettings: ServerSettings
|
||||
val outgoingServerSettings: ServerSettings,
|
||||
)
|
||||
|
||||
fun interface BackendChangedListener {
|
||||
|
|
|
@ -6,7 +6,7 @@ internal class ExpiringCache<KEY : Any, VALUE : Any>(
|
|||
private val clock: Clock,
|
||||
private val delegateCache: Cache<KEY, VALUE> = InMemoryCache(),
|
||||
private var lastClearTime: Long = clock.time,
|
||||
private val cacheTimeValidity: Long = CACHE_TIME_VALIDITY_IN_MILLIS
|
||||
private val cacheTimeValidity: Long = CACHE_TIME_VALIDITY_IN_MILLIS,
|
||||
) : Cache<KEY, VALUE> {
|
||||
|
||||
override fun get(key: KEY): VALUE? {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.fsck.k9.cache
|
||||
|
||||
internal class InMemoryCache<KEY : Any, VALUE : Any>(
|
||||
private val cache: MutableMap<KEY, VALUE> = mutableMapOf()
|
||||
private val cache: MutableMap<KEY, VALUE> = mutableMapOf(),
|
||||
) : Cache<KEY, VALUE> {
|
||||
override fun get(key: KEY): VALUE? {
|
||||
return cache[key]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.fsck.k9.cache
|
||||
|
||||
internal class SynchronizedCache<KEY : Any, VALUE : Any>(
|
||||
private val delegateCache: Cache<KEY, VALUE>
|
||||
private val delegateCache: Cache<KEY, VALUE>,
|
||||
) : Cache<KEY, VALUE> {
|
||||
|
||||
override fun get(key: KEY): VALUE? {
|
||||
|
|
|
@ -21,14 +21,14 @@ import timber.log.Timber
|
|||
internal class DraftOperations(
|
||||
private val messagingController: @NotNull MessagingController,
|
||||
private val messageStoreManager: @NotNull MessageStoreManager,
|
||||
private val saveMessageDataCreator: SaveMessageDataCreator
|
||||
private val saveMessageDataCreator: SaveMessageDataCreator,
|
||||
) {
|
||||
|
||||
fun saveDraft(
|
||||
account: Account,
|
||||
message: Message,
|
||||
existingDraftId: Long?,
|
||||
plaintextSubject: String?
|
||||
plaintextSubject: String?,
|
||||
): Long? {
|
||||
return try {
|
||||
val draftsFolderId = account.draftsFolderId ?: error("No Drafts folder configured")
|
||||
|
@ -51,7 +51,7 @@ internal class DraftOperations(
|
|||
message: Message,
|
||||
folderId: Long,
|
||||
existingDraftId: Long?,
|
||||
subject: String?
|
||||
subject: String?,
|
||||
): Long {
|
||||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
|
||||
|
@ -91,7 +91,7 @@ internal class DraftOperations(
|
|||
message: Message,
|
||||
folderId: Long,
|
||||
existingDraftId: Long?,
|
||||
plaintextSubject: String?
|
||||
plaintextSubject: String?,
|
||||
): Long {
|
||||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
val messageData = message.toSaveMessageData(plaintextSubject)
|
||||
|
@ -124,7 +124,7 @@ internal class DraftOperations(
|
|||
backend: Backend,
|
||||
account: Account,
|
||||
localFolder: LocalFolder,
|
||||
localMessage: LocalMessage
|
||||
localMessage: LocalMessage,
|
||||
) {
|
||||
val folderServerId = localFolder.serverId
|
||||
Timber.d("Uploading message [ID: %d] to remote folder '%s'", localMessage.databaseId, folderServerId)
|
||||
|
@ -139,7 +139,7 @@ internal class DraftOperations(
|
|||
if (messageServerId == null) {
|
||||
Timber.w(
|
||||
"Failed to get a server ID for the uploaded message. Removing local copy [ID: %d]",
|
||||
localMessage.databaseId
|
||||
localMessage.databaseId,
|
||||
)
|
||||
localMessage.destroy()
|
||||
} else {
|
||||
|
|
|
@ -24,13 +24,13 @@ val controllerModule = module {
|
|||
get<MessageStoreManager>(),
|
||||
get<SaveMessageDataCreator>(),
|
||||
get<SpecialLocalFoldersCreator>(),
|
||||
get(named("controllerExtensions"))
|
||||
get(named("controllerExtensions")),
|
||||
)
|
||||
}
|
||||
single<MessageCountsProvider> {
|
||||
DefaultMessageCountsProvider(
|
||||
preferences = get(),
|
||||
messageStoreManager = get()
|
||||
messageStoreManager = get(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ data class MessageCounts(val unread: Int, val starred: Int)
|
|||
|
||||
internal class DefaultMessageCountsProvider(
|
||||
private val preferences: Preferences,
|
||||
private val messageStoreManager: MessageStoreManager
|
||||
private val messageStoreManager: MessageStoreManager,
|
||||
) : MessageCountsProvider {
|
||||
override fun getMessageCounts(account: Account): MessageCounts {
|
||||
val search = LocalSearch().apply {
|
||||
|
@ -66,7 +66,7 @@ internal class DefaultMessageCountsProvider(
|
|||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
return MessageCounts(
|
||||
unread = messageStore.getUnreadMessageCount(conditions),
|
||||
starred = messageStore.getStarredMessageCount(conditions)
|
||||
starred = messageStore.getStarredMessageCount(conditions),
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Unable to getMessageCounts for account: %s", account)
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.StringTokenizer
|
|||
data class MessageReference(
|
||||
val accountUuid: String,
|
||||
val folderId: Long,
|
||||
val uid: String
|
||||
val uid: String,
|
||||
) {
|
||||
fun toIdentityString(): String {
|
||||
return buildString {
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.fsck.k9.search.isUnifiedInbox
|
|||
internal class NotificationOperations(
|
||||
private val notificationController: NotificationController,
|
||||
private val preferences: Preferences,
|
||||
private val messageStoreManager: MessageStoreManager
|
||||
private val messageStoreManager: MessageStoreManager,
|
||||
) {
|
||||
fun clearNotifications(search: LocalSearch) {
|
||||
if (search.isUnifiedInbox) {
|
||||
|
|
|
@ -22,7 +22,7 @@ internal class AccountPushController(
|
|||
private val preferences: Preferences,
|
||||
private val folderRepository: FolderRepository,
|
||||
backgroundDispatcher: CoroutineDispatcher = Dispatchers.IO,
|
||||
private val account: Account
|
||||
private val account: Account,
|
||||
) {
|
||||
private val coroutineScope = CoroutineScope(backgroundDispatcher)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ internal class AccountPushControllerFactory(
|
|||
private val backendManager: BackendManager,
|
||||
private val messagingController: MessagingController,
|
||||
private val folderRepository: FolderRepository,
|
||||
private val preferences: Preferences
|
||||
private val preferences: Preferences,
|
||||
) {
|
||||
fun create(account: Account): AccountPushController {
|
||||
return AccountPushController(
|
||||
|
@ -18,7 +18,7 @@ internal class AccountPushControllerFactory(
|
|||
messagingController,
|
||||
preferences,
|
||||
folderRepository,
|
||||
account = account
|
||||
account = account,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ internal val controllerPushModule = module {
|
|||
backendManager = get(),
|
||||
messagingController = get(),
|
||||
folderRepository = get(),
|
||||
preferences = get()
|
||||
preferences = get(),
|
||||
)
|
||||
}
|
||||
single {
|
||||
|
@ -24,7 +24,7 @@ internal val controllerPushModule = module {
|
|||
autoSyncManager = get(),
|
||||
pushNotificationManager = get(),
|
||||
connectivityManager = get(),
|
||||
accountPushControllerFactory = get()
|
||||
accountPushControllerFactory = get(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class PushController internal constructor(
|
|||
private val connectivityManager: ConnectivityManager,
|
||||
private val accountPushControllerFactory: AccountPushControllerFactory,
|
||||
private val coroutineScope: CoroutineScope = GlobalScope,
|
||||
private val coroutineDispatcher: CoroutineDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
|
||||
private val coroutineDispatcher: CoroutineDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher(),
|
||||
) {
|
||||
private val lock = Any()
|
||||
private var initializationStarted = false
|
||||
|
|
|
@ -13,5 +13,5 @@ data class EncryptionResult(
|
|||
val attachmentCount: Int,
|
||||
val previewResult: PreviewResult = PreviewResult.encrypted(),
|
||||
val textForSearchIndex: String? = null,
|
||||
val extraContentValues: ContentValues? = null
|
||||
val extraContentValues: ContentValues? = null,
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@ object IdentityHelper {
|
|||
RecipientType.CC,
|
||||
RecipientType.X_ORIGINAL_TO,
|
||||
RecipientType.DELIVERED_TO,
|
||||
RecipientType.X_ENVELOPE_TO
|
||||
RecipientType.X_ENVELOPE_TO,
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@ import timber.log.Timber
|
|||
class K9JobManager(
|
||||
private val workManager: WorkManager,
|
||||
private val preferences: Preferences,
|
||||
private val mailSyncWorkerManager: MailSyncWorkerManager
|
||||
private val mailSyncWorkerManager: MailSyncWorkerManager,
|
||||
) {
|
||||
fun scheduleAllMailJobs() {
|
||||
Timber.v("scheduling all jobs")
|
||||
|
|
|
@ -11,7 +11,7 @@ class K9WorkerFactory : WorkerFactory() {
|
|||
override fun createWorker(
|
||||
appContext: Context,
|
||||
workerClassName: String,
|
||||
workerParameters: WorkerParameters
|
||||
workerParameters: WorkerParameters,
|
||||
): ListenableWorker? {
|
||||
val workerClass = Class.forName(workerClassName).kotlin
|
||||
return getKoin().getOrNull(workerClass) { parametersOf(workerParameters) }
|
||||
|
|
|
@ -15,7 +15,7 @@ class MailSyncWorker(
|
|||
private val messagingController: MessagingController,
|
||||
private val preferences: Preferences,
|
||||
context: Context,
|
||||
parameters: WorkerParameters
|
||||
parameters: WorkerParameters,
|
||||
) : Worker(context, parameters) {
|
||||
|
||||
override fun doWork(): Result {
|
||||
|
|
|
@ -15,7 +15,7 @@ interface LogFileWriter {
|
|||
class LogcatLogFileWriter(
|
||||
private val contentResolver: ContentResolver,
|
||||
private val processExecutor: ProcessExecutor,
|
||||
private val coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO
|
||||
private val coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO,
|
||||
) : LogFileWriter {
|
||||
override suspend fun writeLogTo(contentUri: Uri) {
|
||||
return withContext(coroutineDispatcher) {
|
||||
|
|
|
@ -2,5 +2,5 @@ package com.fsck.k9.mail
|
|||
|
||||
enum class MailServerDirection {
|
||||
INCOMING,
|
||||
OUTGOING
|
||||
OUTGOING,
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.fsck.k9.Preferences
|
|||
class AutoExpandFolderBackendFoldersRefreshListener(
|
||||
private val preferences: Preferences,
|
||||
private val account: Account,
|
||||
private val folderRepository: FolderRepository
|
||||
private val folderRepository: FolderRepository,
|
||||
) : BackendFoldersRefreshListener {
|
||||
private var isFirstSync = false
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fsck.k9.mail.Flag
|
|||
|
||||
internal class CacheAwareMessageMapper<T>(
|
||||
private val cache: MessageListCache,
|
||||
private val messageMapper: MessageMapper<T>
|
||||
private val messageMapper: MessageMapper<T>,
|
||||
) : MessageMapper<T?> {
|
||||
override fun map(message: MessageDetailsAccessor): T? {
|
||||
val messageId = message.id
|
||||
|
@ -21,7 +21,7 @@ internal class CacheAwareMessageMapper<T>(
|
|||
|
||||
private class CacheAwareMessageDetailsAccessor(
|
||||
private val cache: MessageListCache,
|
||||
private val message: MessageDetailsAccessor
|
||||
private val message: MessageDetailsAccessor,
|
||||
) : MessageDetailsAccessor by message {
|
||||
override val isRead: Boolean
|
||||
get() {
|
||||
|
|
|
@ -6,5 +6,5 @@ data class CreateFolderInfo(
|
|||
val serverId: String,
|
||||
val name: String,
|
||||
val type: FolderType,
|
||||
val settings: FolderSettings
|
||||
val settings: FolderSettings,
|
||||
)
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.fsck.k9.mail.FolderType as RemoteFolderType
|
|||
class FolderRepository(
|
||||
private val messageStoreManager: MessageStoreManager,
|
||||
private val accountManager: AccountManager,
|
||||
private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
|
||||
private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO,
|
||||
) {
|
||||
private val sortForDisplay =
|
||||
compareByDescending<DisplayFolder> { it.folder.type == FolderType.INBOX }
|
||||
|
@ -39,18 +39,18 @@ class FolderRepository(
|
|||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
return messageStore.getDisplayFolders(
|
||||
displayMode = displayMode ?: account.folderDisplayMode,
|
||||
outboxFolderId = account.outboxFolderId
|
||||
outboxFolderId = account.outboxFolderId,
|
||||
) { folder ->
|
||||
DisplayFolder(
|
||||
folder = Folder(
|
||||
id = folder.id,
|
||||
name = folder.name,
|
||||
type = folderTypeOf(account, folder.id),
|
||||
isLocalOnly = folder.isLocalOnly
|
||||
isLocalOnly = folder.isLocalOnly,
|
||||
),
|
||||
isInTopGroup = folder.isInTopGroup,
|
||||
unreadMessageCount = folder.unreadMessageCount,
|
||||
starredMessageCount = folder.starredMessageCount
|
||||
starredMessageCount = folder.starredMessageCount,
|
||||
)
|
||||
}.sortedWith(sortForDisplay)
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class FolderRepository(
|
|||
id = folder.id,
|
||||
name = folder.name,
|
||||
type = folderTypeOf(account, folder.id),
|
||||
isLocalOnly = folder.isLocalOnly
|
||||
isLocalOnly = folder.isLocalOnly,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -116,14 +116,14 @@ class FolderRepository(
|
|||
id = folder.id,
|
||||
name = folder.name,
|
||||
type = folderTypeOf(account, folder.id),
|
||||
isLocalOnly = folder.isLocalOnly
|
||||
isLocalOnly = folder.isLocalOnly,
|
||||
),
|
||||
isInTopGroup = folder.isInTopGroup,
|
||||
isIntegrate = folder.isIntegrate,
|
||||
syncClass = folder.syncClass,
|
||||
displayClass = folder.displayClass,
|
||||
notifyClass = folder.notifyClass,
|
||||
pushClass = folder.pushClass
|
||||
pushClass = folder.pushClass,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class FolderRepository(
|
|||
id = folder.id,
|
||||
serverId = folder.serverIdOrThrow(),
|
||||
name = folder.name,
|
||||
type = folder.type.toFolderType()
|
||||
type = folder.type.toFolderType(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -148,14 +148,14 @@ class FolderRepository(
|
|||
id = folder.id,
|
||||
serverId = folder.serverIdOrThrow(),
|
||||
name = folder.name,
|
||||
type = folder.type.toFolderType()
|
||||
type = folder.type.toFolderType(),
|
||||
),
|
||||
isInTopGroup = folder.isInTopGroup,
|
||||
isIntegrate = folder.isIntegrate,
|
||||
syncClass = folder.syncClass,
|
||||
displayClass = folder.displayClass,
|
||||
notifyClass = folder.notifyClass,
|
||||
pushClass = folder.pushClass
|
||||
pushClass = folder.pushClass,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ class FolderRepository(
|
|||
|
||||
private data class AccountContainer(
|
||||
val account: Account,
|
||||
val folderDisplayMode: FolderMode
|
||||
val folderDisplayMode: FolderMode,
|
||||
)
|
||||
|
||||
data class Folder(val id: Long, val name: String, val type: FolderType, val isLocalOnly: Boolean)
|
||||
|
@ -302,7 +302,7 @@ data class FolderDetails(
|
|||
val syncClass: FolderClass,
|
||||
val displayClass: FolderClass,
|
||||
val notifyClass: FolderClass,
|
||||
val pushClass: FolderClass
|
||||
val pushClass: FolderClass,
|
||||
)
|
||||
|
||||
data class RemoteFolderDetails(
|
||||
|
@ -312,14 +312,14 @@ data class RemoteFolderDetails(
|
|||
val syncClass: FolderClass,
|
||||
val displayClass: FolderClass,
|
||||
val notifyClass: FolderClass,
|
||||
val pushClass: FolderClass
|
||||
val pushClass: FolderClass,
|
||||
)
|
||||
|
||||
data class DisplayFolder(
|
||||
val folder: Folder,
|
||||
val isInTopGroup: Boolean,
|
||||
val unreadMessageCount: Int,
|
||||
val starredMessageCount: Int
|
||||
val starredMessageCount: Int,
|
||||
)
|
||||
|
||||
enum class FolderType {
|
||||
|
@ -330,5 +330,5 @@ enum class FolderType {
|
|||
TRASH,
|
||||
DRAFTS,
|
||||
ARCHIVE,
|
||||
SPAM
|
||||
SPAM,
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ data class FolderSettings(
|
|||
val notifyClass: FolderClass,
|
||||
val pushClass: FolderClass,
|
||||
val inTopGroup: Boolean,
|
||||
val integrate: Boolean
|
||||
val integrate: Boolean,
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ class FolderSettingsProvider(val preferences: Preferences, val account: Account)
|
|||
notifyClass = storage.getString("$prefix.notifyMode", null).toFolderClass(FolderClass.INHERITED),
|
||||
pushClass = storage.getString("$prefix.pushMode", null).toFolderClass(FolderClass.SECOND_CLASS),
|
||||
inTopGroup = storage.getBoolean("$prefix.inTopGroup", false),
|
||||
integrate = storage.getBoolean("$prefix.integrate", false)
|
||||
integrate = storage.getBoolean("$prefix.integrate", false),
|
||||
).also {
|
||||
removeImportedFolderSettings(prefix)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.fsck.k9.mailstore.MoreMessages as StoreMoreMessages
|
|||
class K9BackendFolder(
|
||||
private val messageStore: MessageStore,
|
||||
private val saveMessageDataCreator: SaveMessageDataCreator,
|
||||
folderServerId: String
|
||||
folderServerId: String,
|
||||
) : BackendFolder {
|
||||
private val databaseId: String
|
||||
private val folderId: Long
|
||||
|
@ -25,7 +25,7 @@ class K9BackendFolder(
|
|||
Init(
|
||||
folderId = folder.id,
|
||||
name = folder.name,
|
||||
visibleLimit = folder.visibleLimit
|
||||
visibleLimit = folder.visibleLimit,
|
||||
)
|
||||
} ?: error("Couldn't find folder $folderServerId")
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class K9BackendStorage(
|
|||
private val messageStore: MessageStore,
|
||||
private val folderSettingsProvider: FolderSettingsProvider,
|
||||
private val saveMessageDataCreator: SaveMessageDataCreator,
|
||||
private val listeners: List<BackendFoldersRefreshListener>
|
||||
private val listeners: List<BackendFoldersRefreshListener>,
|
||||
) : BackendStorage {
|
||||
override fun getFolder(folderServerId: String): BackendFolder {
|
||||
return K9BackendFolder(messageStore, saveMessageDataCreator, folderServerId)
|
||||
|
@ -53,7 +53,7 @@ class K9BackendStorage(
|
|||
serverId = folderInfo.serverId,
|
||||
name = folderInfo.name,
|
||||
type = folderInfo.type,
|
||||
settings = folderSettingsProvider.getFolderSettings(folderInfo.serverId)
|
||||
settings = folderSettingsProvider.getFolderSettings(folderInfo.serverId),
|
||||
)
|
||||
}
|
||||
messageStore.createFolders(createFolderInfo)
|
||||
|
|
|
@ -8,7 +8,7 @@ class K9BackendStorageFactory(
|
|||
private val folderRepository: FolderRepository,
|
||||
private val messageStoreManager: MessageStoreManager,
|
||||
private val specialFolderSelectionStrategy: SpecialFolderSelectionStrategy,
|
||||
private val saveMessageDataCreator: SaveMessageDataCreator
|
||||
private val saveMessageDataCreator: SaveMessageDataCreator,
|
||||
) {
|
||||
fun createBackendStorage(account: Account): K9BackendStorage {
|
||||
val messageStore = messageStoreManager.getMessageStore(account)
|
||||
|
@ -17,7 +17,7 @@ class K9BackendStorageFactory(
|
|||
preferences,
|
||||
folderRepository,
|
||||
specialFolderSelectionStrategy,
|
||||
account
|
||||
account,
|
||||
)
|
||||
val specialFolderListener = SpecialFolderBackendFoldersRefreshListener(specialFolderUpdater)
|
||||
val autoExpandFolderListener = AutoExpandFolderBackendFoldersRefreshListener(preferences, account, folderRepository)
|
||||
|
|
|
@ -17,7 +17,7 @@ val mailStoreModule = module {
|
|||
folderRepository = get(),
|
||||
messageStoreManager = get(),
|
||||
specialFolderSelectionStrategy = get(),
|
||||
saveMessageDataCreator = get()
|
||||
saveMessageDataCreator = get(),
|
||||
)
|
||||
}
|
||||
factory { SpecialLocalFoldersCreator(preferences = get(), localStoreProvider = get()) }
|
||||
|
@ -31,7 +31,7 @@ val mailStoreModule = module {
|
|||
encryptionExtractor = get(),
|
||||
messagePreviewCreator = get(),
|
||||
messageFulltextCreator = get(),
|
||||
attachmentCounter = get()
|
||||
attachmentCounter = get(),
|
||||
)
|
||||
}
|
||||
single { MessageListRepository(messageStoreManager = get()) }
|
||||
|
|
|
@ -10,7 +10,7 @@ data class MessageDetails(
|
|||
val replyTo: List<Address>,
|
||||
val to: List<Address>,
|
||||
val cc: List<Address>,
|
||||
val bcc: List<Address>
|
||||
val bcc: List<Address>,
|
||||
)
|
||||
|
||||
sealed interface MessageDate {
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mailstore
|
|||
import java.util.concurrent.CopyOnWriteArraySet
|
||||
|
||||
class MessageListRepository(
|
||||
private val messageStoreManager: MessageStoreManager
|
||||
private val messageStoreManager: MessageStoreManager,
|
||||
) {
|
||||
private val globalListeners = CopyOnWriteArraySet<MessageListChangedListener>()
|
||||
private val accountListeners = CopyOnWriteArraySet<Pair<String, MessageListChangedListener>>()
|
||||
|
@ -45,7 +45,7 @@ class MessageListRepository(
|
|||
selection: String,
|
||||
selectionArgs: Array<String>,
|
||||
sortOrder: String,
|
||||
messageMapper: MessageMapper<T>
|
||||
messageMapper: MessageMapper<T>,
|
||||
): List<T> {
|
||||
val messageStore = messageStoreManager.getMessageStore(accountUuid)
|
||||
val cache = MessageListCache.getCache(accountUuid)
|
||||
|
@ -62,7 +62,7 @@ class MessageListRepository(
|
|||
selection: String,
|
||||
selectionArgs: Array<String>,
|
||||
sortOrder: String,
|
||||
messageMapper: MessageMapper<T>
|
||||
messageMapper: MessageMapper<T>,
|
||||
): List<T> {
|
||||
val messageStore = messageStoreManager.getMessageStore(accountUuid)
|
||||
val cache = MessageListCache.getCache(accountUuid)
|
||||
|
@ -78,7 +78,7 @@ class MessageListRepository(
|
|||
accountUuid: String,
|
||||
threadId: Long,
|
||||
sortOrder: String,
|
||||
messageMapper: MessageMapper<T>
|
||||
messageMapper: MessageMapper<T>,
|
||||
): List<T> {
|
||||
val messageStore = messageStoreManager.getMessageStore(accountUuid)
|
||||
val cache = MessageListCache.getCache(accountUuid)
|
||||
|
|
|
@ -32,7 +32,7 @@ class MessageRepository(private val messageStoreManager: MessageStoreManager) {
|
|||
replyTo = replyToAddresses,
|
||||
to = toAddresses,
|
||||
cc = ccAddresses,
|
||||
bcc = bccAddresses
|
||||
bcc = bccAddresses,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class MessageRepository(private val messageStoreManager: MessageStoreManager) {
|
|||
"reply-to",
|
||||
"to",
|
||||
"cc",
|
||||
"bcc"
|
||||
"bcc",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ interface MessageStore {
|
|||
selection: String,
|
||||
selectionArgs: Array<String>,
|
||||
sortOrder: String,
|
||||
messageMapper: MessageMapper<out T?>
|
||||
messageMapper: MessageMapper<out T?>,
|
||||
): List<T>
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ interface MessageStore {
|
|||
selection: String,
|
||||
selectionArgs: Array<String>,
|
||||
sortOrder: String,
|
||||
messageMapper: MessageMapper<out T?>
|
||||
messageMapper: MessageMapper<out T?>,
|
||||
): List<T>
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.fsck.k9.message.html.HtmlSettings
|
|||
class MessageViewInfoExtractorFactory(
|
||||
private val attachmentInfoExtractor: AttachmentInfoExtractor,
|
||||
private val htmlProcessorFactory: HtmlProcessorFactory,
|
||||
private val resourceProvider: CoreResourceProvider
|
||||
private val resourceProvider: CoreResourceProvider,
|
||||
) {
|
||||
fun create(settings: HtmlSettings): MessageViewInfoExtractor {
|
||||
val htmlProcessor = htmlProcessorFactory.create(settings)
|
||||
|
|
|
@ -3,5 +3,5 @@ package com.fsck.k9.mailstore
|
|||
data class NotificationMessage(
|
||||
val message: LocalMessage,
|
||||
val notificationId: Int?,
|
||||
val timestamp: Long
|
||||
val timestamp: Long,
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.fsck.k9.mail.Flag
|
|||
*/
|
||||
class NotifierMessageStore(
|
||||
private val messageStore: MessageStore,
|
||||
private val localStore: LocalStore
|
||||
private val localStore: LocalStore,
|
||||
) : MessageStore by messageStore {
|
||||
|
||||
override fun saveRemoteMessage(folderId: Long, messageServerId: String, messageData: SaveMessageData) {
|
||||
|
|
|
@ -4,5 +4,5 @@ data class OutboxState(
|
|||
val sendState: SendState,
|
||||
val numberOfSendAttempts: Int,
|
||||
val sendError: String?,
|
||||
val sendErrorTimestamp: Long
|
||||
val sendErrorTimestamp: Long,
|
||||
)
|
||||
|
|
|
@ -18,7 +18,7 @@ class OutboxStateRepository(private val database: LockableDatabase, private val
|
|||
arrayOf(messageId.toString()),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
).use { cursor ->
|
||||
if (!cursor.moveToFirst()) {
|
||||
throw IllegalStateException("No outbox_state entry for message with id $messageId")
|
||||
|
@ -59,7 +59,7 @@ class OutboxStateRepository(private val database: LockableDatabase, private val
|
|||
"UPDATE $TABLE_NAME " +
|
||||
"SET $COLUMN_NUMBER_OF_SEND_ATTEMPTS = $COLUMN_NUMBER_OF_SEND_ATTEMPTS + 1 " +
|
||||
"WHERE $COLUMN_MESSAGE_ID = ?",
|
||||
arrayOf(messageId.toString())
|
||||
arrayOf(messageId.toString()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class OutboxStateRepository(private val database: LockableDatabase, private val
|
|||
"UPDATE $TABLE_NAME " +
|
||||
"SET $COLUMN_NUMBER_OF_SEND_ATTEMPTS = $COLUMN_NUMBER_OF_SEND_ATTEMPTS - 1 " +
|
||||
"WHERE $COLUMN_MESSAGE_ID = ?",
|
||||
arrayOf(messageId.toString())
|
||||
arrayOf(messageId.toString()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class OutboxStateRepository(private val database: LockableDatabase, private val
|
|||
COLUMN_SEND_STATE,
|
||||
COLUMN_NUMBER_OF_SEND_ATTEMPTS,
|
||||
COLUMN_ERROR_TIMESTAMP,
|
||||
COLUMN_ERROR
|
||||
COLUMN_ERROR,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,5 @@ data class SaveMessageData(
|
|||
val attachmentCount: Int,
|
||||
val previewResult: PreviewResult,
|
||||
val textForSearchIndex: String? = null,
|
||||
val encryptionType: String?
|
||||
val encryptionType: String?,
|
||||
)
|
||||
|
|
|
@ -11,12 +11,12 @@ class SaveMessageDataCreator(
|
|||
private val encryptionExtractor: EncryptionExtractor,
|
||||
private val messagePreviewCreator: MessagePreviewCreator,
|
||||
private val messageFulltextCreator: MessageFulltextCreator,
|
||||
private val attachmentCounter: AttachmentCounter
|
||||
private val attachmentCounter: AttachmentCounter,
|
||||
) {
|
||||
fun createSaveMessageData(
|
||||
message: Message,
|
||||
downloadState: MessageDownloadState,
|
||||
subject: String? = null
|
||||
subject: String? = null,
|
||||
): SaveMessageData {
|
||||
val now = System.currentTimeMillis()
|
||||
val date = message.sentDate?.time ?: now
|
||||
|
@ -34,7 +34,7 @@ class SaveMessageDataCreator(
|
|||
attachmentCount = encryptionResult.attachmentCount,
|
||||
previewResult = encryptionResult.previewResult,
|
||||
textForSearchIndex = encryptionResult.textForSearchIndex,
|
||||
encryptionType = encryptionResult.encryptionType
|
||||
encryptionType = encryptionResult.encryptionType,
|
||||
)
|
||||
} else {
|
||||
SaveMessageData(
|
||||
|
@ -46,7 +46,7 @@ class SaveMessageDataCreator(
|
|||
attachmentCount = attachmentCounter.getAttachmentCount(message),
|
||||
previewResult = messagePreviewCreator.createPreview(message),
|
||||
textForSearchIndex = messageFulltextCreator.createFulltext(message),
|
||||
encryptionType = null
|
||||
encryptionType = null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ package com.fsck.k9.mailstore
|
|||
enum class SendState(val databaseName: String) {
|
||||
READY("ready"),
|
||||
RETRIES_EXCEEDED("retries_exceeded"),
|
||||
ERROR("error");
|
||||
ERROR("error"),
|
||||
;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
|
|
|
@ -4,7 +4,7 @@ package com.fsck.k9.mailstore
|
|||
* Update special folders when folders are added, removed, or changed.
|
||||
*/
|
||||
class SpecialFolderBackendFoldersRefreshListener(
|
||||
private val specialFolderUpdater: SpecialFolderUpdater
|
||||
private val specialFolderUpdater: SpecialFolderUpdater,
|
||||
) : BackendFoldersRefreshListener {
|
||||
|
||||
override fun onBeforeFolderListRefresh() = Unit
|
||||
|
|
|
@ -15,7 +15,7 @@ class SpecialFolderUpdater(
|
|||
private val preferences: Preferences,
|
||||
private val folderRepository: FolderRepository,
|
||||
private val specialFolderSelectionStrategy: SpecialFolderSelectionStrategy,
|
||||
private val account: Account
|
||||
private val account: Account,
|
||||
) {
|
||||
fun updateSpecialFolders() {
|
||||
val folders = folderRepository.getRemoteFolders(account)
|
||||
|
|
|
@ -9,7 +9,7 @@ import timber.log.Timber
|
|||
|
||||
class SpecialLocalFoldersCreator(
|
||||
private val preferences: Preferences,
|
||||
private val localStoreProvider: LocalStoreProvider
|
||||
private val localStoreProvider: LocalStoreProvider,
|
||||
) {
|
||||
// TODO: When rewriting the account setup code make sure this method is only called once. Until then this can be
|
||||
// called multiple times and we have to make sure folders are only created once.
|
||||
|
|
|
@ -12,6 +12,6 @@ interface Attachment {
|
|||
URI_ONLY,
|
||||
METADATA,
|
||||
COMPLETE,
|
||||
CANCELLED
|
||||
CANCELLED,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,10 @@ class ReplyActionStrategy(private val replyRoParser: ReplyToParser) {
|
|||
|
||||
data class ReplyActions(
|
||||
val defaultAction: ReplyAction?,
|
||||
val additionalActions: List<ReplyAction> = emptyList()
|
||||
val additionalActions: List<ReplyAction> = emptyList(),
|
||||
)
|
||||
|
||||
enum class ReplyAction {
|
||||
REPLY,
|
||||
REPLY_ALL
|
||||
REPLY_ALL,
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class BasicPartInfoExtractor {
|
|||
|
||||
return BasicPartInfo(
|
||||
displayName = part.getDisplayName(contentDisposition),
|
||||
size = contentDisposition?.getParameter("size")?.toLongOrNull()
|
||||
size = contentDisposition?.getParameter("size")?.toLongOrNull(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -47,5 +47,5 @@ class BasicPartInfoExtractor {
|
|||
|
||||
data class BasicPartInfo(
|
||||
val displayName: String,
|
||||
val size: Long?
|
||||
val size: Long?,
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ internal object DividerReplacer : TextToHtml.HtmlModifier {
|
|||
"(?:" + SIMPLE_DIVIDER + "|" + ASCII_SCISSORS + ")" +
|
||||
"\\s*" +
|
||||
"(?:\\n|$)" +
|
||||
")+"
|
||||
")+",
|
||||
)
|
||||
|
||||
override fun findModifications(text: CharSequence): List<HtmlModification> {
|
||||
|
|
|
@ -39,7 +39,7 @@ class EmailTextToHtml private constructor(private val text: String) {
|
|||
html.append(
|
||||
"<blockquote " +
|
||||
"class=\"gmail_quote\" " +
|
||||
"style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid "
|
||||
"style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid ",
|
||||
)
|
||||
html.append(quoteColor(depth))
|
||||
html.append("; padding-left: 1ex;\">")
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.message.html
|
|||
import app.k9mail.html.cleaner.HtmlProcessor
|
||||
|
||||
class HtmlProcessorFactory(
|
||||
private val displayHtmlFactory: DisplayHtmlFactory
|
||||
private val displayHtmlFactory: DisplayHtmlFactory,
|
||||
) {
|
||||
fun create(settings: HtmlSettings): HtmlProcessor {
|
||||
val displayHtml = displayHtmlFactory.create(settings)
|
||||
|
|
|
@ -2,5 +2,5 @@ package com.fsck.k9.message.html
|
|||
|
||||
data class HtmlSettings(
|
||||
val useDarkMode: Boolean,
|
||||
val useFixedWidthFont: Boolean
|
||||
val useFixedWidthFont: Boolean,
|
||||
)
|
||||
|
|
|
@ -221,7 +221,7 @@ internal class HttpUriParser : UriParser {
|
|||
private fun matchUnreservedPCTEncodedSubDelimClassesGreedy(
|
||||
text: CharSequence,
|
||||
startPos: Int,
|
||||
additionalCharacters: String
|
||||
additionalCharacters: String,
|
||||
): Int {
|
||||
val allowedCharacters = SUB_DELIM + "-._~" + additionalCharacters
|
||||
var shouldBeHex = 0
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.ArrayDeque
|
|||
class TextToHtml private constructor(
|
||||
private val text: CharSequence,
|
||||
private val html: StringBuilder,
|
||||
private val retainOriginalWhitespace: Boolean
|
||||
private val retainOriginalWhitespace: Boolean,
|
||||
) {
|
||||
fun appendAsHtmlFragment() {
|
||||
appendHtmlPrefix()
|
||||
|
@ -29,7 +29,7 @@ class TextToHtml private constructor(
|
|||
if (modification.endIndex > modificationStack.peek()?.endIndex ?: Int.MAX_VALUE) {
|
||||
error(
|
||||
"HtmlModification $modification must be fully contained within " +
|
||||
"outer HtmlModification ${modificationStack.peek()}"
|
||||
"outer HtmlModification ${modificationStack.peek()}",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ internal object UriLinkifier : TextToHtml.HtmlModifier {
|
|||
class LinkifyUri(
|
||||
startIndex: Int,
|
||||
endIndex: Int,
|
||||
val uri: CharSequence
|
||||
val uri: CharSequence,
|
||||
) : HtmlModification.Wrap(startIndex, endIndex) {
|
||||
|
||||
override fun appendPrefix(textToHtml: TextToHtml) {
|
||||
|
|
|
@ -3,5 +3,5 @@ package com.fsck.k9.message.html
|
|||
data class UriMatch(
|
||||
val startIndex: Int,
|
||||
val endIndex: Int,
|
||||
val uri: CharSequence
|
||||
val uri: CharSequence,
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ object UriMatcher {
|
|||
"mailto:" to genericUriParser,
|
||||
"matrix:" to genericUriParser,
|
||||
"rtsp:" to httpUriParser,
|
||||
"xmpp:" to genericUriParser
|
||||
"xmpp:" to genericUriParser,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ object UriMatcher {
|
|||
private const val ALLOWED_SEPARATORS_PATTERN = "(?:^|[$SCHEME_SEPARATORS])"
|
||||
private val URI_SCHEME = Regex(
|
||||
"$ALLOWED_SEPARATORS_PATTERN(${ SUPPORTED_URIS.keys.joinToString("|") })",
|
||||
RegexOption.IGNORE_CASE
|
||||
RegexOption.IGNORE_CASE,
|
||||
)
|
||||
|
||||
fun findUris(text: CharSequence): List<UriMatch> {
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.fsck.k9.mail.Message.RecipientType
|
|||
|
||||
class TextQuoteCreator(
|
||||
private val quoteDateFormatter: QuoteDateFormatter,
|
||||
private val resourceProvider: CoreResourceProvider
|
||||
private val resourceProvider: CoreResourceProvider,
|
||||
) {
|
||||
private val prefixInsertionRegex = Regex("(?m)^")
|
||||
|
||||
|
@ -16,7 +16,7 @@ class TextQuoteCreator(
|
|||
originalMessage: Message,
|
||||
messageBody: String?,
|
||||
quoteStyle: QuoteStyle,
|
||||
prefix: String
|
||||
prefix: String,
|
||||
): String {
|
||||
val body = messageBody ?: ""
|
||||
return when (quoteStyle) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.net.ConnectivityManager as SystemConnectivityManager
|
|||
|
||||
@Suppress("DEPRECATION")
|
||||
internal class ConnectivityManagerApi21(
|
||||
private val systemConnectivityManager: SystemConnectivityManager
|
||||
private val systemConnectivityManager: SystemConnectivityManager,
|
||||
) : ConnectivityManagerBase() {
|
||||
private var isRunning = false
|
||||
private var lastNetworkType: Int? = null
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.net.ConnectivityManager as SystemConnectivityManager
|
|||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
internal class ConnectivityManagerApi23(
|
||||
private val systemConnectivityManager: SystemConnectivityManager
|
||||
private val systemConnectivityManager: SystemConnectivityManager,
|
||||
) : ConnectivityManagerBase() {
|
||||
private var isRunning = false
|
||||
private var lastActiveNetwork: Network? = null
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.net.ConnectivityManager as SystemConnectivityManager
|
|||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
internal class ConnectivityManagerApi24(
|
||||
private val systemConnectivityManager: SystemConnectivityManager
|
||||
private val systemConnectivityManager: SystemConnectivityManager,
|
||||
) : ConnectivityManagerBase() {
|
||||
private var isRunning = false
|
||||
private var isNetworkAvailable: Boolean? = null
|
||||
|
|
|
@ -4,7 +4,7 @@ internal class AddNotificationResult private constructor(
|
|||
val notificationData: NotificationData,
|
||||
val notificationStoreOperations: List<NotificationStoreOperation>,
|
||||
val notificationHolder: NotificationHolder,
|
||||
val shouldCancelNotification: Boolean
|
||||
val shouldCancelNotification: Boolean,
|
||||
) {
|
||||
val cancelNotificationId: Int
|
||||
get() {
|
||||
|
@ -16,26 +16,26 @@ internal class AddNotificationResult private constructor(
|
|||
fun newNotification(
|
||||
notificationData: NotificationData,
|
||||
notificationStoreOperations: List<NotificationStoreOperation>,
|
||||
notificationHolder: NotificationHolder
|
||||
notificationHolder: NotificationHolder,
|
||||
): AddNotificationResult {
|
||||
return AddNotificationResult(
|
||||
notificationData,
|
||||
notificationStoreOperations,
|
||||
notificationHolder,
|
||||
shouldCancelNotification = false
|
||||
shouldCancelNotification = false,
|
||||
)
|
||||
}
|
||||
|
||||
fun replaceNotification(
|
||||
notificationData: NotificationData,
|
||||
notificationStoreOperations: List<NotificationStoreOperation>,
|
||||
notificationHolder: NotificationHolder
|
||||
notificationHolder: NotificationHolder,
|
||||
): AddNotificationResult {
|
||||
return AddNotificationResult(
|
||||
notificationData,
|
||||
notificationStoreOperations,
|
||||
notificationHolder,
|
||||
shouldCancelNotification = true
|
||||
shouldCancelNotification = true,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.fsck.k9.Account
|
|||
internal open class AuthenticationErrorNotificationController(
|
||||
private val notificationHelper: NotificationHelper,
|
||||
private val actionCreator: NotificationActionCreator,
|
||||
private val resourceProvider: NotificationResourceProvider
|
||||
private val resourceProvider: NotificationResourceProvider,
|
||||
) {
|
||||
fun showAuthenticationErrorNotification(account: Account, incoming: Boolean) {
|
||||
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, incoming)
|
||||
|
|
|
@ -17,7 +17,7 @@ internal class BaseNotificationDataCreator {
|
|||
color = account.chipColor,
|
||||
newMessagesCount = notificationData.newMessagesCount,
|
||||
lockScreenNotificationData = createLockScreenNotificationData(notificationData),
|
||||
appearance = createNotificationAppearance(account)
|
||||
appearance = createNotificationAppearance(account),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.fsck.k9.Account
|
|||
internal open class CertificateErrorNotificationController(
|
||||
private val notificationHelper: NotificationHelper,
|
||||
private val actionCreator: NotificationActionCreator,
|
||||
private val resourceProvider: NotificationResourceProvider
|
||||
private val resourceProvider: NotificationResourceProvider,
|
||||
) {
|
||||
fun showCertificateErrorNotification(account: Account, incoming: Boolean) {
|
||||
val notificationId = NotificationIds.getCertificateErrorNotificationId(account, incoming)
|
||||
|
|
|
@ -14,7 +14,7 @@ val coreNotificationModule = module {
|
|||
authenticationErrorNotificationController = get(),
|
||||
syncNotificationController = get(),
|
||||
sendFailedNotificationController = get(),
|
||||
newMailNotificationController = get()
|
||||
newMailNotificationController = get(),
|
||||
)
|
||||
}
|
||||
single { NotificationManagerCompat.from(get()) }
|
||||
|
@ -27,28 +27,28 @@ val coreNotificationModule = module {
|
|||
backgroundExecutor = Executors.newSingleThreadExecutor(),
|
||||
notificationManager = get<Context>().getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager,
|
||||
resourceProvider = get(),
|
||||
notificationLightDecoder = get()
|
||||
notificationLightDecoder = get(),
|
||||
)
|
||||
}
|
||||
single {
|
||||
AccountPreferenceSerializer(
|
||||
storageManager = get(),
|
||||
resourceProvider = get(),
|
||||
serverSettingsSerializer = get()
|
||||
serverSettingsSerializer = get(),
|
||||
)
|
||||
}
|
||||
single {
|
||||
CertificateErrorNotificationController(
|
||||
notificationHelper = get(),
|
||||
actionCreator = get(),
|
||||
resourceProvider = get()
|
||||
resourceProvider = get(),
|
||||
)
|
||||
}
|
||||
single {
|
||||
AuthenticationErrorNotificationController(
|
||||
notificationHelper = get(),
|
||||
actionCreator = get(),
|
||||
resourceProvider = get()
|
||||
resourceProvider = get(),
|
||||
)
|
||||
}
|
||||
single {
|
||||
|
@ -62,7 +62,7 @@ val coreNotificationModule = module {
|
|||
notificationManager = get(),
|
||||
newMailNotificationManager = get(),
|
||||
summaryNotificationCreator = get(),
|
||||
singleMessageNotificationCreator = get()
|
||||
singleMessageNotificationCreator = get(),
|
||||
)
|
||||
}
|
||||
single {
|
||||
|
@ -72,7 +72,7 @@ val coreNotificationModule = module {
|
|||
baseNotificationDataCreator = get(),
|
||||
singleMessageNotificationDataCreator = get(),
|
||||
summaryNotificationDataCreator = get(),
|
||||
clock = get()
|
||||
clock = get(),
|
||||
)
|
||||
}
|
||||
factory { NotificationContentCreator(context = get(), resourceProvider = get()) }
|
||||
|
@ -84,7 +84,7 @@ val coreNotificationModule = module {
|
|||
notificationHelper = get(),
|
||||
actionCreator = get(),
|
||||
resourceProvider = get(),
|
||||
lockScreenNotificationCreator = get()
|
||||
lockScreenNotificationCreator = get(),
|
||||
)
|
||||
}
|
||||
factory {
|
||||
|
@ -93,7 +93,7 @@ val coreNotificationModule = module {
|
|||
actionCreator = get(),
|
||||
lockScreenNotificationCreator = get(),
|
||||
singleMessageNotificationCreator = get(),
|
||||
resourceProvider = get()
|
||||
resourceProvider = get(),
|
||||
)
|
||||
}
|
||||
factory { LockScreenNotificationCreator(notificationHelper = get(), resourceProvider = get()) }
|
||||
|
@ -102,7 +102,7 @@ val coreNotificationModule = module {
|
|||
context = get(),
|
||||
resourceProvider = get(),
|
||||
notificationChannelManager = get(),
|
||||
notificationManager = get()
|
||||
notificationManager = get(),
|
||||
)
|
||||
}
|
||||
single {
|
||||
|
@ -110,7 +110,7 @@ val coreNotificationModule = module {
|
|||
notificationStoreProvider = get(),
|
||||
localStoreProvider = get(),
|
||||
messageStoreManager = get(),
|
||||
notificationContentCreator = get()
|
||||
notificationContentCreator = get(),
|
||||
)
|
||||
}
|
||||
factory { NotificationLightDecoder() }
|
||||
|
@ -122,7 +122,7 @@ val coreNotificationModule = module {
|
|||
NotificationSettingsUpdater(
|
||||
preferences = get(),
|
||||
notificationChannelManager = get(),
|
||||
notificationConfigurationConverter = get()
|
||||
notificationConfigurationConverter = get(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ import androidx.core.app.NotificationCompat
|
|||
|
||||
internal class LockScreenNotificationCreator(
|
||||
private val notificationHelper: NotificationHelper,
|
||||
private val resourceProvider: NotificationResourceProvider
|
||||
private val resourceProvider: NotificationResourceProvider,
|
||||
) {
|
||||
fun configureLockScreenNotification(
|
||||
builder: NotificationCompat.Builder,
|
||||
baseNotificationData: BaseNotificationData
|
||||
baseNotificationData: BaseNotificationData,
|
||||
) {
|
||||
when (baseNotificationData.lockScreenNotificationData) {
|
||||
LockScreenNotificationData.None -> {
|
||||
|
|
|
@ -12,7 +12,7 @@ internal class NewMailNotificationController(
|
|||
private val notificationManager: NotificationManagerCompat,
|
||||
private val newMailNotificationManager: NewMailNotificationManager,
|
||||
private val summaryNotificationCreator: SummaryNotificationCreator,
|
||||
private val singleMessageNotificationCreator: SingleMessageNotificationCreator
|
||||
private val singleMessageNotificationCreator: SingleMessageNotificationCreator,
|
||||
) {
|
||||
@Synchronized
|
||||
fun restoreNewMailNotifications(accounts: List<Account>) {
|
||||
|
@ -38,12 +38,12 @@ internal class NewMailNotificationController(
|
|||
fun removeNewMailNotifications(
|
||||
account: Account,
|
||||
clearNewMessageState: Boolean,
|
||||
selector: (List<MessageReference>) -> List<MessageReference>
|
||||
selector: (List<MessageReference>) -> List<MessageReference>,
|
||||
) {
|
||||
val notificationData = newMailNotificationManager.removeNewMailNotifications(
|
||||
account,
|
||||
clearNewMessageState,
|
||||
selector
|
||||
selector,
|
||||
)
|
||||
|
||||
if (notificationData != null) {
|
||||
|
@ -78,14 +78,14 @@ internal class NewMailNotificationController(
|
|||
|
||||
private fun createSingleNotification(
|
||||
baseNotificationData: BaseNotificationData,
|
||||
singleNotificationData: SingleNotificationData
|
||||
singleNotificationData: SingleNotificationData,
|
||||
) {
|
||||
singleMessageNotificationCreator.createSingleNotification(baseNotificationData, singleNotificationData)
|
||||
}
|
||||
|
||||
private fun createSummaryNotification(
|
||||
baseNotificationData: BaseNotificationData,
|
||||
summaryNotificationData: SummaryNotificationData
|
||||
summaryNotificationData: SummaryNotificationData,
|
||||
) {
|
||||
summaryNotificationCreator.createSummaryNotification(baseNotificationData, summaryNotificationData)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ internal data class NewMailNotificationData(
|
|||
val cancelNotificationIds: List<Int>,
|
||||
val baseNotificationData: BaseNotificationData,
|
||||
val singleNotificationData: List<SingleNotificationData>,
|
||||
val summaryNotificationData: SummaryNotificationData?
|
||||
val summaryNotificationData: SummaryNotificationData?,
|
||||
)
|
||||
|
||||
internal data class BaseNotificationData(
|
||||
|
@ -17,7 +17,7 @@ internal data class BaseNotificationData(
|
|||
val color: Int,
|
||||
val newMessagesCount: Int,
|
||||
val lockScreenNotificationData: LockScreenNotificationData,
|
||||
val appearance: NotificationAppearance
|
||||
val appearance: NotificationAppearance,
|
||||
)
|
||||
|
||||
internal sealed interface LockScreenNotificationData {
|
||||
|
@ -31,7 +31,7 @@ internal sealed interface LockScreenNotificationData {
|
|||
internal data class NotificationAppearance(
|
||||
val ringtone: String?,
|
||||
val vibrationPattern: LongArray?,
|
||||
val ledColor: Int?
|
||||
val ledColor: Int?,
|
||||
)
|
||||
|
||||
internal data class SingleNotificationData(
|
||||
|
@ -41,13 +41,13 @@ internal data class SingleNotificationData(
|
|||
val content: NotificationContent,
|
||||
val actions: List<NotificationAction>,
|
||||
val wearActions: List<WearNotificationAction>,
|
||||
val addLockScreenNotification: Boolean
|
||||
val addLockScreenNotification: Boolean,
|
||||
)
|
||||
|
||||
internal sealed interface SummaryNotificationData
|
||||
|
||||
internal data class SummarySingleNotificationData(
|
||||
val singleNotificationData: SingleNotificationData
|
||||
val singleNotificationData: SingleNotificationData,
|
||||
) : SummaryNotificationData
|
||||
|
||||
internal data class SummaryInboxNotificationData(
|
||||
|
@ -58,13 +58,13 @@ internal data class SummaryInboxNotificationData(
|
|||
val additionalMessagesCount: Int,
|
||||
val messageReferences: List<MessageReference>,
|
||||
val actions: List<SummaryNotificationAction>,
|
||||
val wearActions: List<SummaryWearNotificationAction>
|
||||
val wearActions: List<SummaryWearNotificationAction>,
|
||||
) : SummaryNotificationData
|
||||
|
||||
internal enum class NotificationAction {
|
||||
Reply,
|
||||
MarkAsRead,
|
||||
Delete
|
||||
Delete,
|
||||
}
|
||||
|
||||
internal enum class WearNotificationAction {
|
||||
|
@ -72,16 +72,16 @@ internal enum class WearNotificationAction {
|
|||
MarkAsRead,
|
||||
Delete,
|
||||
Archive,
|
||||
Spam
|
||||
Spam,
|
||||
}
|
||||
|
||||
internal enum class SummaryNotificationAction {
|
||||
MarkAsRead,
|
||||
Delete
|
||||
Delete,
|
||||
}
|
||||
|
||||
internal enum class SummaryWearNotificationAction {
|
||||
MarkAsRead,
|
||||
Delete,
|
||||
Archive
|
||||
Archive,
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ internal class NewMailNotificationManager(
|
|||
private val baseNotificationDataCreator: BaseNotificationDataCreator,
|
||||
private val singleMessageNotificationDataCreator: SingleMessageNotificationDataCreator,
|
||||
private val summaryNotificationDataCreator: SummaryNotificationDataCreator,
|
||||
private val clock: Clock
|
||||
private val clock: Clock,
|
||||
) {
|
||||
fun restoreNewMailNotifications(account: Account): NewMailNotificationData? {
|
||||
val notificationData = notificationRepository.restoreNotifications(account) ?: return null
|
||||
|
@ -26,7 +26,7 @@ internal class NewMailNotificationManager(
|
|||
notificationId = notificationHolder.notificationId,
|
||||
content = notificationHolder.content,
|
||||
timestamp = notificationHolder.timestamp,
|
||||
addLockScreenNotification = addLockScreenNotification
|
||||
addLockScreenNotification = addLockScreenNotification,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ internal class NewMailNotificationManager(
|
|||
cancelNotificationIds = emptyList(),
|
||||
baseNotificationData = createBaseNotificationData(notificationData),
|
||||
singleNotificationData = singleNotificationDataList,
|
||||
summaryNotificationData = createSummaryNotificationData(notificationData, silent = true)
|
||||
summaryNotificationData = createSummaryNotificationData(notificationData, silent = true),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ internal class NewMailNotificationManager(
|
|||
notificationId = result.notificationHolder.notificationId,
|
||||
content = result.notificationHolder.content,
|
||||
timestamp = result.notificationHolder.timestamp,
|
||||
addLockScreenNotification = result.notificationData.isSingleMessageNotification
|
||||
addLockScreenNotification = result.notificationData.isSingleMessageNotification,
|
||||
)
|
||||
|
||||
return NewMailNotificationData(
|
||||
|
@ -59,14 +59,14 @@ internal class NewMailNotificationManager(
|
|||
},
|
||||
baseNotificationData = createBaseNotificationData(result.notificationData),
|
||||
singleNotificationData = listOf(singleNotificationData),
|
||||
summaryNotificationData = createSummaryNotificationData(result.notificationData, silent)
|
||||
summaryNotificationData = createSummaryNotificationData(result.notificationData, silent),
|
||||
)
|
||||
}
|
||||
|
||||
fun removeNewMailNotifications(
|
||||
account: Account,
|
||||
clearNewMessageState: Boolean,
|
||||
selector: (List<MessageReference>) -> List<MessageReference>
|
||||
selector: (List<MessageReference>) -> List<MessageReference>,
|
||||
): NewMailNotificationData? {
|
||||
val result = notificationRepository.removeNotifications(account, clearNewMessageState, selector) ?: return null
|
||||
|
||||
|
@ -85,7 +85,7 @@ internal class NewMailNotificationManager(
|
|||
notificationId = notificationHolder.notificationId,
|
||||
content = notificationHolder.content,
|
||||
timestamp = notificationHolder.timestamp,
|
||||
addLockScreenNotification = result.notificationData.isSingleMessageNotification
|
||||
addLockScreenNotification = result.notificationData.isSingleMessageNotification,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ internal class NewMailNotificationManager(
|
|||
cancelNotificationIds = cancelNotificationIds,
|
||||
baseNotificationData = createBaseNotificationData(result.notificationData),
|
||||
singleNotificationData = singleNotificationData,
|
||||
summaryNotificationData = createSummaryNotificationData(result.notificationData, silent = true)
|
||||
summaryNotificationData = createSummaryNotificationData(result.notificationData, silent = true),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,14 @@ internal class NewMailNotificationManager(
|
|||
notificationId: Int,
|
||||
content: NotificationContent,
|
||||
timestamp: Long,
|
||||
addLockScreenNotification: Boolean
|
||||
addLockScreenNotification: Boolean,
|
||||
): SingleNotificationData {
|
||||
return singleMessageNotificationDataCreator.createSingleNotificationData(
|
||||
account,
|
||||
notificationId,
|
||||
content,
|
||||
timestamp,
|
||||
addLockScreenNotification
|
||||
addLockScreenNotification,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue