diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 57bd82688..5578c48e6 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -359,3 +359,10 @@ Generated-in-code art is original and has no file to list: the UI icon set (`cra | `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_200.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | | `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_darkChosenOnLightPhone_settings_appearance_forced_dark_on_light_100.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | | `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_lightChosenOnDarkPhone_settings_appearance_forced_light_on_dark_100.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_dark.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the Android reading view's dark recolouring (MR8) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_light.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the Android reading view's dark recolouring (MR8) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_dark.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the Android reading view's dark recolouring (MR8) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_light.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the Android reading view's dark recolouring (MR8) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_dark.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the Android reading view's dark recolouring (MR8) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_light.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the Android reading view's dark recolouring (MR8) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_ownDarkDesign_recolour_own_dark_design_dark.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the Android reading view's dark recolouring (MR8) | diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyBlocks.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyBlocks.kt index 69ea91466..c526b0ca1 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyBlocks.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyBlocks.kt @@ -94,7 +94,7 @@ private fun SingleBlock(block: BlockView, env: BodyEnv, paper: Paper, width: Dp) when (val kind = block.kind) { is BlockKindView.Table -> TableBlock(kind.table, block.align, env, paper, room) is BlockKindView.Image -> PictureBlock(block, kind, env, paper, room) - is BlockKindView.Rule -> RuleBlock(block, env) + is BlockKindView.Rule -> RuleBlock(block, env, paper) is BlockKindView.ListItem -> ListItem(block, kind, env, paper) is BlockKindView.Heading -> TextBlock(block, env, paper, heading = kind.level.toInt()) is BlockKindView.Preformatted -> TextBlock(block, env, paper, mono = true) diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyFrames.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyFrames.kt index a19f4c50a..145149535 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyFrames.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyFrames.kt @@ -19,7 +19,6 @@ internal fun SidesView.hasAny() = top || right || bottom || left private const val DASH = 6f private const val DOT = 2f -private const val INVISIBLE_CONTRAST = 1.2 private const val MAX_LINE = 4 private const val TOP = 0 private const val RIGHT = 1 @@ -40,7 +39,7 @@ internal fun Modifier.frame(lines: List, sides: SidesView?, fallback: private fun DrawScope.drawSide(side: Int, line: LineView?, fallback: Color, paper: Paper) { val thickness = (line?.width?.toInt() ?: 0).coerceIn(1, MAX_LINE).dp.toPx() - val seen = line?.color?.rgb()?.takeIf { Readability.contrast(it, paper.rgb) >= INVISIBLE_CONTRAST } + val seen = line?.color?.rgb()?.let(paper::line) val effect = when (line?.style) { LineStyleView.DASHED -> PathEffect.dashPathEffect(floatArrayOf(DASH * thickness, DASH * thickness)) LineStyleView.DOTTED -> PathEffect.dashPathEffect(floatArrayOf(DOT * thickness, DOT * thickness)) diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTables.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTables.kt index b6689b5ad..84aecbec5 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTables.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTables.kt @@ -48,7 +48,7 @@ private const val PERCENT = 100 @Composable internal fun TableBlock(table: TableView, align: AlignView, env: BodyEnv, paper: Paper, room: Dp) { val width = tableWidth(table, room) - val own = table.background?.let { Paper.of(it.rgb(), paper.link) } ?: paper + val own = table.background?.let { paper.inner(it.rgb()) } ?: paper val shape = RoundedCornerShape(table.radius.toInt().dp) val outline = if (table.outline) Modifier.frame(table.lines, null, env.rule, own) else Modifier val box = Modifier @@ -140,7 +140,7 @@ private fun Modifier.alignIn(row: RowScope, v: VAlignView?): Modifier = with(row /** One cell: its background, lines and padding, and its blocks in the room that is left. */ @Composable internal fun CellBox(table: TableView, cell: CellView, env: BodyEnv, paper: Paper, width: Dp, modifier: Modifier) { - val own = cell.background?.let { Paper.of(it.rgb(), paper.link) } ?: paper + val own = cell.background?.let { paper.inner(it.rgb()) } ?: paper val pad = cell.padding // A cell of a data table that says nothing of its padding has the grid's own. val roomy = !table.layout && pad == null diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyText.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyText.kt index 5391067a1..c0f309bf3 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyText.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyText.kt @@ -28,14 +28,36 @@ import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.sp import uniffi.mailcraft_mobile.SpanView -/** The paper a piece of a message is drawn on and the ink that reads on it, as `0xRRGGBB`. */ -internal data class Paper(val rgb: Int, val ink: Int, val link: Int) { +/** + * The paper a piece of a message is drawn on and the ink that reads on it, as `0xRRGGBB`. [turn] is the + * reader's dark paper when the message's own colours are recoloured for a dark reading (#1966), else null. + */ +internal data class Paper(val rgb: Int, val ink: Int, val link: Int, val turn: Int? = null) { + /** A background the message asks for, as it is painted here. */ + fun back(asked: Int): Int = turn?.let { Readability.darkBackground(asked, it) } ?: asked + + /** A line the message asks for, as it is painted on this paper; null when it would not be seen. */ + fun line(asked: Int): Int? = back(asked).takeIf { Readability.contrast(it, rgb) >= INVISIBLE_CONTRAST } + + /** A horizontal rule the message colours: as written unless recoloured, then as [line]. */ + fun rule(asked: Int): Int? = if (turn == null) asked else line(asked) + + /** The paper of a box of the message's own inside this one. */ + fun inner(asked: Int): Paper = of(back(asked), link).copy(turn = turn) + + /** A text colour the message asks for, on [behind] (painted here), as it is drawn. */ + fun inkOn(asked: Int, behind: Int): Int = + if (turn != null) Readability.darkInk(asked, behind) else Readability.adjust(asked, behind) + companion object { /** A paper of [rgb] of the message's own, with the default ink for it. */ fun of(rgb: Int, link: Int): Paper = Paper(rgb, Readability.plainInk(rgb), Readability.adjust(link, rgb)) } } +/** The least contrast at which a line the message colours is drawn in its own colour. */ +private const val INVISIBLE_CONTRAST = 1.2 + /** A link's place in a text. */ internal class LinkRange(val start: Int, val end: Int, val link: LinkInfo) @@ -74,10 +96,10 @@ internal fun familyOf(font: String?, code: Boolean): FontFamily? { /** The colour of a span's text on [paper]: its own, adjusted to read, else the paper's ink (or the link colour). */ private fun inkOf(span: SpanView, paper: Paper, linked: Boolean): Int { - val behind = span.background?.rgb() ?: paper.rgb + val behind = span.background?.rgb()?.let(paper::back) ?: paper.rgb val own = span.color?.rgb() return when { - own != null -> Readability.adjust(own, behind) + own != null -> paper.inkOn(own, behind) linked -> Readability.adjust(paper.link, behind) span.background != null -> Readability.plainInk(behind) else -> paper.ink @@ -98,7 +120,7 @@ internal fun sizeOf(span: SpanView): Int? = span.size?.toInt()?.coerceIn(1, MAX_ /** The style of one span on [paper]: what it asks for, with the colours adjusted to read. */ internal fun styleOf(span: SpanView, paper: Paper, linked: Boolean): SpanStyle = SpanStyle( color = composeColor(inkOf(span, paper, linked)), - background = span.background?.let { composeColor(it.rgb()) } ?: Color.Unspecified, + background = span.background?.let { composeColor(paper.back(it.rgb())) } ?: Color.Unspecified, fontWeight = if (span.bold) FontWeight.Bold else null, fontStyle = if (span.italic) FontStyle.Italic else null, textDecoration = decorationOf(span, linked), diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTextBlocks.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTextBlocks.kt index 63c1d1f5e..8a11fd990 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTextBlocks.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/BodyTextBlocks.kt @@ -101,10 +101,10 @@ internal fun ListItem(block: BlockView, kind: BlockKindView.ListItem, env: BodyE /** A horizontal rule, as thick and as coloured as the message says (a line of 1 to 4 pixels). */ @Composable -internal fun RuleBlock(block: BlockView, env: BodyEnv) { +internal fun RuleBlock(block: BlockView, env: BodyEnv, paper: Paper) { val line = block.line val thickness = line.width.toInt().coerceIn(1, MAX_RULE) - val color = line.color?.let { composeColor(it.rgb()) } ?: env.rule + val color = line.color?.rgb()?.let(paper::rule)?.let(::composeColor) ?: env.rule Spacer( modifier = Modifier .padding(vertical = RULE_MARGIN.dp) diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Readability.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Readability.kt index a9b442d3d..93d20f868 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Readability.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Readability.kt @@ -8,6 +8,12 @@ import kotlin.math.pow * The colours of a message, adjusted to stay readable on the paper they are drawn on. A message asks * for colours as `0xRRGGBB`; a pair whose contrast falls short is changed (the text only, towards * black or white, whichever reads better) and a pair that reads well is left as the sender wrote it. + * + * In a dark reading of a message written for a white page (the dark theme, its light page off, #1966) + * the message's colours are recoloured by the desktop's rule (`crates/ui-egui/src/reading/colors.rs`): + * a light background has its lightness turned over, keeping its hue, muted ([darkBackground]); a dark + * or strong one stays; and a text colour that then falls short has its lightness turned over too + * before it is moved towards black or white ([darkInk]). Pictures are never recoloured. */ internal object Readability { /** The contrast ratio a text colour must have against its paper (WCAG's AA for body text). */ @@ -87,4 +93,79 @@ internal object Readability { } return (part(RED_SHIFT) shl RED_SHIFT) or (part(GREEN_SHIFT) shl GREEN_SHIFT) or part(0) } + + private const val RGB = 0xFFFFFF + private const val MAX_FLOOR = 0.4 + private const val MUTE = 0.6 + + /** + * [rgb] as a background in a dark reading: one lighter than a half has its lightness turned + * over, white landing on the lightness of [surface] (the reader's dark paper) and a half + * staying a half, its hue kept and muted a little; one a half or darker (black, a navy footer, + * a saturated red) stays as the sender wrote it. + */ + fun darkBackground(rgb: Int, surface: Int): Int { + val (h, s, l) = hsl(rgb) + if (l <= MIDDLE) return rgb and RGB + val floor = hsl(surface).third.coerceIn(0.0, MAX_FLOOR) + return fromHsl(h, s * MUTE, floor + (1.0 - l) * (1.0 - TWO * floor)) + } + + /** + * [ink] on [paper] in a dark reading: itself when it reads, else its lightness turned over (a + * dark blue a light blue), else [adjust]ed. + */ + fun darkInk(ink: Int, paper: Int): Int { + val own = ink and RGB + if (contrast(own, paper) >= MIN_CONTRAST) return own + val (h, s, l) = hsl(own) + val turned = fromHsl(h, s, 1.0 - l) + return adjust(if (contrast(turned, paper) > contrast(own, paper)) turned else own, paper) + } +} + +private const val HSL_BYTE = 255 +private const val HSL_RED = 16 +private const val HSL_GREEN = 8 +private const val HSL_ROUND = 0.5 +private const val HUE_SIXTHS = 6.0 +private const val TWO = 2.0 +private const val THREE = 3 +private const val FOUR = 4 +private const val TINY = 1e-6 + +/** Hue (0 to 6), saturation and lightness, as the desktop reckons them. */ +internal fun hsl(rgb: Int): Triple { + val r = (rgb shr HSL_RED and HSL_BYTE) / HSL_BYTE.toDouble() + val g = (rgb shr HSL_GREEN and HSL_BYTE) / HSL_BYTE.toDouble() + val b = (rgb and HSL_BYTE) / HSL_BYTE.toDouble() + val max = maxOf(r, g, b) + val min = minOf(r, g, b) + val l = (max + min) / TWO + val d = max - min + if (d < TINY) return Triple(0.0, 0.0, l) + val s = d / (1.0 - kotlin.math.abs(TWO * l - 1.0)).coerceAtLeast(TINY) + val h = when (max) { + r -> ((g - b) / d).mod(HUE_SIXTHS) + g -> (b - r) / d + TWO + else -> (r - g) / d + FOUR + } + return Triple(h, s.coerceIn(0.0, 1.0), l) +} + +/** The colour of hue [h] (0 to 6), saturation [s] and lightness [l]. */ +internal fun fromHsl(h: Double, s: Double, l: Double): Int { + val c = (1.0 - kotlin.math.abs(TWO * l - 1.0)) * s + val x = c * (1.0 - kotlin.math.abs(h.mod(TWO) - 1.0)) + val (r, g, b) = when (h.mod(HUE_SIXTHS).toInt()) { + 0 -> Triple(c, x, 0.0) + 1 -> Triple(x, c, 0.0) + 2 -> Triple(0.0, c, x) + THREE -> Triple(0.0, x, c) + FOUR -> Triple(x, 0.0, c) + else -> Triple(c, 0.0, x) + } + val m = l - c / TWO + fun byte(v: Double): Int = ((v + m) * HSL_BYTE + HSL_ROUND).toInt().coerceIn(0, HSL_BYTE) + return (byte(r) shl HSL_RED) or (byte(g) shl HSL_GREEN) or byte(b) } diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPage.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPage.kt index fcbbbd3f3..f82d49756 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPage.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPage.kt @@ -78,8 +78,10 @@ internal fun MessagePage( ) } val page = if (light) colors.surfaceContainerLowest else colors.surface + // A dark page recolours a message written for a white one (#1966); one with its own dark design keeps its colours. + val turn = (page.toArgb() and RGB_MASK).takeIf { appIsDark() && !light && !opened.view.darkDesign } val paper = Paper.of(page.toArgb() and RGB_MASK, colors.primary.toArgb() and RGB_MASK) - .copy(ink = colors.onSurface.toArgb() and RGB_MASK) + .copy(ink = colors.onSurface.toArgb() and RGB_MASK, turn = turn) Column(modifier = Modifier.fillMaxSize().background(MaterialTheme.colorScheme.surface)) { val title = opened.view.subject.ifBlank { shortName(opened.view.from) } ReadingBar(texts, tools, title, onMenu) diff --git a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/DarkRecolourScreenshotTest.kt b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/DarkRecolourScreenshotTest.kt new file mode 100644 index 000000000..a91561120 --- /dev/null +++ b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/DarkRecolourScreenshotTest.kt @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: MailCraft contributors +// SPDX-License-Identifier: MIT OR Apache-2.0 +@file:Suppress("MaxLineLength") + +package work.mailcraft.android + +import app.cash.paparazzi.DeviceConfig +import app.cash.paparazzi.Paparazzi +import com.android.ide.common.rendering.api.SessionParams +import com.android.resources.NightMode +import org.junit.Rule +import org.junit.Test +import uniffi.mailcraft_mobile.AlignView +import uniffi.mailcraft_mobile.BlockKindView +import uniffi.mailcraft_mobile.BlockView +import uniffi.mailcraft_mobile.LengthView +import uniffi.mailcraft_mobile.LineStyleView +import uniffi.mailcraft_mobile.LineView +import uniffi.mailcraft_mobile.SpanView +import uniffi.mailcraft_mobile.TableView + +/** Invented messages with colours of their own, for the dark recolouring (#1966). */ +internal object Coloured { + private fun para(vararg spans: SpanView, align: AlignView = AlignView.LEFT, space: UByte = 1u) = + BlockView(BlockKindView.Paragraph, spans.toList(), 0u, align, space, false, 0u, null, 0u, 0u, null, B.noLine) + + private fun lines(rgb: UInt) = List(4) { LineView(1u, LineStyleView.SOLID, rgb) } + + private fun boxed(table: TableView, background: UInt, line: UInt? = null) = + table.copy(background = background, outline = line != null, lines = line?.let(::lines) ?: emptyList()) + + /** A short reply its sender wrapped in a white box with a thin line, the original quoted below as Outlook writes it. */ + val boxedReply = Corpus.Entry( + "boxed", + Corpus.view( + 30uL, "RE: Shed delivery", + listOf( + B.tableBlock( + boxed( + B.table(layout = true, rows = listOf(listOf(B.cell(para(B.span("Thursday morning suits us. The gate code is 4512.", color = 0x000000u), space = 0u))))), + background = 0xFFFFFFu, line = 0x000000u, + ), + ), + para(B.span("-----Original Message-----", color = 0x000000u)), + para(B.span("From: ", bold = true, color = 0x000000u), B.span("Cy Example ", color = 0x000000u), space = 0u), + para(B.span("Subject: ", bold = true, color = 0x000000u), B.span("Shed delivery", color = 0x000000u), space = 0u), + para(B.span("When would you like the shed delivered? We have Thursday or Friday.", color = 0x1F497Du)), + ), + ), + emptyList(), + ) + + private const val SHOP = "https://shop.example/" + + /** A newsletter: a grey surround, a white column, a highlight, a navy footer with an orange heading and a filled button. */ + val brand = Corpus.Entry( + "brand", + Corpus.view( + 31uL, "Fern Hollow: autumn bulbs", + listOf( + B.tableBlock( + boxed( + B.table( + layout = true, + rows = listOf( + listOf( + B.cell( + B.tableBlock( + boxed( + B.table( + layout = true, + width = LengthView.Px(560u), + rows = listOf( + listOf( + B.cell( + B.block(BlockKindView.Heading(2u), B.span("Autumn bulbs are in", bold = true, color = 0x263D51u)), + para(B.span("Tulips, crocus and daffodils, ready to plant before the first frost.", color = 0x333333u)), + para(B.span("Order by Sunday", color = 0x000000u, background = 0xFFF59Du), B.span(" for free delivery.", color = 0x333333u)), + para(B.span("Sold out: ", bold = true, color = 0xFFFFFFu, background = 0xD32F2Fu), B.span(" giant alliums.", color = 0x333333u)), + padding = 16u, + ), + ), + listOf( + B.cell( + B.block(BlockKindView.Heading(3u), B.span("Visit the nursery", bold = true, color = 0xF7A136u), align = AlignView.CENTER), + para(B.span("Open every day from nine until five.", color = 0xFFFFFFu), align = AlignView.CENTER), + B.tableBlock( + boxed( + B.table( + layout = true, + rows = listOf(listOf(B.cell(para(B.span("Find us", bold = true, link = "${SHOP}visit", color = 0xF7A136u), align = AlignView.CENTER, space = 0u), background = 0x1B2B3Au, padding = 10u))), + ), + background = 0x1B2B3Au, line = 0xF7A136u, + ), + align = AlignView.CENTER, + ), + background = 0x263D51u, + padding = 16u, + ), + ), + ), + ), + background = 0xFFFFFFu, + ), + align = AlignView.CENTER, + ), + padding = 12u, + ), + ), + ), + ), + background = 0xEEEEEEu, + ), + ), + ), + ), + listOf("${SHOP}visit"), + ) + + /** A message whose sender made it dark already: its colours are left as they are. */ + val darkBody = Corpus.Entry( + "dark_body", + Corpus.view( + 32uL, "Night sky walk", + listOf( + B.tableBlock( + boxed( + B.table( + layout = true, + rows = listOf( + listOf( + B.cell( + B.block(BlockKindView.Heading(2u), B.span("Night sky walk", bold = true, color = 0xFFD54Fu)), + para(B.span("Meet at the garden gate at eight. Bring a torch with a red filter.", color = 0xE0E0E0u)), + para(B.span("Rain moves it to Saturday.", color = 0x90CAF9u)), + padding = 16u, + ), + ), + ), + ), + background = 0x121A2Au, + ), + ), + ), + ), + emptyList(), + ) +} + +/** A message's own colours with the light page off: as written in the light theme, recoloured dark in the dark one. */ +class DarkRecolourScreenshotTest { + @get:Rule + val paparazzi = Paparazzi( + deviceConfig = DeviceConfig.PIXEL_5, + renderingMode = SessionParams.RenderingMode.NORMAL, + maxPercentDifference = TOLERANCE, + ) + + private val darkPage = ReadingTools(null, { _, _ -> }, {}, ReadingPrefs(lightMessages = false), {}) + + private fun shoot(entry: Corpus.Entry) { + for ((suffix, night) in listOf("light" to false, "dark" to true)) { + paparazzi.unsafeUpdateConfig(DeviceConfig.PIXEL_5.copy(nightMode = if (night) NightMode.NIGHT else NightMode.NOTNIGHT)) + paparazzi.snapshot("recolour_${entry.name}_$suffix") { ReadingShots.Pane(ReadingShots.ui(entry), darkPage) } + } + } + + @Test + fun boxedReply() = shoot(Coloured.boxedReply) + + @Test + fun brandNewsletter() = shoot(Coloured.brand) + + @Test + fun darkBody() = shoot(Coloured.darkBody) + + /** A message with its own design for dark windows keeps its colours. */ + @Test + fun ownDarkDesign() { + paparazzi.unsafeUpdateConfig(DeviceConfig.PIXEL_5.copy(nightMode = NightMode.NIGHT)) + val entry = Corpus.Entry("own", Coloured.boxedReply.view.copy(darkDesign = true), emptyList()) + paparazzi.snapshot("recolour_own_dark_design_dark") { ReadingShots.Pane(ReadingShots.ui(entry), darkPage) } + } +} diff --git a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadabilityTest.kt b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadabilityTest.kt index 68eed50d0..a3851d53e 100644 --- a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadabilityTest.kt +++ b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadabilityTest.kt @@ -65,4 +65,103 @@ class ReadabilityTest { // A colour comes as 0xRRGGBB; anything above is not read. assertEquals(Readability.contrast(0x123456, white), Readability.contrast(0x7F123456, white), 0.0) } + // The dark recolouring (#1966): a message's light backgrounds turned dark, its text turned to read on them. + + private fun lightness(rgb: Int): Double { + val r = rgb shr 16 and 0xFF + val g = rgb shr 8 and 0xFF + val b = rgb and 0xFF + return (maxOf(r, g, b) + minOf(r, g, b)) / 510.0 + } + + @Test + fun whiteBecomesTheReadersDarkPaperAndAPaleGreyALittleLighter() { + val turned = Readability.darkBackground(white, darkPaper) + assertTrue(turned.toString(16), Readability.contrast(turned, darkPaper) < 1.05) + val grey = Readability.darkBackground(0xF2F2F2, darkPaper) + assertTrue(grey.toString(16), Readability.luminance(grey) > Readability.luminance(turned) && Readability.luminance(grey) < 0.05) + } + + @Test + fun darkAndStrongBackgroundsStayAsTheSenderWroteThem() { + // Black, the navy of a footer, a saturated red highlight: lightness a half or less. + for (rgb in listOf(black, 0x263D51, 0xFF0000, 0x2E7D32, 0x111111)) { + assertEquals(rgb.toString(16), rgb, Readability.darkBackground(rgb, darkPaper)) + } + } + + @Test + fun aTintKeepsItsHueDarkened() { + val note = Readability.darkBackground(0xFFF8E1, darkPaper) + val r = note shr 16 and 0xFF + val g = note shr 8 and 0xFF + val b = note and 0xFF + assertTrue(note.toString(16), r > b && g > b && Readability.luminance(note) < 0.08) + // Orange as a background (lightness just over a half) is darkened only a little, still orange. + val orange = Readability.darkBackground(0xF7A136, darkPaper) + assertTrue(orange.toString(16), (orange shr 16 and 0xFF) > (orange and 0xFF) && lightness(orange) in 0.3..0.5) + } + + @Test + fun lightnessTurnsOverSmoothly() { + var last = Readability.darkBackground(0, darkPaper) + for (v in 1..255) { + val now = Readability.darkBackground(v * 0x010101, darkPaper) + assertTrue("$v: ${last.toString(16)} then ${now.toString(16)}", kotlin.math.abs((now shr 16) - (last shr 16)) <= 3) + last = now + } + } + + @Test + fun darkTextTurnsLightKeepingItsHueAndTextThatReadsStays() { + assertEquals(white, Readability.darkInk(black, darkPaper)) + val blue = Readability.darkInk(0x1F497D, darkPaper) + assertTrue(blue.toString(16), (blue and 0xFF) > (blue shr 16 and 0xFF) && Readability.contrast(blue, darkPaper) >= Readability.MIN_CONTRAST) + // Orange on navy reads already; white on navy too. + assertEquals(0xF7A136, Readability.darkInk(0xF7A136, 0x263D51)) + assertEquals(white, Readability.darkInk(white, 0x263D51)) + } + + @Test + fun textJustShortOfReadingIsBroughtToRead() { + for (paper in listOf(darkPaper, 0x263D51, 0xFF0000, 0x808080, black)) { + for (ink in listOf(0x555555, 0x6B6B6B, 0x808080, 0x1C1C1C, 0x003366, 0xC00000, paper)) { + val shown = Readability.darkInk(ink, paper) + assertTrue("${ink.toString(16)} on ${paper.toString(16)}: ${shown.toString(16)}", Readability.contrast(shown, paper) >= Readability.MIN_CONTRAST) + } + } + } + + @Test + fun junkInTheHighBitsIsNotReadWhenTurning() { + assertEquals(Readability.darkBackground(0xFFFFFF, darkPaper), Readability.darkBackground(0x7FFFFFFF, darkPaper)) + assertEquals(Readability.darkInk(0x000000, darkPaper), Readability.darkInk(0x7F000000, darkPaper)) + } + @Test + fun aPaperRecoloursOnlyInADarkReading() { + val light = Paper.of(white, 0x1B5E8C) + // Without a dark reading (the light theme, the light page, a message's own dark design) nothing is turned. + assertEquals(white, light.inner(white).rgb) + assertEquals(0xFFF59D, light.back(0xFFF59D)) + assertEquals(black, light.inkOn(black, white)) + val dark = Paper.of(darkPaper, 0x9CCAFF).copy(turn = darkPaper) + val box = dark.inner(white) + assertTrue(box.rgb.toString(16), Readability.contrast(box.rgb, darkPaper) < 1.05) + assertEquals("a box inside a box is turned too", darkPaper, box.turn) + assertTrue(Readability.contrast(box.ink, box.rgb) >= Readability.MIN_CONTRAST) + assertEquals(white, box.inkOn(black, box.rgb)) + } + @Test + fun aLineThatWouldVanishIsLeftToTheReader() { + val dark = Paper.of(darkPaper, 0x9CCAFF).copy(turn = darkPaper) + // A white rule on the dark page turns dark too, and would not be seen: the reader's own line colour is used. + assertEquals(null, dark.line(white)) + // An orange line is darkened a little and still seen. + assertTrue(dark.line(0xF7A136) != null) + // Without a dark reading a white rule on the dark page is drawn as written. + assertEquals(white, Paper.of(darkPaper, 0x9CCAFF).line(white)) + // A rule is drawn as written unless recoloured, even one the sender hid in its paper's colour. + assertEquals(white, Paper.of(white, 0x1B5E8C).rule(white)) + assertEquals(null, dark.rule(white)) + } } diff --git a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadingCorpus.kt b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadingCorpus.kt index a1b39b6e1..448821584 100644 --- a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadingCorpus.kt +++ b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ReadingCorpus.kt @@ -82,7 +82,7 @@ internal object Corpus { class Entry(val name: String, val view: MessageView, val links: List) - private fun view(id: ULong, subject: String, blocks: List, remote: UInt = 0u, attachments: List = emptyList()) = + fun view(id: ULong, subject: String, blocks: List, remote: UInt = 0u, attachments: List = emptyList()) = MessageView( 1uL, id, 1uL, 1uL, ada, listOf(me), emptyList(), subject, 1_730_000_000L, false, false, emptyList(), attachments, blocks, false, remote, true, diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_dark.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_dark.png new file mode 100644 index 000000000..3e7ab247f Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_dark.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_light.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_light.png new file mode 100644 index 000000000..e15336594 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_boxedReply_recolour_boxed_light.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_dark.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_dark.png new file mode 100644 index 000000000..ed9d26bc7 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_dark.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_light.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_light.png new file mode 100644 index 000000000..ad85f00dc Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_brandNewsletter_recolour_brand_light.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_dark.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_dark.png new file mode 100644 index 000000000..812403b75 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_dark.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_light.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_light.png new file mode 100644 index 000000000..33ee685c2 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_darkBody_recolour_dark_body_light.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_ownDarkDesign_recolour_own_dark_design_dark.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_ownDarkDesign_recolour_own_dark_design_dark.png new file mode 100644 index 000000000..b605419ad Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_DarkRecolourScreenshotTest_ownDarkDesign_recolour_own_dark_design_dark.png differ diff --git a/docs/gaps.md b/docs/gaps.md index 1eff6819e..acb617653 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -34,7 +34,7 @@ this code base. | 16 | **No signing or encryption.** Nothing is signed, encrypted or opened yet. Progress (#30): an OpenPGP Digital signature (PGP/MIME or cleartext-signed text) is checked where the message is read, in the same bar with the same four results, against the Public keys kept for the sender's address, those on a contact's card with that address, the keys the message carries (attached key parts, its `Autocrypt:` header) and, for the window, the keys the owner's GnuPG keyring holds at full or ultimate validity; a key is Verified for an address only by the owner's word in the window after comparing its fingerprint, or by that keyring, never by a command or an agent; the signer's key in a message that checks, and a newer copy of a key kept already (so that a revocation reaches it), are kept for the sender's address, never a key that only rides along. The Public keys kept are listed, imported (an X.509 certificate for mail or OpenPGP Public keys; a file holding a private key is refused) and removed with `keys.list`, `keys.import` and `keys.remove`, steps of the history whose undo never takes a revocation away or marks a key Verified; File › Options › Security lists them (and a contact's card its own, with Add from file… and Remove in its form), and marks an OpenPGP key Verified in a dialog that shows its fingerprint in groups of four (also from Verify… on the reading pane's bar), never through a command an agent can run. The same page lists the owner's own certificates and keys (the Windows certificate store, the macOS keychain, PKCS#11 tokens, GnuPG's secret keys, keys imported here) and imports a `.p12` (into the Windows store or the keychain; on Linux and FreeBSD only an ECDSA one on P-256 or P-384, which MailCraft keeps, still protected by its passphrase, in the system's credential store) or an OpenPGP secret key (only one with a passphrase that signs with Ed25519 or ECDSA, kept the same way; an RSA key stays in GnuPG); nothing signs with them yet. an S/MIME Digital signature (detached `multipart/signed` or opaque signed data, DER or BER) is checked where the message is read, from the bytes it came as, and the reading pane says which of four it is in a bar above the message (verified; valid but the signer not verified: an issuer this computer doesn't trust, a certificate signed by itself, out of date, not for mail, for another address than the sender's or a message from several senders, or only part of the message signed (a signed part inside a wrapper such as a list's footer: never verified for the message, and one inside `multipart/alternative` isn't looked at); changed after signing; can't be checked: MD5 or SHA-1, an RSA key under 2048 bits, an algorithm not known, no certificate, more to check than a message is allowed, or a message read before its bytes were kept, with Check Again on the bar), with Details (signer, issuer, dates, SHA-256 fingerprint, the signing time the signer gives, "Revocation not checked"), and its row in the list wears a seal of the same four; agents read the same, read only (`mail.digitalSignature`, `digitalSignature` in `mail.get`). Trust is the system's certification authorities **for mail**, never the set trusted for web sites, read off the window's thread at start (the window doesn't wait for them, and what was checked before they came is checked again): on Linux the bundle the system's trust store extracts for mail (`email-ca-bundle.pem`, where the distribution has one: Arch, Fedora, openSUSE), and where none is there at all (Debian, Ubuntu, Linux Mint, whose `ca-certificates` is the web sites' set, and FreeBSD) the roots Mozilla trusts for mail in NSS's own list (`libnssckbi.so` of `libnss3`, or of FreeBSD's `security/nss` port, read through PKCS#11 from the system's places only, only NSS's own module and not p11-kit's in its place, in NSS's form of its trust objects and PKCS #11 3.2's; a root distrusted for mail, or for mail after a date, is left out; it is Mozilla's choice, so on Debian an authority deselected in `/etc/ca-certificates.conf` is still trusted for mail; a bundle that is there but empty or unreadable means no authority for mail, and NSS's list doesn't stand in for it; #1121), on Windows the trusted roots whose uses include secure mail; none on a system with neither, none yet on macOS (the keychain's trust settings for mail aren't read) or in the browser build, whose signers are "not verified" because no authority for mail could be read, said as that (and, until they are read at start, that they haven't been yet). The command line and its MCP server read the same. A path to an authority keeps RFC 5280's rules: each certificate valid, no critical extension not known here, each authority's path length and name constraints (mail addresses, and directory names compared as RFC 5280 §7.1 says), each authority's extended key usage allowing mail, other paths tried when one doesn't hold; validity is checked at the time of the check, not at the signing time the signer gives (their own word). An authority's certificate never signs mail. Revocation isn't checked and nothing is fetched for a check. A signer's certificate that rests on a trusted authority, is valid and is for the sender is kept for the sender's address in the mailbox, contact or not (an undo leaves it), and checks a later message of theirs that doesn't carry it. An opaque signed message is read as what it holds, from every way mail comes in: its text the body, its files and pictures with the attachments, for the reading pane, replies, search, the list and agents alike (one read before this build has it read from the bytes it came as once the mailbox is opened, or once those bytes arrive or an undo puts it back as it was: before each command, at most 32 and 64 MB of those bytes at a time (always one), never by the check itself); inside a wrapper, it is read in its place, before what the wrapper adds. One opaque part of a message is opened, and at most 64 MB of what it holds: signed data inside it stays a file, so that nesting can't multiply a message's size. The file it came as is kept beside what it holds (about twice the room), as the signature's own file. The very part a checked message's signature was checked from (its `smime.p7s`, or the `smime.p7m` an opaque one came as, told by its bytes) is reached from the bar's Details rather than the attachments; any other file of that name or type stays among them. The list's seal is worked out again when what it rests on changes (the day, the keys kept for the sender). A Digitally signed or Encrypted message keeps the bytes it came as from every way mail comes in (IMAP, Microsoft Graph, Exchange servers, JMAP, `.eml` and mbox files; not a `.pst` file, which holds no MIME for it), beside the mailbox file with the rest of its content, in CRLF lines, up to 64 MB a message and 1 GB a mailbox (past that a message comes in without them, as one read before); only a well-formed one counts: `multipart/signed` of two parts whose second is the signature its `protocol` names (S/MIME's or PGP/MIME's), `multipart/encrypted` with PGP/MIME's protocol and its two parts, `application/pkcs7-mime` with an `smime-type` or a base64 body, or a plain text body with a whole OpenPGP armour block (BEGIN to END, and a cleartext-signed one's signature). One read before, past the cap, or whose bytes went missing from the content folder (a build before #30 sweeps them) has them downloaded again with `mail.checkAgain` (Check Again on an S/MIME signed message's bar, else no button yet; a missing one asks by itself), taking those bytes alone; never one a part was removed from here. Save Message As writes those bytes as they are, header and all (#1561). When the message goes whole anywhere else (onto another account's IMAP server, a mailbox exported as one file or mbox, Forward as Attachment) its body is those bytes, under its own `Content-Type` (in CRLF lines; a message with a part sent as `binary` byte for byte, but put onto an IMAP server it is written from its parts, as an APPEND carries lines, and its signature doesn't check there), and its header is written from the message as any other's, with the same filters; a moved copy keeps its Digital signature but not the sending server's DKIM. Bytes that can't be read stay named until a download brings them again (a server's copy made from the parts, as one in a Microsoft mailbox is, brings none and takes nothing away), and are asked for again from the message's server, once; at opening only those surely gone from a content folder that is there and whole (the file's own folder there, a content file in the folder that reads, no cloud drive's stand-in: not an empty mount point or a share that dropped). A message moved to another account or to this computer whose bytes can't be read waits, and the status bar says so once: the copy it is being moved out of is asked for them first (one whose server is numbering its mailbox anew once it has its number again; one in a Microsoft folder being listed afresh counts as there until the listing ends without it, or the folder goes from the server, which is said) and stays until it has brought them; a server that refuses, or hands over nothing, is asked again, ever less often, and given up on only after five refusals over at least a day; after that, or when the bytes are bigger than this computer takes or there is no room for them here, the move is held with the copy where it was, and the status bar says why, once for each reason, and that Check again asks once more (with no room, it is asked again once there is room for them); it goes made of its parts only when that copy brought none, or went from its server, or when no server has one. Whatever decided where it went, and wherever it is moved on to, the copy it came from goes only once the bytes were written into the copy where it is now, are read whole from the disk here then (bytes in memory only once the mailbox file is saved with them), or that copy brought none: a copy made wrongly is one too many, never a loss. Moved on meanwhile, the copy in the mailbox it leaves goes instead, so undoing a move on between two sign-ins' Microsoft mailboxes leaves it where it went, and says why. The keys for signing and decrypting are reached where the system keeps them (Windows certificate store, macOS keychain, PKCS#11 tokens), nothing wired to them yet, and a PKCS#11 key that asks for its PIN at every use (a PIV card's signing key) is refused for now, as the PKCS#11 library we use leaves no room for that second login | | `mime` report | Regulated industries | 40–80 | [ROADMAP.md](../ROADMAP.md#after-beta) | | 17 | **Smaller things:** colour schemes of the owner's own (four accents and high contrast are chosen in File › Options, and a fifth swatch picks a colour of your own; no palette from a file), Action Shortcuts (Outlook's Quick Steps), search folders, automatic replies for accounts other than Microsoft ones (Microsoft accounts have them, File › Info › Automatic Replies), delivery receipts (read receipts are asked for since parity B6, never answered), the rest of Snooze (part 1, in 0.13.0, is the commands `mail.snooze`, `mail.unsnooze` and `mail.returnDue`: no menu or dialog yet), Sweep, Ignore and Clean Up Conversation, unsubscribing from many senders at once from a list of them (one message and a selection have Unsubscribe, #1207), Report Phishing (the warnings about a sender when reading came with #508, and those before sending, a lookalike recipient and outsiders who would see each other, with #509), the rest of Junk E-mail Options (a filter of its own, Safe Recipients, trusting contacts, blocking by country or language, and the lists kept on a server, which Microsoft Graph doesn't offer for Microsoft 365; Safe and Blocked Senders are there, per account, #504, #516), Focused Inbox, the rest of rules kept on the server (a Microsoft account's rules are kept on its server through Graph's mailbox rules, #566, with more of Outlook's conditions, exceptions and actions; still to come: its other conditions (words in the message header, a signed or encrypted message, a read receipt, a form, a sender in an address book, a message flagged for an action, any category, "on this computer only") and actions (deleting permanently, printing, a sound, a reply with a template, a server's reply with a message, a message in the New Item Alert window, starting a program or a script, a flag's colour, a flag for action in a number of days, marking it as a task, changing its sensitivity, a custom action), rules for the mail I send, changing a rule once it is made, forwarding by a rule, a shared mailbox's rules, and Sieve, RFC 5228, through ManageSieve, RFC 5804, or JMAP, RFC 9661, for other servers that offer it, such as Dovecot-based ones and Stalwart), forwarding kept on the server and automatic replies kept on a server other than Microsoft's, the organisation's directory in the suggestions while addressing (Check Names and People's Address Book search an Exchange server account's address list, #1262), voting, @mentions, contact groups, contacts to and from Outlook's CSV, task recurrence and assignment, Microsoft To Do's My Day and its delta reads (tasks themselves are kept in step, #248), shared calendars, the To-Do bar, column customisation, keytips, ribbon customisation | | [parity-checklist.md](parity-checklist.md) (68 of 315 in-scope catalog features lack a command; 17 more rows are out of scope) | Power users | varies | [parity-checklist.md](parity-checklist.md) | | 18 | **Releases are unsigned.** Twenty-three releases are published (v0.1.0 to v0.14.0), built on GitHub's machines for Windows, macOS, Linux, FreeBSD and the web; none is signed, so Windows and macOS warn before running them, and a new one is told of (File › About, the status bar, when the owner turned the check on; R7.3). A copy installed from the `.msi`, the macOS app or an AppImage downloads a newer release by itself (File › About › Install updates automatically, which an organisation can turn off) and keeps it only when MailCraft's own release signature over `SHA256SUMS.txt` verifies and its checksum matches, then installs it when the owner presses Restart to update or quits (Windows Installer with its administrator prompt, the app swapped on macOS, the AppImage replaced), keeping the version it replaced to go back to when the new one doesn't start twice running. No release is signed yet, so until the project's release keys are in the program nothing is downloaded at all, and installing has been tried only by tests, not on the three systems by hand. macOS has no disk-image artwork and no `mailto:` handling (a link arrives there as an Apple event the app does not receive yet; on Windows and Linux MailCraft is offered as the mail program and for `.eml`, `.ics` and `.vcf`, #505) | | [releasing.md](releasing.md), "What has been checked" | Anyone who won't run an unsigned program | 8–16 | [releasing.md](releasing.md) | -| 19 | **The Android app is in progress.** Mail list and reading pane are built (MB3.5, MB3.6); in an open message a sideways swipe moves to the next or previous message of the list it was opened from (#1963); not yet: fonts other than the generic families, the `inline-block` and floated boxes of a layout, a table's row spans drawn as spans, and on the phone accounts other than Microsoft ones, a shared mailbox's mail and calendars, calendars opened by address and the Favorites. A Microsoft account's Send/Receive on the phone sends the Outbox and brings the mail down, and the phone keeps the calendar (with the contacts), Microsoft To Do (once the owner has allowed it on Microsoft's page) and the bodies of new mail in step on its own, in the background too (MB3.18), through the same job code as the desktop (`mailcraft-host`'s `calendar_job` and `tasks_job`, over the engine's sync driver). Pictures (MB3.7) are built; the picture downloader and the sender-address rules sit in the binding crate (`crates/mobile/src/pictures.rs`), a near copy of what `apps/mailcraft/src/sender_images.rs` does, so the two can drift (for example on which providers wear a site's icon): MB3.16 moves them into `mailcraft-host` or a crate both use. Decoding a picture is capped in size, not yet streamed. Attachments (MB3.8) open in another app under the engine's opening verdict, save through the document picker, share through the system sheet and preview as pictures; an attachment is read whole into memory (at most 64 MB, less on a phone with little memory), not streamed to the other app, and one of a message whose headers alone are on the phone is fetched with its message first. Writing (MB3.9) is built on the engine's compose commands: reply, reply all, forward, new, To/Cc/Bcc with suggestions, From (accounts and shared mailboxes), per-account signatures, rich text, pictures and attachments, drafts autosaved; sending is queued and goes at the next sync, and an attachment to a draft is read whole into memory (25 MB each, 50 MB in all). `mailto:` links from other apps and what is shared into MailCraft (text, links, files) start a new message (MB3.10); nothing is sent by itself. Links are followed through the core and the platform (`Core.open_link`, `Platform.open_link`); the iOS app will implement the same entry. A new-mail notification about one message has up to three buttons, chosen and ordered in Settings › Notification buttons (Delete, Reply and Archive at first; Mark as read, Flag and Junk besides): Reply opens the reply ready to write, the others make the list's own change without opening the app, only while the message is still in the folder it arrived in, and it goes to the server at the next Send/Receive; the notification then says for a few seconds what was done, or that nothing could be (#1992). Calendar and task reminders (MB3.11) are raised by the system's alarms while the app is closed, from the core's schedule of the next 64 (`Core.reminder_schedule`); Dismiss and Snooze are the phone's own and are not shared with the desktop (whose dismissals are kept in its own settings), and a snooze whose event has already started is lost if the phone restarts before it comes. | | `apps/mailcraft-android/`, `crates/mobile/` | People who want MailCraft on a phone | 40–80 | [ROADMAP.md](../ROADMAP.md) | +| 19 | **The Android app is in progress.** Mail list and reading pane are built (MB3.5, MB3.6); in an open message a sideways swipe moves to the next or previous message of the list it was opened from (#1963); in the dark theme with the light page off, a message's own colours are recoloured dark by the desktop's rule, light backgrounds turned dark and its text turned to read on them, pictures left as they are (#1966); not yet: fonts other than the generic families, the `inline-block` and floated boxes of a layout, a table's row spans drawn as spans, and on the phone accounts other than Microsoft ones, a shared mailbox's mail and calendars, calendars opened by address and the Favorites. A Microsoft account's Send/Receive on the phone sends the Outbox and brings the mail down, and the phone keeps the calendar (with the contacts), Microsoft To Do (once the owner has allowed it on Microsoft's page) and the bodies of new mail in step on its own, in the background too (MB3.18), through the same job code as the desktop (`mailcraft-host`'s `calendar_job` and `tasks_job`, over the engine's sync driver). Pictures (MB3.7) are built; the picture downloader and the sender-address rules sit in the binding crate (`crates/mobile/src/pictures.rs`), a near copy of what `apps/mailcraft/src/sender_images.rs` does, so the two can drift (for example on which providers wear a site's icon): MB3.16 moves them into `mailcraft-host` or a crate both use. Decoding a picture is capped in size, not yet streamed. Attachments (MB3.8) open in another app under the engine's opening verdict, save through the document picker, share through the system sheet and preview as pictures; an attachment is read whole into memory (at most 64 MB, less on a phone with little memory), not streamed to the other app, and one of a message whose headers alone are on the phone is fetched with its message first. Writing (MB3.9) is built on the engine's compose commands: reply, reply all, forward, new, To/Cc/Bcc with suggestions, From (accounts and shared mailboxes), per-account signatures, rich text, pictures and attachments, drafts autosaved; sending is queued and goes at the next sync, and an attachment to a draft is read whole into memory (25 MB each, 50 MB in all). `mailto:` links from other apps and what is shared into MailCraft (text, links, files) start a new message (MB3.10); nothing is sent by itself. Links are followed through the core and the platform (`Core.open_link`, `Platform.open_link`); the iOS app will implement the same entry. A new-mail notification about one message has up to three buttons, chosen and ordered in Settings › Notification buttons (Delete, Reply and Archive at first; Mark as read, Flag and Junk besides): Reply opens the reply ready to write, the others make the list's own change without opening the app, only while the message is still in the folder it arrived in, and it goes to the server at the next Send/Receive; the notification then says for a few seconds what was done, or that nothing could be (#1992). Calendar and task reminders (MB3.11) are raised by the system's alarms while the app is closed, from the core's schedule of the next 64 (`Core.reminder_schedule`); Dismiss and Snooze are the phone's own and are not shared with the desktop (whose dismissals are kept in its own settings), and a snooze whose event has already started is lost if the phone restarts before it comes. | | `apps/mailcraft-android/`, `crates/mobile/` | People who want MailCraft on a phone | 40–80 | [ROADMAP.md](../ROADMAP.md) | ## Known rough edges (small, not ranked) diff --git a/docs/log.d/ROADMAP/progress/1966-dark-recolour.md b/docs/log.d/ROADMAP/progress/1966-dark-recolour.md new file mode 100644 index 000000000..6df47b1c3 --- /dev/null +++ b/docs/log.d/ROADMAP/progress/1966-dark-recolour.md @@ -0,0 +1 @@ +| 2026-11-26 | MR8: Android reading view: in the dark theme with the light page off, a message's own backgrounds turn dark and its text light, brand colours kept readable, pictures untouched (#1966) | diff --git a/docs/log.d/docs/gaps/revisions/1966-dark-recolour.md b/docs/log.d/docs/gaps/revisions/1966-dark-recolour.md new file mode 100644 index 000000000..a544e564c --- /dev/null +++ b/docs/log.d/docs/gaps/revisions/1966-dark-recolour.md @@ -0,0 +1 @@ +| 2026-11-26 | minor | Gap 19: Android dark page recolours a message's own colours as the desktop does (#1966) | diff --git a/packaging/release-notes.d/new/1966-dark-recolour.android.md b/packaging/release-notes.d/new/1966-dark-recolour.android.md new file mode 100644 index 000000000..2c166ca1c --- /dev/null +++ b/packaging/release-notes.d/new/1966-dark-recolour.android.md @@ -0,0 +1 @@ +- With "Light page in the dark theme" off, a message is recoloured for the dark theme: white and pale boxes turn dark, dark text turns light, and strong colours (a navy footer, an orange heading, a filled button) keep their hue and stay readable; pictures are not changed, and a message with its own dark design keeps its colours ([#1966](https://github.com/GITHUB_REPOSITORY/issues/1966)).