Add reading list progress actions
This commit is contained in:
@@ -2,9 +2,36 @@ use std::time::SystemTime;
|
||||
|
||||
use crate::{DomainError, ProfileId, ReadingListId, SpaceId, UrlText};
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum ReadingProgress {
|
||||
Unread,
|
||||
Finished,
|
||||
}
|
||||
|
||||
impl ReadingProgress {
|
||||
#[must_use]
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::Unread => "Unread",
|
||||
Self::Finished => "Read",
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn action_label(self) -> &'static str {
|
||||
match self {
|
||||
Self::Unread => "Mark Read",
|
||||
Self::Finished => "Mark Unread",
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn toggled(self) -> Self {
|
||||
match self {
|
||||
Self::Unread => Self::Finished,
|
||||
Self::Finished => Self::Unread,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
@@ -74,6 +101,10 @@ impl ReadingListEntry {
|
||||
&self.progress
|
||||
}
|
||||
|
||||
pub fn set_progress(&mut self, progress: ReadingProgress) {
|
||||
self.progress = progress;
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn added_at(&self) -> SystemTime {
|
||||
self.added_at
|
||||
|
||||
Reference in New Issue
Block a user