Add reading list internal page

This commit is contained in:
2026-05-08 00:57:59 -04:00
parent e225fac222
commit b8d2b291b2
15 changed files with 486 additions and 4 deletions
+2
View File
@@ -6,6 +6,7 @@ pub enum CommandScope {
Spaces,
Tabs,
Bookmarks,
ReadingList,
History,
Settings,
Plugins,
@@ -49,6 +50,7 @@ fn parse_scope(value: &str) -> Option<(CommandScope, &str)> {
"@spaces" => CommandScope::Spaces,
"@tabs" => CommandScope::Tabs,
"@bookmarks" => CommandScope::Bookmarks,
"@reading-list" | "@reading" => CommandScope::ReadingList,
"@history" => CommandScope::History,
"@settings" => CommandScope::Settings,
"@plugins" => CommandScope::Plugins,
+1
View File
@@ -40,3 +40,4 @@ entity_id!(SplitId, "split");
entity_id!(WebViewId, "webview");
entity_id!(DownloadId, "download");
entity_id!(BookmarkId, "bookmark");
entity_id!(ReadingListId, "reading");
+5 -1
View File
@@ -7,6 +7,7 @@ mod history;
mod identifiers;
mod plugin;
mod profile;
mod reading_list;
mod space;
mod split;
mod sync;
@@ -22,12 +23,15 @@ pub use download::{
};
pub use error::DomainError;
pub use history::HistoryEntry;
pub use identifiers::{BookmarkId, DownloadId, ProfileId, SpaceId, SplitId, TabId, WebViewId};
pub use identifiers::{
BookmarkId, DownloadId, ProfileId, ReadingListId, SpaceId, SplitId, TabId, WebViewId,
};
pub use plugin::{
PluginContributionPoint, PluginId, PluginManifest, PluginPermission, PluginPermissionRisk,
PluginSignature, PluginSignatureAlgorithm,
};
pub use profile::{Profile, ProfileKind};
pub use reading_list::{ReadingListEntry, ReadingProgress};
pub use space::{ArchivePolicy, Space};
pub use split::{SplitAxis, SplitLayout, SplitPane};
pub use sync::{
+89
View File
@@ -0,0 +1,89 @@
use std::time::SystemTime;
use crate::{DomainError, ProfileId, ReadingListId, SpaceId, UrlText};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ReadingProgress {
Unread,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ReadingListEntry {
id: ReadingListId,
profile_id: ProfileId,
space_id: SpaceId,
title: String,
source_url: UrlText,
progress: ReadingProgress,
added_at: SystemTime,
}
impl ReadingListEntry {
pub fn new(
profile_id: ProfileId,
space_id: SpaceId,
title: impl Into<String>,
source_url: UrlText,
added_at: SystemTime,
) -> Result<Self, DomainError> {
let title = non_empty_text("reading list title", title.into())?;
Ok(Self {
id: ReadingListId::new(),
profile_id,
space_id,
title,
source_url,
progress: ReadingProgress::Unread,
added_at,
})
}
#[must_use]
pub fn id(&self) -> &ReadingListId {
&self.id
}
#[must_use]
pub fn profile_id(&self) -> &ProfileId {
&self.profile_id
}
#[must_use]
pub fn space_id(&self) -> &SpaceId {
&self.space_id
}
#[must_use]
pub fn title(&self) -> &str {
&self.title
}
#[must_use]
pub fn source_url(&self) -> &UrlText {
&self.source_url
}
#[must_use]
pub fn display_url(&self) -> String {
self.source_url.display_url()
}
#[must_use]
pub fn progress(&self) -> &ReadingProgress {
&self.progress
}
#[must_use]
pub fn added_at(&self) -> SystemTime {
self.added_at
}
}
fn non_empty_text(field: &'static str, value: String) -> Result<String, DomainError> {
let trimmed = value.trim();
if trimmed.is_empty() {
return Err(DomainError::EmptyField { field });
}
Ok(trimmed.to_string())
}
+1
View File
@@ -8,6 +8,7 @@ pub enum SyncObjectKind {
Spaces,
Tabs,
Bookmarks,
ReadingList,
Profiles,
History,
PluginSettings,