Skip to content

feat: F2 chat UX — rendering, navigation, chat list - #8

Merged
jsfraz merged 6 commits into
developmentfrom
feature/f2-chat-ux
Nov 17, 2026
Merged

jsfraz merged 6 commits into
developmentfrom
feature/f2-chat-ux

Conversation

@jsfraz

@jsfraz jsfraz commented Nov 17, 2026

Copy link
Copy Markdown
Owner

F2 — Chat UX (F2a), client only. Nothing in this PR touches the server or the API contract.

Extracted from Feature roadmap → F2. Deferred by agreement, to be picked up as F2b: search in chat history, global search with sender/date/type filters, jump to date, chat folders/filters.

What lands

Rendering

  • Reply quoting: whisperMsg: 3 text envelope carries the quoted sender, timestamp and a 160-char preview. Plain messages stay raw UTF-8, so an older client still reads them.
  • Formatting: **bold**, *italic*, ~~strike~~, inline mono, fenced code blocks, ||spoiler|| (tap to reveal).
  • Long messages fold behind "Show full message".
  • Emoji-only messages drop the bubble chrome and render large (up to 3).
  • Links open in the browser; phone numbers and Street 12, City addresses copy on tap.

Navigation

  • The list is grouped into slivers by calendar day: each day gets a pinned header that doubles as the date separator.
  • "New messages" divider, anchored before the chat marks everything read; opening the chat scrolls to it (jump to first unread).
  • Floating down button with the count of messages that arrived while reading further up.
  • Long-press starts multi-select (copy, forward, delete for me). Double-tap or a horizontal swipe replies. Single-message actions (save, resend) stay reachable from the selection bar with one message picked.

Chat list

  • Unread counter badge per conversation, derived from the read flags in one pass (no new state that can drift).
  • Swipe right pins, swipe left deletes; both spring back and open an action instead of removing the row.
  • Pinned chats sort first. Pin state is local only, in a small conversations Hive box keyed by peer id (F2b can extend it with archived/muted).

Notes

  • No new dependency. LinkifiedText is replaced by FormattedText.
  • PrivateMessage gains Hive fields 16–18 (quoted sender/timestamp/preview); the adapter was regenerated with build_runner.
  • The reversed list became a normal axis so pinned headers pin at the top; window growth and history pages now compensate maxScrollExtent, and the chat re-anchors on new messages and on keyboard open.
  • The repo has no CHANGELOG.md (release notes are generated from pubspec.yaml), so the phase entry is this description rather than a file.

Verification

  • flutter analyze --no-fatal-infos: no errors, no warnings (only pre-existing infos in register_page/settings_page).
  • flutter test: 122/122 pass, including new message_format_test, text_envelope_test, chat_bubble_test and conversation_meta_test.
  • Not verified on a device: scroll anchoring, sticky headers and swipe gestures were not exercised in a running build (no display in the session).

Messages are still plain UTF-8 on the wire, so any older client keeps
reading them. A reply is the only case that needs structure: it carries a
`whisperMsg: 3` text envelope with the quoted sender, timestamp and a
preview, which keeps the quote readable after the original is deleted
locally.

Rendering moves from one linkified Text span to a small parser: bold,
italic, strike, inline mono, fenced code blocks and spoilers that stay
covered until tapped. Links open in the browser, phone numbers and
addresses (`Street 12, City`) copy on tap. Emoji-only messages drop the
bubble and read large, long messages fold behind "Show full".

No new dependency. `LinkifiedText` goes away; `FormattedText` replaces it.
The message list is no longer reversed. Slivers group it by calendar day,
so each day gets a pinned header that doubles as the date separator, and
the "new messages" divider can be a real widget. The anchor is captured
before the chat marks everything read, so a divider exists at all; opening
the chat scrolls to it, which also gives "jump to first unread".

With a normal axis the window has to be grown without moving the screen:
both the local window and a fetched history page measure maxScrollExtent
before and after and shift the offset by the delta. The chat still lands
on the newest message at open, follows new messages while at the bottom,
and re-anchors when the keyboard opens.

Long-press now starts a multi-select (copy, forward, delete for me) and
double-tap or a horizontal swipe quotes the message in the composer. The
single-message sheet, which used to hang off the long-press, stays
reachable from the selection bar while exactly one message is picked, so
save/resend are not lost. Forwarding takes a list now.
The chat list only bolded a row when its newest message was unread, which
hides a conversation that got a second unread message. Rows now carry the
count of unread incoming messages, derived from the `read` flags in one
pass over the message box, so no new state can drift from them.

Pin and delete are swipe actions that always spring back: the gesture
opens the action, it never removes a row on its own. Pin state is local
only (the phase adds nothing to the server) and lives in a small
`conversations` box keyed by the other side's id, which F2b can extend
with archived/muted without a schema change. Pinned chats sort first, so
the cache sorts once and the notifier keeps that order instead of sorting
again by timestamp.
A phone number is something the user taps, so it now carries the same
solid underline as a URL instead of a dotted one. Addresses keep their
dotted underline: a tap only copies them.

E-mail addresses were not detected at all, so they rendered as plain
text. They are now one of the tappable entities (opening the mail client)
and are underlined the same way.
The `Street 12, City` heuristic matched ordinary text ("Dnes 3 zprávy")
about as often as a real address, and copying an address on tap is not
worth that noise. Phone numbers and e-mails stay tappable.
"Zobrazit více" fits the bubble; the previous wording wrapped.
@jsfraz
jsfraz merged commit be4a5a6 into development Nov 17, 2026
1 check passed
@jsfraz
jsfraz deleted the feature/f2-chat-ux branch November 17, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant