Files
VoelinClient/crates/voelin-store/src/lib.rs
T
Claude a36245bd9f ui: a New line above the first unread message, and read markers kept on disk
Messages count as read only while their chat is on screen (Nav.chat-shown)
in the focused window: winit's focus events, through slint's
unstable-winit-030 on the desktop; Android counts a chat on screen as
read. A tab keeps the newest message read and counts what came after it,
not our own. Entering a tab with new messages puts a red New line above
the first one until the tab is left (so does a stored or gateway page
that brings them while the tab is on screen), and while that line is
above the view a bar over the list counts them, with Jump and Mark as
read.

voelin-store migration 5 adds chat_reads (Store::chat_read, set_chat_read,
chat_reads). Markers are loaded once a session's server is known and
written when a tab is left, marked read, its session ends and on exit,
never per message; a restart counts what came while away again, gateway
pages included. Dev switch VOELIN_OPEN=unread[:end].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
2026-10-07 09:01:15 +00:00

43 lines
1.3 KiB
Rust

//! Local persistence for the client.
//!
//! One SQLite database holds identities, bookmarks, settings, contacts
//! ([`contacts`]) and the chat history ([`chat`]). Passwords and query
//! credentials never go into the database; they live in a [`Secrets`] store
//! (the OS keyring with the `keyring` feature).
//!
//! The schema is versioned (`PRAGMA user_version`): opening a database runs
//! the migrations it has not seen, each in one transaction, keeping the data.
pub mod chat;
pub mod contacts;
mod secrets;
mod store;
pub use chat::{
ChatCursor, ChatRead, ChatTarget, MessageSource, NewMessage, PageQuery, Reaction, RemoteInfo,
StoredMessage, SyncState, WriteOutcome, Written,
};
pub use contacts::{Contact, ContactSeen, Relation};
#[cfg(feature = "keyring")]
pub use secrets::KeyringSecrets;
pub use secrets::{MemorySecrets, Secrets};
pub use store::{
Bookmark, CachedServerIcon, IdentityEntry, IdentityOrigin, QueryConfig, QueryTransport, Store,
};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("database: {0}")]
Db(#[from] rusqlite::Error),
#[error("serialization: {0}")]
Json(#[from] serde_json::Error),
#[error("{0} {1} not found")]
NotFound(&'static str, i64),
#[error("secret store: {0}")]
Secrets(String),
#[error("io: {0}")]
Io(#[from] std::io::Error),
}
pub type Result<T> = std::result::Result<T, Error>;