Module conversation
Expand description
conversation: what a conversation is made of, once for every app that has one.
Chat and Messages both talk to people, and stay two apps because their primary object differs: Chat’s is a channel (a room with a history, a membership and a mood), Messages’ is a person (a private thread that may arrive by SMS, Signal or WhatsApp). Neither is a subset of the other.
What they do not differ in is the mechanics underneath — when a day starts, what time a line was said, whether it arrived, what happens to the draft you were typing, which key sends, what an attachment does when you touch it. Each app used to invent those separately, which is why the same gesture behaved differently in the two windows. This module is that substrate, made of small, separately usable pieces, because the two apps paint differently: Chat composes the whole window immediately, Messages builds a widget tree.
| Piece | What it settles |
|---|---|
day | Day boundaries, the divider that marks one, the local clock a line carries |
delivery | One delivery-state vocabulary — the same words, glyphs and tones in both apps |
attachment | The ladder an attachment opens through: preview → full size → save → open the saved copy |
draft | A draft kept per conversation, and the line that shows it wherever the conversation is listed |
composer | Enter sends, Shift+Enter breaks the line, Escape lets go — the same rule in both |
list | ConversationList: the message list itself, for a widget-tree app |
unread | Where the reader’s unread lines start: the “New messages” divider |
jump | The pill that takes the reader back to what is unread or to what is now |
A host that adopts a piece keeps its own identity: a channel still shows authors and avatars, a private thread still shows one person and their transport.
Modules§
- attachment
- What an attachment does when a person touches it.
- composer
- Which key sends, in every conversation.
- day
- When a conversation’s day changes, and the clock each line carries.
- delivery
- One delivery vocabulary, rendered the same in every conversation.
- draft
- A draft is kept, and shown where the conversation is listed.
- earlier
- The place of earlier lines a conversation cannot get.
- jump
- The pill that takes a reader back to where they want to be, over a conversation they have scrolled away from.
- list
ConversationList— the message list a widget-tree app draws, the same conversation the painting apps compose themselves — the day breaks, the clock each line carries, the delivery vocabulary, the way consecutive lines from one person run together — so a message reads the same whether it arrived in a channel or a private thread.- unread
- Where a reader’s unread lines start.
Structs§
- Attachment
Face - The line under an inline preview, and the badge that says it opens.
- Attachment
Summary - Everything the ladder needs to know about one attachment.
- Conversation
Clock - The local zone and “now”, read once per pass.
- Conversation
Day - The local calendar day an instant falls on.
- Conversation
Entry Props - One line of a conversation: who said it and when, what it says, and how far on its way it is.
- Conversation
Line - One line of a conversation, as the list draws it.
- Conversation
List - The message list: a conversation, drawn. See the module docs.
- Conversation
List Props - A conversation, drawn as every conversation is drawn: each line on its own side, runs of one person’s consecutive messages under their name once, a divider where the day changes, and the time and the delivery state under your own.
- DayBreaks
- Walks a conversation’s lines and says which of them start a new day.
- DayDivider
DayDividerFaceas a widget, for a list built of widgets: a band across its column with the day’s label at its centre, where a conversation’s day changes.- DayDivider
Face - The day divider: a caption centred in a band, ruled out to both sides.
- Delivery
Face - A delivery state as it is painted: a small glyph and its word, in one line.
- Described
Conversation List - A described conversation: its list, and the lines it was made with.
- Draft
Book - The drafts a person has, by conversation key.
- Earlier
Unavailable Face - “Earlier messages aren’t available on this device’s hosts”, centred in the band the earlier lines would take.
- Jump
Face - The pill as it is drawn: which way back, whether the pointer is on it, and where it sits.
- List
Cache - A list’s layout, kept from one frame to the next.
- List
Face - The list’s painting and measuring, without the widget around it.
- List
Work - What a list’s layout did, counted.
- Saved
Copy - A saved copy of an attachment, where the app put it.
- Unread
Divider UnreadDividerProps, built: an unread divider over a row.- Unread
Divider Face - The “New messages” divider: a rule across the column, its label at the
trailing end, a list row tall like a day divider
(
super::DayDividerFace). - Unread
Divider Props - The divider as a widget, for a list built of widgets: a band across its column with its label at the trailing end, over the first line the reader had not read.
- Upload
Progress - How far an upload has got.
Enums§
- Attachment
Action - One rung of the ladder, as the app should carry it out.
- Attachment
Kind - What kind of thing an attachment is, which decides its glyph and its word.
- Composer
Intent - What a keystroke means to a composer.
- Composer
Rule - How a composer’s field ends a message.
- Conversation
Role - Which side of the column a line sits on, and what its bubble says.
- Delivery
State - The state a line shows, in the one vocabulary both apps speak.
- Delivery
Step - What a transport reported, before this toolkit decides how to say it.
- Jump
- Which way back a
JumpFaceoffers.
Constants§
- DRAFT_
PREVIEW_ CHARS - How much of a draft a listing shows before eliding.
Functions§
- bubble_
colors - The bubble and ink for a line on
theme. - day_
break_ indices - The indices of
dayswhose day differs from the one before (the first is always included). - draft_
line - The line a conversation’s row carries for a draft: “Draft: see you at 8”.
Nonewhen the body has nothing in it. - draft_
preview - The first line of a draft body, whitespace folded and elided: what a
conversation list shows under a name.
Nonewhen there is nothing to say (a body of spaces is not a draft). - full_
size_ rect - Where a picture of
width×heightsits inviewat full size. - pill_
reserve - The space a conversation leaves at its foot for a pill over it, so the pill never covers the last line: one control’s height and the half-gutter it stands from the foot.
- run_
breaks - Which lines start a new run: the first always, and then any line whose
author or side differs from the one before, or that follows it by more than
RUN_WINDOW_SECS.