From 887c0bc6f968f80ac90220f24bb578438e05708a Mon Sep 17 00:00:00 2001 From: Solstice Date: Tue, 9 Jun 2026 01:10:46 -0700 Subject: fix: resolve final release blockers --- src-tauri/src/state.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src-tauri/src/state.rs') 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(), + } + } } -- cgit v1.3-2-g0d8e