Add new config fields for oneliner polling

Introduces `oneliner_poll_interval_seconds` and `oneliner_window_hours`
to the client configuration. These fields allow users to customize how
frequently the client polls for new oneliners and the time window for
the data fetched from the server.

Default values are provided for these fields to ensure backward
compatibility and a sensible out-of-the-box experience. The `Config`
struct now also includes helper methods `poll_interval()` and
`window_hours()` for easier access to these settings, including the
application of defaults.

Additionally, new functions `cases_dir()` and `snapshot_cache_path()`
are added to `client-desktop/src/paths.rs` to manage directories for
case data and the oneliner snapshot cache, respectively. These paths
follow OS-standard conventions for local application data.
This commit is contained in:
2026-04-18 10:09:00 +02:00
parent 9b9d68402f
commit 19d841e644
3 changed files with 92 additions and 0 deletions
+17
View File
@@ -21,3 +21,20 @@ pub fn pending_dir() -> Result<PathBuf, PathError> {
.map(|dirs| dirs.data_local_dir().join("pending"))
.ok_or(PathError::NoDataDir)
}
/// Directory holding one JSON marker per known case (locally created
/// and/or server-synced). Persists across app restarts.
/// Linux: `~/.local/share/doctate/cases/`
pub fn cases_dir() -> Result<PathBuf, PathError> {
ProjectDirs::from("", "", "doctate")
.map(|dirs| dirs.data_local_dir().join("cases"))
.ok_or(PathError::NoDataDir)
}
/// File path for the last-successful `/api/oneliners` response. Feeds
/// the UI at cold start before the first live poll completes.
pub fn snapshot_cache_path() -> Result<PathBuf, PathError> {
ProjectDirs::from("", "", "doctate")
.map(|dirs| dirs.data_local_dir().join("oneliners_cache.json"))
.ok_or(PathError::NoDataDir)
}