Add isTrusted
property to AutoDiscoveryResult.Settings
This commit is contained in:
parent
671910ca16
commit
0653fbfb68
4 changed files with 16 additions and 0 deletions
|
@ -12,6 +12,17 @@ sealed interface AutoDiscoveryResult {
|
|||
data class Settings(
|
||||
val incomingServerSettings: IncomingServerSettings,
|
||||
val outgoingServerSettings: OutgoingServerSettings,
|
||||
|
||||
/**
|
||||
* Indicates whether the mail server settings lookup was using only trusted channels.
|
||||
*
|
||||
* `true` if the settings lookup was only using trusted channels, e.g. lookup via HTTPS where the server
|
||||
* presented a trusted certificate. `false´ otherwise.
|
||||
*
|
||||
* IMPORTANT: When this value is `false`, the settings should be presented to the user and only be used after
|
||||
* the user has given consent.
|
||||
*/
|
||||
val isTrusted: Boolean,
|
||||
) : AutoDiscoveryResult
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,6 +42,7 @@ internal class RealAutoconfigFetcher(
|
|||
AutoDiscoveryResult.Settings(
|
||||
incomingServerSettings = parserResult.incomingServerSettings,
|
||||
outgoingServerSettings = parserResult.outgoingServerSettings,
|
||||
isTrusted = false,
|
||||
)
|
||||
}
|
||||
is ParserError -> AutoDiscoveryResult.NoUsableSettingsFound
|
||||
|
|
|
@ -49,6 +49,7 @@ internal class MockAutoconfigFetcher : AutoconfigFetcher {
|
|||
authenticationType = PasswordCleartext,
|
||||
username = "irrelevant@domain.example",
|
||||
),
|
||||
isTrusted = true,
|
||||
)
|
||||
val RESULT_TWO = AutoDiscoveryResult.Settings(
|
||||
incomingServerSettings = ImapServerSettings(
|
||||
|
@ -65,6 +66,7 @@ internal class MockAutoconfigFetcher : AutoconfigFetcher {
|
|||
authenticationType = PasswordEncrypted,
|
||||
username = "irrelevant@company.example",
|
||||
),
|
||||
isTrusted = true,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,6 +155,7 @@ class PriorityParallelRunnerTest {
|
|||
authenticationType = PasswordCleartext,
|
||||
username = "user@domain.example",
|
||||
),
|
||||
isTrusted = true,
|
||||
)
|
||||
|
||||
private val DISCOVERY_RESULT_TWO = AutoDiscoveryResult.Settings(
|
||||
|
@ -172,6 +173,7 @@ class PriorityParallelRunnerTest {
|
|||
authenticationType = PasswordCleartext,
|
||||
username = "user@domain.example",
|
||||
),
|
||||
isTrusted = true,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue