Split the social controller: the friends, the bell, the search and the social events into voelin-ui-vm
social/logic.rs now has the contacts as rows (contact_item, people), the buttons of a contact and what they ask the window to do next, the bell (notify, the rows, read, clear, open), the search with what each result opens, and what an engine event does to the friends, the pokes, the offline messages and the notices (event). events::handle runs that first, then events::apply, so a front end has one entry point; Social<D> is the state those keep, with what the messages page keeps as D for now. Refresh got people, conversations and dm, the host got dm_shown and now_ms, and Persist.Settings pages are told apart from the new notices. The Slint side (social/bind.rs) writes the Bridge, shows the desktop toasts and navigates. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
52e39f0b5a
commit
2d6cbf66af
12 files changed
+2137
-1063
No files matched your search
+31
-27
@@ -27,7 +27,7 @@ crates/voelin-ui-vm/ view models and state, no UI toolkit
|
||||
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/mod.rs tree.rs chat/mod.rs social.rs home.rs streams/mod.rs avatar.rs studio/mod.rs
|
||||
servers/mod.rs tree.rs chat/mod.rs social/mod.rs home.rs streams/mod.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; the
|
||||
chat view (tabs, lines, divider, drawers) and the user's moves
|
||||
@@ -39,6 +39,8 @@ crates/voelin-ui-vm/ view models and state, no UI toolkit
|
||||
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
|
||||
social/logic.rs the friends, the bell and the search as rows, what the user's moves on
|
||||
them do, and what an event does to the friends, pokes and notices
|
||||
settings_page/logic.rs
|
||||
the audio settings page (devices, form, microphone test, push to
|
||||
talk), the crash notice and the volume dialog of a client
|
||||
@@ -70,16 +72,17 @@ crates/voelin-ui/ the Slint front end
|
||||
src/
|
||||
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`,
|
||||
host.rs SlintHost (the answers the transitions ask for), `App::handle_event`,
|
||||
`transition` and `perform`: doing what an `Update` says
|
||||
members.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
|
||||
search; previews.rs: pictures in chat; popout.rs: the stream's own
|
||||
window)
|
||||
home.rs messages.rs events.rs previews.rs popout.rs
|
||||
the Slint side of each area (previews.rs: pictures in chat;
|
||||
popout.rs: the stream's own window)
|
||||
chat/ mod.rs, bind.rs: the chat view's Bridge writes and models
|
||||
servers/ mod.rs, bind.rs: connecting and observing (store, secrets, engine),
|
||||
the rail, the server card and the tree on the Bridge
|
||||
social/ mod.rs (the models), bind.rs: contacts, the bell and the search on
|
||||
the Bridge, the desktop toasts, the navigation after a move
|
||||
settings_page/ mod.rs, bind.rs: the audio devices, the hotkey, the codec download,
|
||||
the crash reports and the Bridge writes of the settings page
|
||||
settings_pages/ mod.rs (Pages), bind.rs: the settings pages on the Bridge
|
||||
@@ -131,35 +134,37 @@ 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.** `voelin_ui_vm::events::handle(state, social, host, event)` is
|
||||
the one dispatch: it lets `social::logic::event` look at the event first
|
||||
(the friends, pokes, offline messages and the notices, which need the state
|
||||
as it was before the event), then `events::apply` changes the `AppState`,
|
||||
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, the audio settings, the clients' volumes), 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 or a private chat is on screen, the store's read
|
||||
markers, the preview limit, the time. The Slint client's
|
||||
`App::handle_event` is `handle` and then `perform`, which carries the update
|
||||
out in `host.rs`; a GPUI client calls `handle` and draws what
|
||||
`Update::refresh` names. The vm tests replay tapes of events against a fake
|
||||
`Host` (`events/tests.rs`, `social/logic.rs`). `Update::rest` hands back the
|
||||
events whose state is not in the `AppState`: the Stream Studio's stream
|
||||
(`StreamState` and `StreamViewers` while `Host::studio_streams_to`),
|
||||
`SettingChanged`, and the rest that no screen looks at. The streams we
|
||||
`SettingChanged`, the offline messages and their requests (`messages.rs`
|
||||
keeps those for now), and the rest that no screen looks at. The streams we
|
||||
share and watch are in the `AppState` (`share`, `watch`; the capture and
|
||||
the decoder are the front end's, and an update says when to attach or drop
|
||||
them). 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 `social.rs`.
|
||||
them). The friends, the pokes, the bell's notices and what the friends page
|
||||
and the search keep are in `Social` (`social::logic`), which a front end
|
||||
passes to `handle` besides the `AppState`.
|
||||
- **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,
|
||||
commands or messages for the status line, and write no Bridge) and
|
||||
`<area>/bind.rs` in `voelin-ui` (the Bridge and model writes, windows,
|
||||
timers, threads, engine commands). Done: `settings_pages`, `studio`, `streams`, `chat`, `servers` and `settings_page`.
|
||||
timers, threads, engine commands). Done: `settings_pages`, `studio`, `streams`, `chat`, `servers`, `settings_page` and `social`.
|
||||
|
||||
The pure code is tested in `voelin-ui-vm` (`cargo test -p voelin-ui-vm`,
|
||||
no display); the Slint crate's tests are what needs the window types.
|
||||
@@ -181,7 +186,6 @@ the same shape as `settings_pages` and `studio`: move the decisions into
|
||||
| File | `.set_` calls | What it mixes |
|
||||
|---|---|---|
|
||||
| `app.rs` | 31 | setup, the status line, the toolbar and tree refreshes (the event dispatch is `vm::events::apply`) |
|
||||
| `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) |
|
||||
| `images.rs` | 13 | the decoded-picture cache |
|
||||
| `messages.rs` | 12 | direct messages |
|
||||
|
||||
Reference in new issue
Block a user