feat(compose): remember last-used font and size #78

Closed
opened 2026-07-01 21:22:50 +00:00 by JMR-dev · 0 comments
JMR-dev commented 2026-07-01 21:22:50 +00:00 (Migrated from github.com)

Part of the compose rich-formatting epic — stacked on the rich-text foundation ticket (branch feat-richtext-foundation), which provides RichBaseStyle + the wrapper <div style="…"> round-trip. Compile-independent of the font/size picker tickets — only uses foundation types.

Scope

  • data/settings/SettingsRepository.kt (existing app-level Preferences DataStore): add lastFontCss / lastFontSizePt keys, AppSettings fields, and a setter, following the existing pattern.
  • Inject SettingsRepository into ComposeViewModel (not currently injected). On send: parse the outgoing bodyHtml with RichTextHtml.fromHtml and persist the base style or the last FontFamily/FontSize span values. On brand-new compositions (draftId == null — replies/forwards arrive as drafts): seed RichBaseStyle so the whole message defaults to the remembered font/size.

Acceptance

  • MockK VM tests: persists on send; seeds on new compose; existing drafts untouched; plaintext-only messages stay plaintext when no font pref is stored. No Room change.
Part of the compose rich-formatting epic — stacked on the rich-text foundation ticket (branch `feat-richtext-foundation`), which provides `RichBaseStyle` + the wrapper `<div style="…">` round-trip. Compile-independent of the font/size picker tickets — only uses foundation types. **Scope** - `data/settings/SettingsRepository.kt` (existing app-level Preferences DataStore): add `lastFontCss` / `lastFontSizePt` keys, `AppSettings` fields, and a setter, following the existing pattern. - Inject `SettingsRepository` into `ComposeViewModel` (not currently injected). On send: parse the outgoing `bodyHtml` with `RichTextHtml.fromHtml` and persist the base style or the last `FontFamily`/`FontSize` span values. On brand-new compositions (`draftId == null` — replies/forwards arrive as drafts): seed `RichBaseStyle` so the whole message defaults to the remembered font/size. **Acceptance** - MockK VM tests: persists on send; seeds on new compose; existing drafts untouched; plaintext-only messages stay plaintext when no font pref is stored. No Room change.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JMR-dev/LibreMail#78