Expand description
Application state for Avestruz.
This module defines the main application model and view state types.
The popup closes whenever something else is clicked, and its widget tree goes with it. Anything that should still be there when it opens again — the view, what was typed, the feed and the pages opened over it, how their rows measure and how far they are scrolled — lives here, not in a widget.
flowchart LR
model["AppModel"]
model --> feed["following: FeedState. The feed"]
model --> pages["pages: a stack of Page"]
pages --> thread["Thread: ThreadState"]
pages --> profile["Profile: ProfileState, with a FeedState of its notes"]
pages --> bookmarks["Bookmarks: BookmarksPage"]
pages --> search["Search: SearchPage"]
model --> composer["composer, drafts: what is being written"]
model --> zap["zap: ZapState"]
model --> relays["relays: RelaysState"]
model --> media["media: MediaState. Media servers, and files on their way to them"]
model --> people["profiles, nip05: everyone, by public key"]
model --> marks["engagement, bookmarks: what was made of notes"]
model --> stores["images, previews: what was fetched"]Every list of notes keeps the same three things beside its notes: how
tall each row measured (RowHeights), how far it is scrolled (a
Cell<f32> a ScrollPosition
writes to), and what is on its way. That is what lets a list come back
exactly as it was left.
The whole of what is in the model, by what it is for, is in
crate::guide::architecture.
Structs§
- AppModel
- The application model stores app-specific state used to describe its interface and drive its logic.
- Bookmarked
Notes - The notes the account has bookmarked, as the bookmarks page keeps them.
- Bookmarks
Page - The account’s bookmarks, as a page shows them.
- Bunker
Refusal - A remote signer turned a sign-in down, or could not be reached.
- Composer
- A note, a reply or a quote being written.
- Emoji
Picker - Every emoji there is, to pick one from: a group of them at a time, or those found by what is typed.
- Expanded
- The notes whose rows show all they say, where a long note is cut until
its reader asks for the rest: each with how far the top of its row is
above the top of what is in view, which the row keeps as it is shown
(see
ScrollPosition). Showing less of a note brings its row back into view by that much. - Feed
State - A list of someone’s notes, as the model keeps it: the feed, or the notes on a profile.
- Media
State - The account’s media servers, as the media servers page shows and changes them, and what is on its way to them.
- Nip05
Check - The name at a domain someone says is theirs (NIP-05), and whether it is.
- Notifications
Page - The page that shows what the account is told of: what its list keeps
of its rows. What it shows is the model’s (see
NotificationsState). - Notifications
State - What the account is told of, and how far finding it out has got. The model’s, not a page’s: it is kept up while no page shows it, for the count of what is new.
- Preview
- What is being written, as a row would show it if it went out as it is.
- Profile
State - One open profile, as the model keeps it. What its person says of
themselves is with everyone else’s, in
AppModel::profiles. - Reaction
Menu - What to react to a note with, on offer under its like: the emoji used most, or, once more were asked for, all there are.
- Relays
State - The account’s relays, as the relays page shows and changes them.
- Repost
Menu - The ways to pass a note on, on offer under its repost action.
- Search
Page - A search for people and notes, as its page keeps it. None of it is written anywhere: what was searched for is gone when the page is.
- Thread
State - One open thread, as the model keeps it.
- Upload
- A file on its way to a media server, to be attached to what is being written.
- WhoMenu
- Who left something on a note, on show under the count of them: who reposted it, who reacted to it, or who zapped it.
- ZapState
- A note being zapped.
Enums§
- Bookmark
State - How far the account’s bookmarks are known.
- Follow
Problem - Why following or unfollowing someone did not happen.
- Login
Progress - How far a sign-in has got.
- Nip05
State - How far finding out whether a name is someone’s has got.
- Page
- Something opened over the feed. Pages stack up, each opened from the one before, and each keeps what it shows and its place.
- Passing
- A way to pass a note on: what its repost action offers.
- Search
Progress - How far a search for people, or for notes, has got.
- Step
- Which way the list on show is stepped through from the keyboard, a row at a time.
- View
State - Which view the popup shows.
- ZapStage
- How far the zap of a note has got.
Constants§
- BARREN_
PAGES_ MAX - How many older pages in a row may bring nothing to show before a list stops looking further back on its own.
- REACTIONS_
OFFERED 🔒 - How many emoji are offered first to react with, beside the like and the way to all the others.
- WHO_
SHOWN - How many of those who left something on a note are shown, at the most: more than anyone reads through, and few enough to ask after.