Merge main into fix-157-notification-open-message

This commit is contained in:
Jason Ross
2026-07-02 19:09:02 -05:00
committed by GitHub
6 changed files with 62 additions and 13 deletions
@@ -31,8 +31,8 @@ enum class MailProvider(
val appPasswordHelpUrl: String,
/**
* Setup instructions for the provider's two-factor prerequisite, or null when there isn't one.
* Only Gmail refuses to create app passwords until 2-Step Verification is on, so only Gmail
* links its setup article; Yahoo and iCloud gate nothing on it.
* Gmail and iCloud both refuse to issue app passwords until two-factor auth is on, so both
* link their own setup article; Yahoo gates nothing on it.
*/
val twoFactorHelpUrl: String? = null,
private val imapHost: String,
@@ -74,7 +74,12 @@ enum class MailProvider(
ICLOUD(
key = "icloud",
displayName = "iCloud Mail",
appPasswordHelpUrl = "https://appleid.apple.com",
// Apple's own app-specific-password instructions, not just the generic Apple ID sign-in
// page — this article also states the two-factor prerequisite below.
appPasswordHelpUrl = "https://support.apple.com/en-us/102654",
// Like Gmail, Apple won't issue an app-specific password until two-factor authentication
// is on, so link Apple's dedicated setup article too (issue #153).
twoFactorHelpUrl = "https://support.apple.com/en-us/102660",
imapHost = "imap.mail.me.com",
smtpHost = "smtp.mail.me.com",
// Apple documents smtp.mail.me.com:587 with STARTTLS for iCloud Mail.
@@ -151,15 +151,16 @@ fun AppPasswordSetupScreen(
)
Spacer(Modifier.height(12.dp))
// Only Gmail has a two-factor prerequisite (see MailProvider.twoFactorHelpUrl): its
// app-passwords page rejects accounts without 2-Step Verification, so point users
// there first instead of sending them to the app-passwords page's dead end.
// Gmail and iCloud both have a two-factor prerequisite (see
// MailProvider.twoFactorHelpUrl): neither will issue an app password until it's on, so
// point users there first instead of sending them to the app-passwords page's dead
// end. Yahoo has no twoFactorHelpUrl, so this renders nothing for it.
provider.twoFactorHelpUrl?.let { twoFactorHelpUrl ->
OutlinedButton(
onClick = { openUrl(twoFactorHelpUrl) },
modifier = Modifier.fillMaxWidth(),
) {
Text(stringResource(R.string.app_password_2fa_help))
Text(stringResource(twoFactorHelpLabel(provider)))
}
Spacer(Modifier.height(8.dp))
}
@@ -269,6 +270,16 @@ private fun providerIntro(provider: MailProvider): Int = when (provider) {
MailProvider.ICLOUD -> R.string.app_password_intro_icloud
}
/**
* Button copy for the two-factor prerequisite link, in each provider's own terminology — Google
* calls it "2-Step Verification", Apple "Two-Factor Authentication". Only reached for providers
* that expose [MailProvider.twoFactorHelpUrl]; Yahoo has none, so its branch here is unused.
*/
private fun twoFactorHelpLabel(provider: MailProvider): Int = when (provider) {
MailProvider.ICLOUD -> R.string.app_password_2fa_help_icloud
MailProvider.GMAIL, MailProvider.YAHOO -> R.string.app_password_2fa_help
}
private fun MailSecurity.label(): String = when (this) {
MailSecurity.SSL_TLS -> "SSL/TLS"
MailSecurity.STARTTLS -> "STARTTLS"
+1
View File
@@ -184,6 +184,7 @@
<string name="app_password_warning">Store this app password carefully — it grants full access to your email. LibreMail keeps it only on this device.</string>
<string name="app_password_open_page">Create an app password for %1$s</string>
<string name="app_password_2fa_help">How to turn on 2-Step Verification</string>
<string name="app_password_2fa_help_icloud">How to turn on Two-Factor Authentication</string>
<string name="app_password_open_failed">Couldn\'t open your browser</string>
<string name="app_password_email">Email address</string>
<string name="app_password_field">App password</string>