Files
Evgeny @ SimpleX ChatandEvgeny Poberezkin c3c733e0d4 ios, ui, ci: terminal chat layout in the iOS app (#7898)
* plan: UI improvements to improve LLM usage via SimpleX

* core, ui: types for chat layout

* core, ui: settings for alternative terminal-like chat layout for managing LLMs or other service bots

* plan: message priority

* fixes

* query plan

* update plans

* remove silent messages plan

* rename migrations

* implement layout

* amend

* fix

* fix

* fix

* improve

* time on the right, sender name in blue

* no avatar in direct chats

* better previews

* update, fixes

* update

* time gap

* changes

* ui: terminal layout line heights, gaps and time placement

* ui: simplify terminal meta layout, correct its docs and tests

* ui: right-to-left emoji edge in terminal rows, time placement tests

* android, desktop: raise Kotlin compiler memory to 4 GB

* ui: terminal captions as follow-up text, classic event separators

* ui: terminal media edge and overlay time, plan decisions

* ui: simplify terminal row separation, correct doc line references

* ui: keep the media time inside terminal rows, restore caption conditions

* ui: terminal heading capitals at large font scales, idle live message time

* ui: rename the classic voice-with-text flag, correct the meta copy docs

* ui: smaller terminal layout diff, sender gap and meta names

* ui: terminal row as tall as the media time

* docs: remove the chat layout section from the bots readme

* docs: shorten the terminal layout section of the chat view

* core: address settings API as on master, /auto_accept reads the stored layout

* ui: smaller terminal headings

* ui: classic sender rows and avatar rule as on master

* ui: classic reply quote text colour as on master

* ios: keep the chat layout setting with other UI settings

* ui: go-to button at the end of terminal rows, no gutter in direct chats

* ui: forwarded arrow on the header line of terminal rows, above the time

* ui: forwarded arrow centred above the time line of terminal rows

* ios: terminal chat layout, chosen per app, profile and chat

* ios: event time reserve of three spaces, app layout picker as Kotlin

* ios: spec and plan of the terminal chat layout

* ios: classic message text at 87% in dark themes, as terminal rows

* ios: terminal gaps scaled by the body size, 17/16 of Kotlin values

* ios: terminal quote sender at 13.5pt, thumbnail at the item end

* ios: product docs of the terminal layout, plans updated for iOS

* ios: chat scenes rendered to PNG by a unit test in the simulator CI

* ios: snapshots rendered by the smoke test script, workflow unchanged

* ios: terminal names at 13.5 x 17/16 pt, as the gaps

* ios: Markdown views at the 87% message colour in dark themes

* ios: terminal quote thumbnail 12pt after the quote text or the bar

* ios: terminal rule-only message widened by a wider quote or header

* ios: member avatars scaled with the text size, as in the chat list

* ios: snapshot rows at their own height, as list cells, so text wraps

* ios: member avatars back at 34pt, for the snapshot before scaling

* ios: member avatars scaled with the text size, as in the chat list

* ui: terminal quote thumbnail 12dp after the quote text or the bar

* ios: classic group bubble width follows the scaled member avatar

* ci: ios-sim README describes the snapshots rendered after the smoke test

* ios: scratch, padding variants for the I7 and I8 renders, to revert

* ios: revert the scratch padding variants after their renders

* ui: contrast of the voice message button in terminal rows

* ios: scratch, spacing variants and list margins to render, to revert

* ios: revert the scratch spacing variants after their renders

* ios: snapshots at a fixed date, in UTC and the en_US locale

* ios: snapshots drawn as 8-bit sRGB without alpha

* ci: compare iOS snapshots with the references in the repository

* ci: record and check iOS snapshot references on GitHub's runner

* ios: scratch, list margins on the remaining screens, to revert

* ios: revert the scratch list margins after their measurement

* ci: snapshot scripts executable, as the other CI scripts

* ios: scratch, voice circle variants in light themes, to revert

* ios: revert the scratch voice circle variants

* ios: one 12pt padding at the edges and after avatars in terminal rows

* ios: classic group sender name on the bubble edge

* ui: one 12dp padding at the edges and after avatars in terminal rows

* ios: one heading scale in both chat layouts

* ios: snapshot references of the chat scenes

* docs: leave the headings and classic lines of the plan to ep/classic-bubbles

* ios: declare terminal layout functions inside types

* ios: keep layout constants at file scope

* ios: keep file-scope functions, move only extension members into types

* ios: snapshot tests record row heights at first layout and the appearance layout switch

* ios: appearance preview follows the chat layout setting at once

* ios: snapshot test measures first-layout rows by SwiftUI and by cells

* ios: chat rows measured at the chat width when they first appear

* ios: snapshot test checks that chat rows keep their first height after a reload

* ios, ci: references of terminal and classic chat scenes, dark message text

* ios: message text at 95% in dark themes

* ios, ci: references with message text at 95% in dark themes

* ios: media in terminal rows end at the time's right inset

* ios, ci: references with terminal media at the time's right inset

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
2026-10-29 12:45:34 +00:00

11 KiB
Raw Permalink Blame History

Chat View (Conversation)

Related spec: spec/client/chat-view.md | spec/client/compose.md

Purpose

Full conversation view for displaying and interacting with messages in a direct contact chat, group chat, or note-to-self. Supports text messaging with markdown, media attachments, voice messages, E2E encrypted calls, message reactions, replies, forwarding, and content search/filtering.

Route / Navigation

  • Entry point: Tap a chat row in ChatListView
  • Presented by: NavStackCompat destination from ChatListView, bound to chatModel.chatId
  • Back navigation: Dismiss sets chatModel.chatId = nil, returning to chat list
  • Sub-navigation: Info button navigates to ChatInfoView (contact) or GroupChatInfoView (group); member avatars navigate to GroupMemberInfoView

Page Sections

Navigation Bar

Custom toolbar overlaying the chat with themed material background:

Element Description
Back button Returns to chat list
Contact/Group avatar Small profile image
Chat name Display name; tappable to open info sheet
Encryption badge Shows PQ (post-quantum) or standard E2E status
Call buttons Audio and video call icons (direct chats only)
Search button Toggles in-chat message search
Info button Opens ChatInfoView or GroupChatInfoView

Message List

Rendered by EndlessScrollView<MergedItem> with lazy loading and pagination:

Feature Description
Scroll direction Bottom-to-top (newest messages at bottom)
Pagination Loads more items on scroll to top (loadingTopItems) and bottom (loadingBottomItems)
Merged items Adjacent messages from the same sender are visually merged via MergedItems
Floating buttons Scroll-to-bottom button with unread count; scroll-to-first-unread button
Date separators Sticky date headers between messages from different days
Wallpaper Themed background image with tint and opacity from theme.wallpaper
Content filter Filter messages by type: .images, .files, .links

Message Types

Each type has a dedicated view in Shared/Views/Chat/ChatItem/:

Type View Description
Text MsgContentView Rendered with markdown (bold, italic, code, links, mentions)
Image CIImageView Thumbnail with tap-to-fullscreen via FullScreenMediaView
Video CIVideoView Video thumbnail with play button; inline playback
Voice CIVoiceView / FramedCIVoiceView Waveform visualization with playback controls and duration
File CIFileView File icon, name, size; download/open actions
Link preview CILinkView URL preview card with title, description, image
Emoji-only EmojiItemView Large emoji rendering without message bubble
Call event CICallItemView Call status (missed, ended, duration)
Group event CIEventView Member joined/left, role changes, group updates
E2EE info CIChatFeatureView Encryption status and feature change notifications
Group invitation CIGroupInvitationView Inline group join invitation card
Deleted DeletedItemView / MarkedDeletedItemView Placeholder for deleted messages
Decryption error CIRcvDecryptionError Error with ratchet sync suggestion
Invalid JSON CIInvalidJSONView Developer fallback for malformed items
Integrity error IntegrityErrorItemView Message integrity/gap warnings

Message Interactions

Long-press context menu on any message:

Action Description
Reply Sets compose bar to reply mode with quoted message
Forward Opens forwardedChatItems sheet to pick destination chat
Copy Copies message text to clipboard
Edit Enters edit mode in compose bar (own messages, within edit window)
Delete Delete for self or delete for everyone (with confirmation)
React Opens emoji reaction picker
Select multiple Enters multi-select mode (selectedChatItems) with bulk delete/forward
Info Shows delivery status and timestamps

Emoji reactions bar displayed below messages with reaction counts.

Compose Bar (ComposeView)

Element Description
Text input NativeTextEditor with markdown support and auto-growing height
Attachment button Opens picker for images, videos, files, camera
Send button Sends composed message; changes to voice record button when empty
Voice record Hold-to-record with waveform preview; swipe-to-cancel
Reply quote Shows quoted message above input when replying
Edit indicator Shows "editing" label when editing a previous message
Link preview Auto-generated preview card for detected URLs (ComposeLinkView)
Image/Video preview Thumbnail strip for selected media (ComposeImageView)
File preview File name and size for attached file (ComposeFileView)
Voice preview Waveform of recorded voice message (ComposeVoiceView)
Live message Real-time typing broadcast (optional, with alert on first use)
Context actions ContextContactRequestActionsView for accepting/rejecting contact requests; ContextPendingMemberActionsView for pending group member actions
Commands menu CommandsMenuView for bot/menu commands in chats with menuCommands
Group mentions GroupMentionsView autocomplete popup when typing @ in groups
Profile picker ContextProfilePickerView for choosing incognito/main profile

Channel Messages

In channel conversations (groupInfo.useRelays == true), received messages (.channelRcv direction) display with:

  • The channel icon (antenna.radiowaves.left.and.right) instead of the standard group icon
  • The channel name as sender, with "channel" as the role label
  • The group profile image as the avatar (tapping opens group info, not member info)
  • Consecutive channel messages are grouped without repeating the avatar
  • Channel messages cannot be moderated per-member (no member identity)

Member Support Chat (Groups)

For groups with member support enabled:

  • MemberSupportView and MemberSupportChatToolbar shown as secondary chat within group
  • SecondaryChatView for scoped group chat views (reports, member support)
  • User knocking state: userMemberKnockingTitleBar() shown when user is pending admission

Terminal Layout

A chat with the terminal layout shows messages as full-width rows without bubbles, starting at one edge for sent and received messages, with the sender's name above each group of messages and the time at the end of the last line. Groups and channels show the sender's avatar beside its name; other chats have no avatar column. The wallpaper is drawn as its colour without the image.

A chat uses the user's choice for that chat, otherwise the layout set by the group owner or by the address the contact came from, otherwise the user's choice for the profile and then the app setting, otherwise classic. The choice for a chat is made in its theme screen; the choices for the app and the profile are made in Settings › Appearance.

Loading / Error States

State Behavior
Initial load Messages load from ItemsModel with merged items; allowLoadMoreItems throttles pagination
Loading more (top) loadingTopItems spinner at top of scroll view
Loading more (bottom) loadingBottomItems spinner at bottom
Connection in progress ConnectProgressManager shows connecting text below compose bar
Connecting text "connecting..." label shown below message list when chat not yet ready
Send disabled Compose bar shows disabledText reason when userCantSendReason is set
Empty chat No messages placeholder (implicit -- empty scroll view)
  • spec/client/chat-view.md -- Chat view feature specification
  • spec/client/compose.md -- Compose bar specification
  • Chat List -- Parent navigation
  • Contact Info -- Info sheet for direct chats
  • Group Info -- Info sheet for group chats
  • Call -- Audio/video calls initiated from toolbar

Source Files

  • Shared/Views/Chat/ChatView.swift -- Main chat view, message list, navigation, state management
  • Shared/Views/Chat/ChatItemView.swift -- Individual message item rendering dispatcher
  • Shared/Views/Chat/ComposeMessage/ComposeView.swift -- Compose bar container
  • Shared/Views/Chat/ComposeMessage/SendMessageView.swift -- Send button and voice record
  • Shared/Views/Chat/ComposeMessage/NativeTextEditor.swift -- Text input with markdown
  • Shared/Views/Chat/ComposeMessage/ComposeImageView.swift -- Image attachment preview
  • Shared/Views/Chat/ComposeMessage/ComposeFileView.swift -- File attachment preview
  • Shared/Views/Chat/ComposeMessage/ComposeVoiceView.swift -- Voice recording preview
  • Shared/Views/Chat/ComposeMessage/ComposeLinkView.swift -- Link preview generation
  • Shared/Views/Chat/ComposeMessage/ContextItemView.swift -- Reply/edit context display
  • Shared/Views/Chat/ComposeMessage/ContextContactRequestActionsView.swift -- Contact request accept/reject
  • Shared/Views/Chat/ComposeMessage/ContextPendingMemberActionsView.swift -- Pending member actions
  • Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift -- Profile picker for incognito
  • Shared/Views/Chat/ChatItem/FramedItemView.swift -- Framed message bubble rendering
  • Shared/Views/Chat/ChatItem/MsgContentView.swift -- Text message content with markdown
  • Shared/Views/Chat/ChatItem/TerminalItemView.swift -- Terminal layout rows, sender rows and the time at the row end
  • Shared/Views/Chat/ChatItem/CIImageView.swift -- Image message view
  • Shared/Views/Chat/ChatItem/CIVideoView.swift -- Video message view
  • Shared/Views/Chat/ChatItem/CIVoiceView.swift -- Voice message view
  • Shared/Views/Chat/ChatItem/CIFileView.swift -- File message view
  • Shared/Views/Chat/ChatItem/CILinkView.swift -- Link preview view
  • Shared/Views/Chat/ChatItem/EmojiItemView.swift -- Large emoji view
  • Shared/Views/Chat/ChatItem/CICallItemView.swift -- Call event view
  • Shared/Views/Chat/ChatItem/CIEventView.swift -- Group/system event view
  • Shared/Views/Chat/ChatItem/CIChatFeatureView.swift -- Feature change notification
  • Shared/Views/Chat/ChatItem/CIMetaView.swift -- Timestamp and delivery status
  • Shared/Views/Chat/ChatItem/FullScreenMediaView.swift -- Fullscreen image/video viewer
  • Shared/Views/Chat/ChatItem/AnimatedImageView.swift -- Animated GIF rendering
  • Shared/Views/Chat/Group/GroupMentions.swift -- @mention autocomplete
  • Shared/Views/Chat/Group/MemberSupportView.swift -- Member support scoped chat
  • Shared/Views/Chat/Group/MemberSupportChatToolbar.swift -- Support chat toolbar
  • Shared/Views/Chat/Group/SecondaryChatView.swift -- Secondary scoped chat view