Skip to content

Latest commit

 

History

History
159 lines (105 loc) · 55.6 KB

ui.md

File metadata and controls

159 lines (105 loc) · 55.6 KB

Shared UI (relay-ui)

crates/relay-ui holds the Relay screens and everything behind them so more than one shell can reuse them: the desktop app today, an Android app (eframe through android-activity) later. It depends on egui (no eframe, tray-icon or rfd, no windowing), relay-client, relay-api, tokio (a Handle only, never a runtime), image and qrcode. It is a workspace member but not a default member, like relay-desktop.

Task Command
Tests cargo test -p relay-ui
Lints cargo clippy -p relay-ui --all-targets --no-deps -- -D warnings

What lives here

  • Logic, no toolkit: engine (port traits), relay_link (adapter over relay-client), supervisor, apply / convert / model (wire to view model), hub, controller and channels (validation), emitter (bounded cadence, tray summary), format, viewmodel, avatar (default image, bounded cache), imaging (bounded decode, avatar_check), host_options, qr, inbox, mock. The engine link stays here (not in relay-client) because it implements the UI's Engine port; dependency direction is relay-ui -> relay-client -> relay-api.
  • Shell glue: shell (the Shell and FilePicker traits), actions (Shared, ShellSink, Actions), tasks (avatar fetch, connection info, invite, picker jobs on the shell's runtime handle).
  • Look and layout: theme (colour, spacing and type tokens, light and dark styles; egui's default ThemePreference::System follows the OS hint), layout (LayoutClass, Page, touch size).
  • Drawing: ui/ with RelayApp, kit (cards, titles, help text, buttons), sidebar (regular layout) and nav (compact bottom bar), the pages home (Calls), contacts, connect (with nearby) and channels, chat (where a call's chat appears) with the messages/ widgets, call_card, incoming (the ringing prompt) and banners (notices) above every page, settings/ (one file per category), textures (avatar cache). capabilities turns the shell's flags into Capabilities and decides which SettingsCategory entries exist.

Shell contract

A shell supplies a tokio Handle and an Arc<dyn Shell>:

Method Purpose
pick_image (FilePicker) Native image chooser; the shell checks the size (1 MiB) before reading and returns PickedFile { name, bytes }, or Ok(None) on cancel
pick_directory, save_as, pick_file (FilePicker) Native folder, save-as and file dialogs that return an absolute path only (the daemon opens or writes it). Default methods are the documented stub for shells without filesystem paths (compact/Android: content URIs are not paths): they return NO_PATHS and the UI shows it as a notice. Desktop implements them with rfd
open_url Opens a link in the browser; called only after the link confirmation dialog. Default: does nothing
copy_text Clipboard
request_repaint Called by writers after new data, never per frame
window_visible Hint polled once per frame; meters are produced only while true
show_window, hide_window, quit Window actions; quitting never stops the daemon. Mobile shells may ignore show/hide
hides_to_tray Whether closing hides the window, so the UI can say so
host_options Optional HostOptions (language, call notifications, start at login) drawn under Settings, Language and Startup; None on shells without them

Wiring (see apps/relay-desktop/src/main.rs): build Hub, SessionSlot, Controller, Shared, then Actions { controller, hub, shared, runtime, shell }; spawn emitter::run with a ShellSink and either supervisor::supervise(RelayLink::new(resolve_endpoint), ..) or mock::run. Per frame call RelayApp::begin_frame(ctx) then RelayApp::ui(ui).

Microphone card

Shell::microphone_access() (default Ready, so platforms with nothing to ask show nothing) returns MicrophoneAccess: Ready, NotAsked, Denied (the system will ask again) or Blocked (settings only). The top of the Calls page draws a card from it (microphone::card): NotAsked and Denied show "Relay needs your microphone" with Allow microphone (Shell::request_microphone), Blocked shows "Microphone access is turned off" with Open system settings (Shell::open_microphone_settings). Each card has Dismiss; a dismissal is forgotten when the access state changes, so a later revoke shows the card again. The shell owns the state and prompts by itself where the platform allows (desktop at launch, Android at onCreate); the card only reacts. Tests: tests/microphone.rs (fake shell, real frames, clicks).

Staying available (Settings > Calls)

The first card of Calls is "Stay available" (background.available): the switch, one help line and a status line with a dot (green running, amber waiting or paused, grey off). The line comes from Shell::background_state() -> Option<BackgroundState> (Running, WaitingForNetwork, Paused; None where it does not apply: a desktop with a tray then says it keeps running in the tray, otherwise nothing). Off reads "Off. Others cannot reach you while the app is closed. Turn the switch on to keep ringing with the window closed." (the desktop default) For a phone the shell reports the state of its foreground service (docs/android.md). A one-time card at the top of Calls (ui/available.rs) asks "Stay available in the background?" when notifications_allowed() is Some and Shell::question_answered("background-first-run") is false; Yes saves true and asks for notifications and the battery exemption when they report Some(false), the other choice saves false; both call set_question_answered. The default question_answered is true (never ask). A chip at the top of Calls on touch layouts (none in the sidebar) shows the setting and opens Settings > Calls. Tests: tests/background_status.rs.

Auto-start and quitting

autostart::AutoStart (setting, RELAY_NO_AUTOSTART, user quit, 3 starts per 60 s, exponential backoff) is pure and tested without a clock; supervise takes the Shell and Arc<AutoStart> (Shared.autostart). Link::Starting is the honest "starting" state. Actions::quit_app hangs up format::own_live_calls (calls with controlled_by_me, not ended) for up to 2 s before Shell::quit; format::close_note and format::quit_prompt are the texts and name active calls. Command::SetAutostart / Controller::set_autostart store the preference.

Pages and Settings

Five pages: Calls (running calls, then Favorites, then History), Contacts, Connect, Channels and Settings. A contact is a device that has been trusted (PeerRow::known); a device that is only found on the network is nearby until the user trusts it. Contacts (ui/contacts.rs) lists every trusted device whether or not it is online (the engine lists stored contacts without a link, see docs/engine.md), online ones first. The card: picture, name, Online or Offline with how it is trusted (verified or first use), the local address while online or "Last seen ..." while offline; the star and the More menu sit in the top right corner (44 points under touch rules), and the menu starts with View details (Hide details when open: the key, addresses and shared channels then show inside the card; there is no Details expander), then "Forget this device" (a confirmation follows under the card, then Controller::forget_peer / Command::ForgetPeer) and Block. Call is a full-width button at least 44 points high with a 24-point gap above it. An offline contact keeps Call disabled with the line "This device is offline. You can call it as soon as it is back on the network." (a call needs a live link; Relay does not dial blindly). Nearby cards share the corner menu with View details. Local::details_open holds the opened cards. Tests: tests/contact_card.rs. With no contact it says what a contact is and offers "Go to Connect". A contact whose key changed (Peer::key_changed; ui/key_changed.rs) is a calm card sorted to the top: "'s security key changed" (a trailing ".local" is dropped), "This usually happens after Relay was reinstalled or reset on that device. Calls are blocked until you verify it again.", no Call button, the favorite star kept, and three choices: "Scan their QR code" (primary, only where can_scan_qr; the engine repairs the contact when the scanned fingerprint is the new key), "Compare and trust new key" and "Remove contact". The compare step shows the new key's short form and its full fingerprint in groups, and a field for the fingerprint the other device shows (Connect a device > Details); "Trust new key" is enabled only when the field equals the full fingerprint (spaces, dashes and case ignored, fingerprint.rs) and sends Controller::replace_pinned_key (Command::ReplacePinnedKey). "Remove contact" asks first, then Controller::forget_peer, which sends the pinned key (previous_peer_id) the engine stores. Fingerprints appear only in the compare step and behind Details. Tests: tests/key_changed.rs, tests/fingerprint.rs; screenshots key_changed_screenshots. A history row of a trusted device has "Open contact", which opens Contacts scrolled to that card (Local::focus_contact). Connect (ui/connect.rs) holds the discoverability card, Nearby, the "Connect a device" card and the paste field ("Add a device by connection string"). A trusted device that is online appears under Contacts and on Calls only, never under Nearby. Messages are not a page: they belong to a call and open from its card or its history row (see "Session messaging UI"). Notices and the incoming-call prompt are drawn in a strip above every page except Settings; Settings draws no strip at all (see below). Technical detail (keys, ids, counts) sits behind "Details".

Channels page (ui/channels.rs, ui/channels_nearby.rs): one card on top with Create a channel and Join a channel (the form opens in place), then your channels, then Channels on your network: one card with a row per listed channel other devices advertise (AppState::nearby_channels, from Snapshot.nearby_channels / StateEvent.nearby_channels): the name, "1 device" / "N devices" (plural-aware in every language) and a Join button (44 points under touch rules). An open channel joins at once: Command::JoinChannel{name} through Controller::join_by_name. A password channel shows a lock (tooltip "Needs a password") and Join opens a password prompt inside the row (masked field focused, Enter or Join submits, Cancel / Esc / Back cancels via step_out, Local::nearby_prompt); a wrong password shows the usual error and keeps the prompt open. Invite-only channels are never listed. In the Create form, Invite only turns Listed off and disables it with the line "Invite-only channels are never listed on the network." The engine answers every refusal alike, so a refused join (a password or invite is needed) opens the Join form with the name filled in (Local::join_failed, Local::join_prefill); the form then joins by name with the password typed. A name two channels share shows "Two channels use this name. Join with a code instead." and no Join button. With nothing found the card holds one muted line, "No channels found on your network yet", plus "This device is offline, so it cannot see other devices." when the link is not up. A hidden (private) device still lists what it hears, so no hint is given for it. The join field also accepts a channel name (JoinTarget::Name). Tests: tests/channels_nearby_password.rs (lock, prompt, exclusivity, fit), tests/channels_nearby.rs (rows, plurals, Join command, form, empty state, touch size, fit in all nine languages), tests/nearby_state.rs, tests/channels_page.rs.

Settings has nine categories, each a small file in ui/settings/: Profile, Audio, Push-to-talk, Calls, Privacy, Storage and limits, Language, Startup, Advanced. Which exist follows Capabilities (no Language or Startup without host_options; Startup also appears where the app has window controls; the daemon controls in Advanced need can_manage_daemon; the hotkey and delay wording follows has_global_hotkey / has_talk_button; "Hide window" and "Quit this app" only exist where the user closes a window, never where the system keeps the app alive, Capabilities::window_controls). Regular layout: categories in a list on the left, the chosen one on the right, Back (or Esc) returns to the page Settings was opened from. Settings fills the whole window height with its own category list and content scroll area and is never pushed down by notices, the mock banner or the incoming-call prompt: no strip is drawn above it. A ringing call stays noticeable by the green dot on the Calls entry of the sidebar (the Calls tab on a phone) and by the ringtone the daemon plays; Esc or Back returns. Compact layout: the category list, then one category under a Back button. The chosen category is remembered; state a category holds (hotkey draft, pending confirmations) is dropped when it is not on screen.

Incoming call from a device that is not a contact (CallCard::unknown): the prompt says "Not in your contacts yet (key ...). If you answer, Relay adds it to Contacts as unverified, because you have not compared its fingerprint." and has a Block button next to Accept and Decline (decline, then block_peer). Settings, Privacy has "Blocked devices": name, short fingerprint and Unblock (Controller::forget_peer, which unblocks; the device is not a contact afterwards). Blocking a contact forgets it. Tests: tests/found_trust_calls.rs.

Nearby (ui/nearby.rs, on Connect): every device the engine has met but the user has not trusted (Trust::Unknown; the daemon dials discovered devices while this one is attached and discoverable, see docs/engine.md). The card shows the name, "Not trusted yet" with the short fingerprint, the local IP address (the first address the engine reported, without the port; all addresses with ports are behind Details), and the full key digest in groups of four behind Details. "Trust this device" asks first (compare this fingerprint with the one on the other device under Connect a device, Details), then "Yes, trust it" calls Controller::trust_peer, which sends Command::TrustPeer (a DecidePeerTrust with the peer id as the expected key, TOFU, not verified out of band). Once trusted the device moves to Contacts. A failed decision is not silent: Controller::trust_peer words TRUST_KEY_MISMATCH ("does not have the key you were shown") and UNAVAILABLE ("could not reach that device") in plain translated text, shown in the error banner, and the device stays under Nearby (tests/found_trust_errors.rs). The engine's TRUST_REQUIRED warning is never shown (banners::shown drops it, no toast either): trust is decided only here, or by scanning a QR code. Each Nearby card has Call (enabled while the engine reports the device reachable), "Trust this device" (the careful option: compare the fingerprint first) and a menu with "Block device" (a confirmation follows under the card; Controller::block_peer, Command::BlockPeer, which is DecidePeerTrust(BLOCKED)). Calling a nearby device needs no trust step: when it answers, both engines pin each other as first use and the device appears in Contacts as "Seen before, not verified" (never "Verified"). Blocked devices are not listed under Nearby or Contacts. When nothing is found, the empty state also says what to check (same Wi-Fi, local network access, client isolation). Tests: tests/found_trust.rs.

Connect a device (ui/connect.rs, below Nearby): the section shows this device's connection string (selectable), Copy address, the QR code, and addresses, port and fingerprint behind Details; the paste field ("Add a device by address") is the next card, so exchanging details is one place. It is open while there is no contact and collapsed otherwise; clicking the header stores the choice in Local::connect_open, which then wins. Collapsed, Copy address stays under the header. The page asks the daemon for the string when it is first drawn and drops the string and QR texture when another page is shown. Tests: tests/connect_section.rs. Scan: when Shell::can_scan_qr() is true (never on desktop) a Scan card sits at the top of Connect and calls Shell::scan_qr(); the text it returns takes qr_scan::outcome, the same connection::check as a pasted string. A valid code is then dialled and trusted at once: Actions::connect_and_trust calls Controller::connect_and_trust, the engine trusts the device as verified only when its authenticated key matches the fingerprint in the code (the code on the other screen is the out-of-band check), and the card says "Connecting and trusting…", then "Added to Contacts." or, in plain words, that the device was not reachable, that it did not match the code (nothing is stored) or the engine's own reason (qr_scan::ScanTrust). A pasted string keeps its old path: it only fills the "Add a device by connection string" field and nothing is trusted until the user presses Call. A string that is not a Relay address says so; a refused camera shows its own message, with Open system settings (Shell::open_camera_settings) when it is blocked for good. Tests: tests/qr_scan.rs.

Out-of-date daemon (ui/outdated.rs, AppState::daemon_out_of_date, relay_api::API_REVISION / BUILD_REVISION against Settings.daemon_api_revision / daemon_build_revision): when the running background service is not this app's build, one card says "The background service is out of date. Restart it to finish updating." at the top of Calls and in Settings, Advanced, with a Restart button (Actions::restart_daemon: stop, then start, through Shell::stop_daemon / start_daemon, i.e. daemon_control). The button is disabled while any call is active and absent where the shell cannot manage the daemon. A daemon that lacks a settings key never shows "unknown setting": the hotkey, limits and history panels say "Not supported by the running background service: restart it." (setting_support), and the Keep call history switch reads on when the daemon predates the revision, instead of an off nobody chose. Tests: tests/outdated.rs, tests/setting_support.rs.

Discoverability (ui/visibility.rs, viewmodel::discoverability): Discoverable (green, advertised so others on the same network can find and call this device), Private (neutral, not advertised; only someone with the address can call) or Not advertising (amber, with the link state as the reason). The engine exposes the stored preference (Settings.advert, privacy.advert_mode) and who may ring (Settings.inbound) but no live "is advertising" flag; the daemon advertises only while a client is attached (docs/engine.md, presence), so the state is the preference combined with Link::Connected. A chip shows it in the sidebar identity block (full sentence as hover text); the Connect card repeats it in one line, adds a "who can ring me" line when it is limited to channel members, and has a button (Go private / Make discoverable, disabled until the daemon is connected) that calls Controller::set_privacy, the same control as Settings, Privacy. Tests: tests/discoverability.rs, tests/pages_fit.rs.

The sidebar is theme::SIDEBAR_WIDTH (216 points) wide; the name in it uses theme::TEXT_SIDEBAR_NAME (14) and is cut with an ellipsis (full name on hover). The compact layout has no sidebar.

Keys: Esc closes the open chat, else leaves Settings (or the category on a phone), unless a drop-down is open; Ctrl/Cmd+1 to 4 open Calls, Contacts, Connect and Channels; Ctrl/Cmd+, opens Settings. Tests: tests/nav.rs.

Not available in the UI because the model or API has no such thing: marking a device verified (DecidePeerTrust needs the full key digest, which the view model does not carry), noise or echo switches. The call duration is counted from when this app first saw the call connected and is redrawn with other changes, not on a timer (the UI never requests repaints).

Following calls

Navigation around calls lives in the UI layer (ui/follow.rs), so every shell behaves alike. Placing a call from Contacts, Favorites, History (Call back) or Connect goes to Calls at once (Local::goto), where the call shows "Calling..." with its hang up control; accepting an incoming call does the same. A call this client placed that becomes connected because the other side answered brings the user to Calls, once per call (Local::awaiting_answer holds calls seen ringing out; the entry is removed when handled, so leaving Calls later is respected, and a call that was already connected when the app attached never navigates). From Settings the page closes and Calls shows: a connected call is the one exception to Settings being calm. It does not happen while an inline confirmation or a chat dialog is open, a text field has focus, a menu is open or the soft keyboard is up; it then waits and applies when that ends. An open chat on Calls (of this call or another) stays. A hidden window waits and applies on show. An incoming call alone never navigates (the prompt stays in the strip), and a call ending moves nobody. On the phone layout every page change closes menus and drops field focus, which hides the keyboard. The checks run from begin_frame on frames that already happen (state change, input); nothing repaints while idle. handle_back is unchanged: Back from Calls with nothing open still returns false. Tests: tests/call_follow.rs.

Responsive layout

LayoutClass::for_width picks compact below 600 points (phone: one column, bottom navigation with Calls, Contacts, Connect, Channels, Settings (a dot on Calls while a call rings), 44 point minimum touch targets and a larger body size) and regular otherwise (desktop: a sidebar with Calls, Contacts, Connect, Channels and the Settings button, one page at a time, content at most 720 points wide). The class is chosen in begin_frame from the content width; the style is reinstalled only when the class changes (one repaint, no per-frame work). Tests in crates/relay-ui/tests cover the breakpoint, touch sizes, themes, every compact page, and run whole frames with a fake Shell and no window.

Compact layout rules (width-based, not tied to a platform). Rows never rely on available_width being enough: button groups use widgets::button_row (stacked full-width buttons in touch style, wrapping on desktop), text fields take field_width, drop-downs and sliders put their label above and fill the row (combo, slider_row), cards and channel/peer rows put their buttons under the text. Bottom tabs shrink their font to fit and then cut with an ellipsis, never mid-word, and show the full name as hover text (the page heading shows it in full too). Tap targets are 44 points; labels are not selectable in touch style, and a hint that would be hover-only (widgets::hint, the level meter) is shown as a visible line instead. Text may grow 40% in other languages: tests run English, German and Russian at 360x800 and 320x640 points and 2.6 pixels per point.

Optional Shell hooks, all with desktop-safe defaults: safe_area_insets() -> Insets (points covered by status bar, cutout, gesture bar, side cutouts; the app keeps its content out of them), keyboard_height() -> f32 (soft keyboard height from the screen bottom, 0 when hidden; the app pads the bottom, hides the tabs and scrolls a focused field into view once), has_global_hotkey() (default true; false drops the hotkey panel and wording), has_talk_button() (default false; true shows a large press-and-hold talk button on push-to-talk calls, reported through push_to_talk(call_id, pressed), and the hotkey note says so), runs_in_background() (default false; picks the "leaving keeps calls going" wording when there is no tray). The talk button follows pointer-down, so touch works, and a held button that disappears is released. Tests: phone_overflow, phone_tabs, phone_insets, phone_touch, phone_talk.

Rules kept

  • Idle zero repaint: the UI never requests a repaint itself; an idle screen asks for none (tested at phone and desktop widths).
  • Bounded cadence: emitter at 25 Hz, tray text at most once a second, state marked dirty only when changed.
  • Secrets (relay_client::Secret) stay redacted in Debug; UI-only state is deliberately not Debug.

Not done

  • No Android shell exists yet; the touch layout is untested on a device or with a real touch screen. FilePicker has no Android implementation (content URIs rather than paths are the expected shape: return the bytes).
  • No on-device or screenshot check of the compact layout; only window-less frames run.
  • The mobile resource gate (CPU, RSS, battery) is unmeasured.

Calls page: favorites and the call card

Favorites (ui/favorites.rs, rows from viewmodel::favorites) replaces the old "Online now" list and the "Nobody to call yet" card. Up to six trusted contacts are a grid of tiles, three to a row at every width (a 320 pt phone fits three, long names are cut with an ellipsis): picture, name, an online dot, and under the name "Offline", "In a call" or "This device cannot be called right now." when the tile cannot be called. A tap calls (Controller::start_call); a long press or right click opens "Open contact" and "Remove from favorites" (Controller::set_favorite). Below the grid: Go to Contacts and Find nearby users (the Connect page). With no favorite it says "Pin your favorite contacts here for one-tap calling. Star a contact in Contacts." with the same two buttons; with no contact at all it points to Connect only. History follows, collapsed (below).

Call card (ui/call_card.rs, with call_mode.rs, call_volume.rs, call_details.rs). There is no consent checkbox: the mode is the consent. A segmented control Muted | Unmuted | Push to talk sends Controller::set_transmit; the active mode is filled. Under it a plain status line from format::describe_transmit (only the engine's effective_transmitting ever says the voice is sent), the microphone level meter while it is live and, in push-to-talk, the big Hold to talk button (widgets::hold_button, touch and mouse; it calls Shell::push_to_talk(call, pressed) and releases when it vanishes: call ended, mode changed, page left; a shell without a global hotkey shows no hotkey hint, one with it shows the hotkey line). The header has the picture, name, status with the connected time (mm:ss, h:mm:ss; now from Shell::now_unix_ms minus Call.connected_at_unix_ms, nothing shown while that is 0) and a menu. While a call is connected the card asks for a repaint after one second, so the time ticks; with no call the page never repaints on its own. Icon buttons: mute and deafen (toggles of the call's own mute and deafen), messages with an unread badge, End call (red, with its word). Volume of the other person is hidden like in a chat app: right click (long press on touch) on the name, or menu, Volume, opens a small popup with a 0 to 200 % slider and a reset to 100 % (set_call_controls, gain). Connection details (menu, or Ctrl/Cmd+Shift+D) expand a compact panel: connection state with the engine's reason, audio traffic, round trip with best and worst, jitter, lost packets (now and overall), jitter buffer, mouth-to-ear delay labelled as an estimate, bitrate, and behind Details the route, addresses, packet counts, clock drift and device buffers; numbers carry units. The panel opens Operations::watch_call_stats (stats_watch::StatsFeed) only while it is drawn and drops the stream the first frame it is not (hidden, call over, window hidden); the one-second samples are its only repaint. The incoming prompt (ui/incoming.rs) shows Accept and Decline with icons and says how you will join from Settings.default_transmit_mode: "You will join in push-to-talk mode." / "…with your microphone on." / "…off.".

Microphone processing (Settings, Audio; ui/settings/processing.rs, audio_processing.rs): "Reduce background noise" (default on) with a Strength drop-down (Low, Moderate, High; disabled while the switch is off) and "Even out my volume automatically" (default off). Each change is a SetSettings of audio.noise_suppression, audio.noise_suppression_level or audio.auto_gain, applied live by the daemon; a rejected key shows its reason as the error. The state comes from Settings.noise_suppression_enabled / noise_suppression_level / auto_gain_enabled. Tests: tests/mock.rs, tests/audio_defaults.rs.

Microphone Test (Settings, Audio; ui/settings/mic_test.rs, logic in mic_test): Start test sends Command::StartMicTest (StartMicTest: the engine opens the microphone for a level-only capture that sends and plays nothing and shares the device with calls) and the level arrives in the telemetry stream (METERS_HZ is 16). A row of 12 dots lights up to the level (green, yellow above -12 dBFS, red above -6 dBFS, a held peak ring for 1.2 s) with the raw dB beside it ("-23 dB"; silence is "-", the infinity glyph of the icon font, " dB", because the text fonts have no infinity sign). The test ends on Stop test, when the card stops being drawn (another category or page: settings::release_unseen), when the window is hidden (RelayApp::release_hidden), when frames stop for a second (MicTest::tick, e.g. Android in the background) and, at the latest, after the engine's 30 s limit; the screen repaints every 60 ms only while it runs. Without microphone permission the card shows the shared Allow microphone / Open system settings buttons instead of Start. Tests: tests/mic_test.rs.

Settings, Push-to-talk has the hotkey panel (desktop) and the release delay; there is no on/off switch, push-to-talk is always a choice of the call mode. Settings, Calls has Default when a call connects (calls.default_transmit_mode: muted, unmuted, push to talk; one line each). Both are saved with Controller::set_setting / Actions::save_setting and the daemon's per-key answer ("Saved.", "Saved. It takes effect after a restart.", or the reason and what to do) shows under the control (ui/settings/saved.rs). Wording rule: user text says "device", never computer, PC, Mac, phone or laptop (tests/wording.rs checks all nine languages); refusals the engine words as invalid: <reason> lose the prefix in one place (engine::plain_refusal).

Call history

The Calls page ends with a History section (ui/history.rs, rows from history_view, times from history_time) that is collapsed until opened: its header uses collapsing_header with the chevron on the left, the only such header, and the choice is remembered while the app runs. Opened with nothing to list it shows "No call history yet". Each row is a card with the device's picture (or an initial in a circle when the device is no longer known), the name as it was at the time, a call-log icon (history_view::icon: arrow down-left for an incoming call, arrow up-right for an outgoing one, a crossed phone in red for any call that never connected) with the marker word (Incoming, Outgoing, Missed, Declined, Not reached, Cancelled), the time as quiet small text below the name, the length for calls that connected (m:ss, h:mm:ss) as its own right-aligned badge with a clock and a bold monospace face, so it cannot be read as part of the time, and Call back and View Messages side by side (the same normal button style; View Messages is highlighted only while the transcript is open). The name opens the contact (kit::name_link: a touch-sized target, underlined and tinted on hover, darker while pressed; plain text when the device is no contact); there is no Open contact button. Call back, which is Controller::start_call like Call on the People page and is disabled when that device cannot be called now, with the same reason text ("This device cannot be called right now." for a device that is online but blocked or in a call, "Offline" otherwise). A missed call is drawn with its name and marker in the error colour. Twenty rows are shown; Show more adds twenty (Local::history_shown, the whole list is already in AppState.history). Clear history asks first ("Delete the whole call history on this device?", Clear history / Keep) and then sends Command::ClearCallHistory. When recording is off the section says that nothing new is recorded and the entries stay until cleared.

Times everywhere (timefmt, a pure function of now, the instant and a LocalZone; messages, history rows and hover texts use it): the same local day shows the clock (1:54 AM), the previous calendar day Yesterday at 6:51 PM, anything older the short date and clock (11/04/26, 3:33 PM, MM/DD/YY). A time after now is clamped to now. Other languages use their own idiomatic patterns from a small table in timefmt (de 13:54, Gestern um 18:51, 04.11.26, 15:33; es 4/11/26, 15:33; hi 1:54 pm; ja 2026/11/04 15:33; ko 오후 1:54; pt-BR 04/11/2026 15:33; ru 04.11.2026, 15:33; zh-CN 2026/11/4 15:33, after CLDR's short formats); only the "Yesterday at {time}" and Today/Yesterday words are catalog messages. ICU4X (icu_datetime) was not adopted: nine short patterns do not justify its data and crate count in every shell. History rows add "Just now" under one minute (history_time::relative); the hover shows the full local date, offset and UTC clock. now is Shell::now_unix_ms (default: the system clock) and the zone Shell::time_zone, so a shell or a test injects both; the page asks for a repaint every 30 s only while a shown row says "Just now". The CLI keeps its own log timestamps (apps/relay-cli), not this module.

The list reaches the UI through the supervisor: it reads Operations::call_history (ListCallHistory) when it connects and whenever Settings.history_revision changes (an entry was recorded or the list cleared), stores it in AppState.history, and keeps the last list when the connection drops. Settings, Privacy and trust has the Keep call history checkbox (history.enabled): it sends SetSettings through Controller::set_history_enabled and shows the daemon's per-key answer in the same words as the hotkey panel (applied now, ...); its value is Settings.history_enabled. Tests: tests/history_time.rs, history_view.rs, history_screen.rs (always present, every outcome, Call back, Show more, Clear confirmation, the switch, no overflow and 44-point targets at 720 and 360 wide in en/de/ru), history_refresh.rs. Privacy: docs/config.md, "Call history".

Profile picture and trust hints

The picker accepts PNG, JPEG, WebP, GIF, BMP and TIFF by content, 1 MiB, 2048 x 2048, and refuses with the engine's wording (docs/api.md, "Avatar refusal texts"). "Discard" drops a pending choice only; "Remove picture" calls Controller::clear_avatar (Command::ClearAvatar) for the stored one. Peer.fingerprint_short (sanitised to hex and dashes, 24 characters) is shown under each peer and on the incoming-call prompt with the trust state, labelled as a way to tell devices apart, not to verify. Preferences the UI edits (display name, ring, release delay, autostart) already change live through their own commands; the push-to-talk hotkey panel (below) is the one place that uses GetSettings and SetSettings.

Push-to-talk hotkey panel

Settings, Push-to-talk has the hotkey panel (ui/settings/hotkey.rs, state in hotkey_settings::HotkeyPanel, kept in Local). Opening it reads the two keys with GetSettings (Operations::get_settings, Controller::hotkey_settings): hotkeys.push_to_talk (the global accelerator, empty turns it off, at most 64 printable characters) and ptt.release_delay_ms (0 to 2000). A missing or malformed key is shown as an error, never defaulted. The user edits a draft; Save sends only the keys that differ through SetSettings (Operations::set_settings, Controller::save_hotkey_settings; nothing differing sends nothing, and values that cannot be valid are refused locally). The daemon's answer is shown per key exactly as given: applied now, saved, takes effect after a restart (reason) (the hotkey is read when the hotkey backend starts) or rejected (reason) (a shell that follows the stored key itself, such as the desktop app, replaces "takes effect after a restart" by "saved and applied now"). Under the intro the panel shows Shell::hotkey_state(): the key is ready, off, or the plain failure line with the way out ("The shortcut could not be registered: . You can still hold the on-screen button."). After a save the panel rereads the daemon, so the stored values it compares against are the daemon's; a rejected key stays in the draft until Revert. Closing the panel forgets its state. The slider above (SetGlobalControls) and this panel both change the release delay; the engine is the single source of truth. Tests with a fake daemon: tests/hotkey_settings.rs.

Storage and limits panel

Settings, Storage and limits (ui/settings/limits.rs, logic in limits_settings, docs/limits.md) edits the six limits.* preferences with the hotkey panel's pattern: Controller::limits_settings reads them with GetSettings (plus Operations::limit_usage, which may be empty), the user edits a draft with one slider per limit (the unit, MiB, entries, days or transfers, is in the label so a long translation cannot widen the value box), and Save sends only the keys that differ through SetSettings. Each key's answer is shown as the daemon gave it (applied now, saved, takes effect after a restart (reason), rejected (reason)); a rejected key stays in the draft until Revert. Reset to defaults puts the defaults into the draft (nothing is sent until Save). Every limit has a plain line on what it does and what happens when it is reached ("the oldest ended chats are removed first"); usage is shown for the picture cache, the ended chats and the largest running chat, because the engine reports only those. A local check refuses values outside the ranges (which mirror relay_config::prefs::limits::SPECS, kept equal by a test) and an ended-chat budget below the running-chat budget before anything is sent. The panel's state lives in egui memory with the pass it was last drawn in, so it is reread when reopened; it adds nothing to Local. Tests: tests/limits_screen.rs (fake daemon: applied, saved until restart, rejected, reset; en/de/ru, 360 x 800 and 720 wide, 44 pt targets, no overflow).

Push-to-talk release delay

Settings, Push-to-talk has a slider for the push-to-talk release delay (0 to 2000 ms, step 10, shown as N ms; release_delay_label renders 0 as "Off (closes at once)"). Dragging keeps the value in Local::release_delay_edit and sends one Controller::set_ptt_release_delay on release (a SetGlobalControls with only ptt_release_delay_ms); values above 2000 are refused locally. Settings.ptt_release_delay_ms comes from the engine, and describe_transmit shows "Releasing" only while the engine reports both effective_transmitting and releasing. The mock engine round-trips the value. Settings, Calls also has checkboxes for the ring, ringback and connect/hang-up sounds, a ringtone volume slider (0 to 1, Local::ring_volume_edit, ui/settings/ring.rs) and a Test ring button, all in the Ringtone group (ui/settings/ringtone.rs, mounted by ring.rs): volume slider, the current file name (or "Built-in chime"), Choose file... (Shell::pick_audio: a native file dialog through rfd on desktop, ACTION_OPEN_DOCUMENT on Android; the file is read after a size check and sent as bytes with Controller::set_ringtone), Use built-in chime (Controller::reset_ringtone, enabled only for a custom file) and Test ring. The busy flag is Local::ringtone_busy; the answer ("Saved." or a translated refusal from ringtone_words) shows under the buttons through setting_reports. Nothing repaints while idle. They call Controller::set_ring_preferences (a SetGlobalControls with only the ring fields; a volume outside 0..1 is refused locally) and Controller::preview_tone (the PreviewTone call: the daemon rings on its own output for 2 s). The app plays no sound itself. View-model tests: tests/format.rs, tests/controller.rs, tests/mock.rs.

Session messaging UI

Design and daemon contract: docs/session-messages.md, docs/api.md. Logic is in crates/relay-ui/src/messaging, drawing in ui/messages, placement in ui/chat.rs.

  • Placement. The chat is part of the call, not a page. Regular layout: the call card's Messages button shows a chat panel below the card (a fixed-height panel with a Close button) and toggles it; the same chat opens read only below a history row from that row's Messages button. Compact layout: the button opens a full-screen chat (the bottom tabs are hidden) with a Back to the call button (Back for a history chat). Only one chat is open at a time, Esc closes it, and leaving the Calls page closes it. A message arriving while the chat is closed only turns the button into Messages (N) (N received messages not yet shown, rules::unread_count); it never opens or takes focus. The incoming-call prompt stays in the strip above the chat. MessagesUi::show(call_id, over) draws the session of that call (rules::session_of_call: the live one, else the latest ended).
  • History rows. A row's button is enabled unless the daemon is known not to hold the transcript (rules::transcript_kept): with a live feed and no session for the entry's call_id it is disabled and the row says "Messages from this call are no longer kept" (messages are memory-only; a daemon restart or eviction drops them). A row whose session exists shows View Messages (the count is its tooltip). The button once used Button::selectable, which draws no fill until selected, so it looked greyed next to Call back; it is an ordinary Button now (selected only while open), tested in tests/history_row.rs and tests/chat_history.rs. While messaging is not connected nothing is known, so the button stays enabled and opening it connects, as opening any chat does. An ended call's chat has no composer (the existing "This call has ended" explanation with Export and Clear).
  • Connection. Messaging uses its own RelayClient registered with only the messages capability (messaging::link), so transcripts are readable only by a client that asked. It is opt-in: opening a chat turns it on (unless the user turned it off on purpose); the Privacy panel has the checkbox and explains the grant. Turning it off disconnects and forgets every transcript held in the app. The choice is per run (not persisted).
  • State and resync. messaging::supervisor follows state like the main supervisor: ListSessions -> GetTranscript (newest 5000 entries per session, MAX_LOCAL_ENTRIES) -> WatchSession(after_revision = list revision). Applying events is idempotent so replays are harmless. A SessionResync, gap, error or stream end re-reads (same connection for a resync, reconnect with backoff otherwise); PermissionDenied shows the Denied state and retries every 30 s. Events are coalesced into one repaint per 40 ms; no timers run while idle.
  • Virtualized list. VirtualList keeps estimated then measured row heights; only rows intersecting the viewport plus 200 pt are laid out (tested: 3000 messages draw a few dozen). Row heights are corrected by measurement and one repaint is requested only while they changed.
  • Drawing under a lock. The panel draws while holding the MsgHub state lock (transcripts are never cloned) and records Intents, dispatched afterwards by Actions::dispatch. Message text, file names and URLs are redacted from Debug of every messaging type, MsgCommand and Intent, and no tracing call includes content (tests/msg_redaction.rs greps TRACE output of a full run).
  • Markdown. The daemon sends only stored text, so the client parses with relay_messages::markdown::parse once when an entry arrives. Bold, italic, inline code, flat lists, fenced code blocks (language label, Copy copies CodeBlock::copy_text exactly). A link shows the URL, an IDN or mixed-script badge, and clicking only opens a dialog with the real ASCII host, the decoded form, the warning and the full URL; "Open in browser" calls Shell::open_url once (LinkGate). Nothing opens or loads by itself.
  • Chat look. The transcript is a list of bubbles (ui/messages/bubble.rs): own messages right-aligned in the accent colour (selection.bg_fill), the other side's left-aligned in the card colour with the sender's initial and name at the start of a group; bubbles take at most 80% of the width, body text is the theme body size (the 16 pt compact size on a phone). Consecutive messages of one sender on one local day within five minutes form a group (messaging::grouping): one name above, one time (timefmt) below the last, 2 pt between bubbles instead of 8. Date separators read Today, Yesterday or the short date. Own messages say Sending… until the daemon confirms, Delivered next to the group's time, or the failure reason with a Retry button. Scrolling sticks to the end; a reader who scrolled up gets a New messages pill instead of being moved, and sending always scrolls to the new message. An empty chat says "No messages yet" and "Say hello". The list stays virtualised (transcript.rs, a few dozen rows for 3000 messages).
  • Message menu. Each bubble has a three-dot button (three painted circles; always visible on a touch screen at 44 pt, on hover on a pointer device) that opens an egui popup menu (egui::Popup::menu): Copy text, Copy link (first link), Pin/Unpin, Retry (failed own messages of a live call). It closes on a choice, a click outside and Esc. There is no Delete: the daemon has no per-message delete command. "Select" is not offered either.
  • Chat options. The header's three-dot button opens a menu with Search (shows the search box), Pinned only, Permissions for this call (the toggles and the both-sides note), Export… and Clear…, and the history usage line.
  • Compose. A "+" button (menu: Offer file…, Send clipboard to call…), a rounded text box that grows to a few lines and a Send button, pinned at the bottom above the soft keyboard (the shell's keyboard_height, as for every field). Enter sends and Shift+Enter adds a line on a pointer device; on a touch screen Enter adds a line and Send sends (rules::is_plain_enter). The byte counter against 4096 shows from 80% of the limit. When sending is impossible an explanation replaces the box (daemon off, permission off on either side, ended call, history full with Export JSON and Clear buttons). Failed sends return the draft to the box. Send clipboard to call asks the platform for a paste, shows the clipboard size and the destination call name (call id prefix with several calls), has no default with more than one live call, never truncates (over 4096 bytes is refused) and sends only after a button press.
  • Images. Only inline images (at most 15 KiB, as the daemon enforces) are decoded: relay_messages::image::inspect first (refuses over 16 megapixels), then decode with an allocation limit off the UI thread, scaled to 384 px, textures in a 48-entry LRU (avatar::TextureCache; the lru crate was not adopted, see docs/reviews/dependency-audit.md).
  • File offers. Cards show name, size, type guess, BLAKE3 short form, status and progress, warnings (executable name, large file, over the offer cap, free space needed), and the buttons Download (folder dialog -> RespondOffer), Reject, Cancel, Request/Approve/Refuse preview. After the call ends nothing can be downloaded. "Offer file..." sends the absolute path to the daemon, which opens it.
  • Pins and search are local: pins go to the daemon as a local flag, search filters the held entries case-insensitively (text, file names, previews).
  • Honest states: off (not opted in), connecting, capability denied, daemon unreachable, messages.enabled = false (with a button to switch it on), no sessions, call without a session, ended read-only transcript.
  • Mock mode (--mock): messaging::mock seeds two live calls (a rich transcript with markdown, a lookalike link, an image, offers, a failed message; a type /fail message to see Retry), an ended session and an ended session with 3000 messages. Export writes nothing in the mock.
  • Timestamps use timefmt (receiver clock; formats above) in the zone Shell::time_zone() returns (default LocalZone::system(), from relay_io::localtime, backed by jiff; daylight saving is applied per message). The shell or a test may return a fixed zone and clock, so rendering is deterministic. The hover text (rules::row_times) gives the local date and offset with the UTC clock, then the sender's own claim in the same form. Stored and transported values stay UTC milliseconds. Tests: tests/timefmt.rs, tests/msg_local_time.rs, tests/msg_chat.rs.

Tests: tests/msg_rules.rs (counters, compose gating, offer buttons, clipboard destination rule, link gate), msg_virtual.rs (virtualization maths), msg_state.rs (events, resync idempotence, bounds), msg_supervisor.rs, msg_actions.rs, msg_image.rs, msg_redaction.rs, msg_mock.rs, msg_layout.rs (both layouts draw every state, long history, idle zero repaint, clipboard dialog).

Fonts

fonts::install(ctx, language) (called from begin_frame on the first frame and again whenever the language changes) replaces egui's font definitions: Noto Sans first for Proportional, then Noto Sans JP, KR, SC and Devanagari as per-glyph fallbacks in a per-language order (fonts::order: zh-CN puts SC first, ja JP, ko KR, hi Devanagari right after Noto Sans, everything else JP, KR, SC, Devanagari), then egui's own faces (emoji and symbols). Monospace keeps egui's face first and gets the Noto faces appended so CJK in code-style text renders. Files, subsets, sizes (3.1 MB total, Regular only), licences (OFL 1.1) and the rebuild command are in assets/font/README.md; the reasoning is in docs/decisions.md. Text shaping: egui 0.37 shapes every run with harfrust inside its own layout (see docs/decisions.md), so Devanagari conjuncts, matra reordering and reph apply to all text, including peer names, messages and editable fields, with nothing Relay-specific; crates/relay-ui/tests/shaping_*.rs pin this against the bundled face and the Hindi catalog. Visual check on screen is still open (docs/gates.md). Limits: shared Han characters use the first face that has them, which is the language's own face for zh-CN, ja and ko and JP otherwise. crates/relay-ui/tests/fonts.rs parses every face, asserts sample strings of all nine UI languages have glyphs and the per-language order; extend its table when real translations land.

Notices (notices.rs model, notice_words.rs wording, ui/notice_strip.rs drawing, ui/banners.rs for the link and failed-action strips): the engine's warnings (Problem events; a Removed{kind: "warning"} withdraws one) and the app's passing note (AppState::notice) appear in a strip above the Calls, Contacts, Connect and Channels pages, never in Settings. Each is a card with a severity icon and colour (info neutral, warning amber, error red), a plain-language title, a one-line next step and an icon close button (tooltip "Dismiss"; focusable, labelled; Esc stays for navigation). Wording: notice_words::words maps known codes (PEER_KEY_CHANGED, MEDIA_WORKER_FAILED, OUTPUT_DEVICE_LOST, MICROPHONE_UNAVAILABLE, AVATAR_REJECTED, PREFERENCES_*, TRUST_RECOVERED, TRUST_LOST) to titles and next steps in localizations/<lang>/notices.ftl; other codes show the engine message cleaned (no invalid: , no backticks, "daemon" becomes "background service"). Problem has no structured device name, so the key-change title takes it from the backticked name that starts the engine message; the key digests stay behind a Details expander. MEDIA_WORKER_FAILED is told apart by recovery_action: restart_daemon (will not restart), restarted_capture, restarted_render, restarted; it is a warning, never an error. A dismissal is remembered by identity (hash of code and message) in UI memory only (Board, nothing stored): the same unchanged notice does not return on a refresh, a changed message or a warning raised again after it was withdrawn (or after the link was lost) shows again. Info notices fade after 10 s (Shell::now_unix_ms; the countdown restarts while the pointer is on the card and does not run while Settings is open); warnings stay until dismissed or withdrawn. At most three show, then "+N more" / "Show fewer"; identical titles fold into one line with a count; with more than one, "Dismiss all". A dismissed passing note is also cleared from the state. The only repaint request is the fade deadline of a counting-down info notice. Tests: tests/notices_board.rs, notice_words.rs, notices_screen.rs, notices_layout.rs; screenshots notices_screenshots.

Translations

Every user-visible string goes through tr! (crates/relay-ui/src/i18n/: catalog.rs Fluent lookup, embed.rs auto-discovering embed of every localizations/*/*.ftl, lang.rs languages, locale.rs system-locale matching, picker.rs picker order and labels, check.rs catalog checks). Catalogs are in the root localizations/<lang>/<section>.ftl. The active language is process-global (i18n::active, set_active); RelayApp::begin_frame asks HostOptions::language() and, on a change, switches it and reinstalls the fonts the same frame. HostOptions gained language(), language_choice(), system_language() and set_language_choice() (None = System, shown first as "System (Deutsch)"); the picker is in the "This app" panel (ui/host_switches.rs). View models and error types that used to return &'static str constants now return tr! results (viewmodel::modes(), local::invite_ttls(), format::hotkey_note()); ControlError and EngineError implement Display by hand so their text follows the language. TraySummary carries the language so a change redraws the tray. Engine text is shown as received. How to add a string or a language, the checks and the review gate: docs/i18n.md. Tests: i18n_catalogs.rs (the translators' check), i18n_keys.rs, i18n_language.rs, i18n_switch.rs (fake shell switches the language and the drawn text changes, per-key fallback).

Icons

Phosphor icons from a bundled, subset font (crates/relay-ui/src/icons.rs, assets/font/README.md, reasoning in docs/decisions.md), each face in its own egui family so icons never fall back through text fonts. Rules: an icon stands alone only where its meaning is universal (copy, more, send, attach, close, back, search, star; the call-log arrows, the crossed phone and the infinity sign are glyphs next to text); Call, Trust and similar acts keep a visible label beside the icon (icon_label). Every icon-only button (icon_button, icon_toggle, icon_button_danger, icon_button_accent) has a tooltip that is also its accessible name, and is 44 points under touch rules, 32 with a pointer. Sections collapse with ui::collapsing::collapsing_header: the chevron sits on the right with a SPACE_M inset in Settings, Connect and Channels, on the left for Details and History. The sidebar shows an icon before each label; the phone tab bar shows the icon above a short label. Tests: tests/icons.rs, tests/icon_screens.rs; the phone rig finds icons with click_icon and icon_rects.

Self-update (desktop only)

crates/relay-ui/src/updates.rs holds UpdateState (Idle, Checking, UpToDate, Available, Downloading, Verifying, Installing, Failed), UpdateOffer, UpdateFailure and the Actions glue (check_for_update, install_update, run_update, retry_update, launch_update_check); the state lives in Shared::updates, independent of the daemon. The shell decides: Shell::can_self_update is false by default (Android), and then no button, no Settings group and no call happen. ui/updates.rs draws the sidebar button (right above Settings; disabled with "Finish your call first." during a call) and the "Updates" group of Settings, Startup (opt-in switch, the privacy sentence, Check for updates, a status line). Strings: localizations/*/updates.ftl. Tests: update_sidebar, update_settings, update_fit, outdated_version.

The out-of-date daemon card also compares the daemon's release version (Settings.daemon_version) with the app's, so an update that keeps the API revision still offers the Restart.