Move the state transition of every engine event that the AppState holds into voelin-ui-vm
events::apply(state, host, event) changes the AppState for an engine Event and returns an Update: the parts to draw again (Refresh, each once), the status line, the engine commands, what to keep (Persist), pictures to decode again, the password dialog, notices for the bell, the chats that changed, a stream to watch. Host is what a transition asks while it runs (is the chat on screen, the store's read markers, the preview limit); the Slint client answers it in host.rs and carries the update out there, so App::handle_event is social_event, apply_event and social_refresh. The chat transitions (tabs, messages, what is read, pins and topics, files), the pictures linked in chats, the server's name, icon and gateway, joining again and the password prompt, the last place of voice and the stored volumes moved with it; Spot, the notice types, own_uids and peer_name moved to the view model crate. Update::rest hands back the events whose state is not in the AppState yet (the streams we share and watch, the studio's stream, a setting that changed); the friends, pokes and offline messages are still looked at by social.rs before and after. The vm tests replay tapes of events against a fake Host. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0672b21758
commit
03d1c3bd07
25 files changed
+2903
-1340
No files matched your search
+36
-5
@@ -22,8 +22,14 @@ crates/voelin-ui-vm/ view models and state, no UI toolkit
|
||||
studio_bridge.rs the same for the Stream Studio
|
||||
state.rs AppState, SessionView, Tab, Msg: what the client knows apart from
|
||||
the window, generic over the list type of a chat tab's lines
|
||||
servers.rs tree.rs chat.rs social.rs home.rs streams.rs avatar.rs studio/mod.rs
|
||||
host.rs Host (what a transition asks of its front end), Update (what it
|
||||
tells: Refresh, status, commands, Persist, ...), Cx
|
||||
events/ events::apply: what an engine event does to the AppState
|
||||
(mod.rs; gateway.rs: the gateway's events and directory)
|
||||
previews.rs pictures linked in chat: which to fetch, the transfers
|
||||
servers.rs tree.rs chat/mod.rs social.rs home.rs streams.rs avatar.rs studio/mod.rs
|
||||
pure view models (engine state → bridge structs), unit-tested
|
||||
chat/logic.rs chat tabs, messages and what is read, pins and topics, files
|
||||
settings.rs the UI's settings keys, the audio form
|
||||
settings_pages/logic.rs, studio/logic.rs
|
||||
the decisions of the settings pages and of the Stream Studio
|
||||
@@ -53,8 +59,10 @@ crates/voelin-ui/ the Slint front end
|
||||
phone layout)
|
||||
assets/ fonts/ (Inter, OFL), icons/ (Lucide, ISC), logo.svg
|
||||
src/
|
||||
app.rs setup, the Slint models (`Models`), event dispatch; `App` holds
|
||||
app.rs setup, the Slint models (`Models`), the event loop; `App` holds
|
||||
a `voelin_ui_vm::state::AppState` and the window
|
||||
host.rs SlintHost (the answers the transitions ask for), `App::apply_event`,
|
||||
`transition` and `perform`: doing what an `Update` says
|
||||
servers.rs chat.rs members.rs streams.rs settings_page.rs appearance.rs
|
||||
home.rs social.rs messages.rs events.rs previews.rs popout.rs
|
||||
the Slint side of each area (social.rs: contacts, the bell and the
|
||||
@@ -107,6 +115,29 @@ this file is `voelin_ui_vm::chat`. The boundary:
|
||||
`voelin_ui_vm::state`, generic over the list type `L` of a chat tab's
|
||||
lines: the Slint app plugs in `Rows<ChatLine>` (`app::ChatRows`), a front
|
||||
end that re-renders can use a `Vec`. `App.state` is the one `AppState`.
|
||||
- **Events.** `voelin_ui_vm::events::apply(state, host, event)` is the one
|
||||
dispatch: it changes the `AppState` for an engine `Event` and returns an
|
||||
`Update`, which says what the front end has to do: the parts to draw again
|
||||
(`Refresh`, each once however many events set it), the status line, the
|
||||
engine commands in order, what to keep (`Persist`: a bookmark, the UI's
|
||||
settings), pictures to decode again, the password dialog, notices for the
|
||||
bell, the chats that changed and a stream to watch. `Host` is what the
|
||||
transitions ask while they run: whether the chat is on screen, the store's
|
||||
read markers, the preview limit. The Slint client's `App::handle_event` is
|
||||
`social_event`, `apply_event` (`apply`, then `perform`, which carries the
|
||||
update out in `host.rs`) and `social_refresh`; a GPUI client calls `apply`
|
||||
and draws what `Update::refresh` names. The vm tests replay tapes of events
|
||||
against a fake `Host` (`events/tests.rs`). `Update::rest` hands back the
|
||||
events whose state is not in the `AppState` yet: the stream we share and
|
||||
watch and the studio's (`StreamState`, `StreamViewerRequest`,
|
||||
`StreamViewers`, `WatchState`, `WatchLayers`, `StreamKeyframeRequest`,
|
||||
`StreamLayerBitrate`), `SettingChanged`, and the rest that no screen looks
|
||||
at. The friends, pokes, offline messages and notices that `social.rs` keeps
|
||||
(`Poke`, `FriendPresence`, `OfflineMessages`, `OfflineMessage`,
|
||||
`RequestDone`, and the notices of `Chat`, `ChatHistory`, `Presence`,
|
||||
`State`, `ServerInfo`, `ContactsChanged`, `AvatarReady`) are looked at by
|
||||
`social.rs` before and after `apply`. They move with `streams.rs` and
|
||||
`social.rs`.
|
||||
- **Logic and bind.** An area that interleaves decisions with Bridge writes
|
||||
is split into `<area>/logic.rs` in `voelin-ui-vm` (functions over the
|
||||
settings service, the `AppState` and plain rows; they return rows,
|
||||
@@ -134,9 +165,9 @@ the same shape as `settings_pages` and `studio`: move the decisions into
|
||||
| File | `.set_` calls | What it mixes |
|
||||
|---|---|---|
|
||||
| `streams.rs` | 45 | the streams panel, viewer and share dialog: what the voice card, the viewer header and the share form say, with the watch and share bookkeeping |
|
||||
| `chat.rs` | 38 | the chat view: lines, the unread divider, pins, topics and downloads, with the engine's history batches |
|
||||
| `app.rs` | 38 | event dispatch and the status line, the toolbar and tree refreshes |
|
||||
| `servers.rs` | 37 | the rail, the server dialog and the channel tree's refresh |
|
||||
| `chat.rs` | 33 | the chat view: lines, the unread divider, pins, topics and downloads (the engine's history batches, the reads and the gateway's pins and topics are in `chat/logic.rs`) |
|
||||
| `app.rs` | 31 | setup, the status line, the toolbar and tree refreshes (the event dispatch is `vm::events::apply`) |
|
||||
| `servers.rs` | 32 | the rail, the server dialog and the channel tree's refresh (the server's name, icon and gateway, joining again and the password are in `events`) |
|
||||
| `settings_page.rs` | 26 | the audio settings page and the devices |
|
||||
| `social.rs` | 23 | home's contacts, the bell and the search |
|
||||
| `dev.rs` | 23 | development switches and the sample data (the switches stay with the window; the sample rows can move) |
|
||||
|
||||
Reference in new issue
Block a user