Skip to main content

Module conversation

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.

PieceWhat it settles
dayDay boundaries, the divider that marks one, the local clock a line carries
deliveryOne delivery-state vocabulary — the same words, glyphs and tones in both apps
attachmentThe ladder an attachment opens through: preview → full size → save → open the saved copy
draftA draft kept per conversation, and the line that shows it wherever the conversation is listed
composerEnter sends, Shift+Enter breaks the line, Escape lets go — the same rule in both
listConversationList: the message list itself, for a widget-tree app
unreadWhere the reader’s unread lines start: the “New messages” divider
jumpThe 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§

AttachmentFace
The line under an inline preview, and the badge that says it opens.
AttachmentSummary
Everything the ladder needs to know about one attachment.
ConversationClock
The local zone and “now”, read once per pass.
ConversationDay
The local calendar day an instant falls on.
ConversationEntryProps
One line of a conversation: who said it and when, what it says, and how far on its way it is.
ConversationLine
One line of a conversation, as the list draws it.
ConversationList
The message list: a conversation, drawn. See the module docs.
ConversationListProps
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
DayDividerFace as 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.
DayDividerFace
The day divider: a caption centred in a band, ruled out to both sides.
DeliveryFace
A delivery state as it is painted: a small glyph and its word, in one line.
DescribedConversationList
A described conversation: its list, and the lines it was made with.
DraftBook
The drafts a person has, by conversation key.
EarlierUnavailableFace
“Earlier messages aren’t available on this device’s hosts”, centred in the band the earlier lines would take.
JumpFace
The pill as it is drawn: which way back, whether the pointer is on it, and where it sits.
ListCache
A list’s layout, kept from one frame to the next.
ListFace
The list’s painting and measuring, without the widget around it.
ListWork
What a list’s layout did, counted.
SavedCopy
A saved copy of an attachment, where the app put it.
UnreadDivider
UnreadDividerProps, built: an unread divider over a row.
UnreadDividerFace
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).
UnreadDividerProps
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.
UploadProgress
How far an upload has got.

Enums§

AttachmentAction
One rung of the ladder, as the app should carry it out.
AttachmentKind
What kind of thing an attachment is, which decides its glyph and its word.
ComposerIntent
What a keystroke means to a composer.
ComposerRule
How a composer’s field ends a message.
ConversationRole
Which side of the column a line sits on, and what its bubble says.
DeliveryState
The state a line shows, in the one vocabulary both apps speak.
DeliveryStep
What a transport reported, before this toolkit decides how to say it.
Jump
Which way back a JumpFace offers.

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 days whose 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”. None when 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. None when there is nothing to say (a body of spaces is not a draft).
full_size_rect
Where a picture of width×height sits in view at 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.