diff options
| author | Solstice <solstice@local> | 2026-06-09 01:10:46 -0700 |
|---|---|---|
| committer | Solstice <solstice@local> | 2026-06-09 01:10:46 -0700 |
| commit | 887c0bc6f968f80ac90220f24bb578438e05708a (patch) | |
| tree | 563925e9bc82ae0eee582dc9128ea753d0082ab0 /src-tauri/src/state.rs | |
| parent | 4e2d978eb5fc9457d5b913bc10faf1266e6dcda4 (diff) | |
fix: resolve final release blockers
Diffstat (limited to 'src-tauri/src/state.rs')
| -rw-r--r-- | src-tauri/src/state.rs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs index 8f3d52b..c6b4d03 100644 --- a/src-tauri/src/state.rs +++ b/src-tauri/src/state.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, Mutex}; use serde::{Deserialize, Serialize}; -use crate::storage::AppData; +use crate::storage::{AppData, TimerSnapshot}; #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] @@ -10,7 +10,7 @@ pub enum TimerPhase { LongBreak, } -#[derive(Debug, Clone, Serialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TimerState { pub phase: TimerPhase, pub remaining_secs: u64, @@ -39,4 +39,26 @@ impl TimerState { current_task_id: None, } } + + pub fn from_snapshot(snapshot: TimerSnapshot) -> Self { + Self { + phase: snapshot.phase, + remaining_secs: snapshot.remaining_secs, + total_secs: snapshot.total_secs, + running: snapshot.running, + session_count: snapshot.session_count, + current_task_id: snapshot.current_task_id, + } + } + + pub fn snapshot(&self) -> TimerSnapshot { + TimerSnapshot { + phase: self.phase, + remaining_secs: self.remaining_secs, + total_secs: self.total_secs, + running: self.running, + session_count: self.session_count, + current_task_id: self.current_task_id.clone(), + } + } } |
