brows3r_lib/settings/defaults.rs
1//! `Default` implementation for `Settings`.
2//!
3//! This file is the single source of truth for every v1 default from the
4//! proposal (lines 190-206). Other modules that need a default value must
5//! read it from `Settings::default()` — never hard-code it inline.
6
7use std::collections::BTreeMap;
8
9use super::{
10 AutoUpdateSettings, NotificationSettings, ProxyMode, Settings, StartupBehavior,
11 TransferConfirmations,
12};
13
14impl Default for Settings {
15 fn default() -> Self {
16 Self {
17 schema_version: 1,
18 // --- storage / transfer ---
19 download_dir: None, // resolved at runtime via tauri::api::path::download_dir()
20 transfer_concurrency: 4,
21 // --- cache ---
22 cache_ttl_secs: 30,
23 cache_size_cap_mb: 256,
24 // --- preview ---
25 preview_size_limit_mb: 50,
26 // --- view ---
27 default_view_mode: "Details".to_string(),
28 // --- notifications ---
29 notifications: NotificationSettings {
30 in_app: true,
31 os_enabled: true,
32 sound: false,
33 },
34 // --- cross-account fallback ---
35 fallback_threshold_mb: 100,
36 // --- transfer confirmations ---
37 transfer_confirmations: TransferConfirmations {
38 delete: true,
39 overwrite: true,
40 large_upload_mb: 500,
41 },
42 // --- S3-compatible endpoints registry ---
43 s3_compatible_endpoints: Vec::new(),
44 // --- auto-update ---
45 auto_update: AutoUpdateSettings {
46 enabled: true,
47 channel: "stable".to_string(),
48 },
49 // --- diagnostics ---
50 // Collection is on; export is always user-triggered (never auto-uploaded).
51 diagnostics_enabled: true,
52 // --- startup ---
53 startup_behavior: StartupBehavior {
54 restore_session: true,
55 open_to: None,
56 },
57 // --- proxy ---
58 proxy: ProxyMode::System,
59 // --- appearance ---
60 theme: "system".to_string(),
61 // --- keyboard shortcuts ---
62 // Backend stores user overrides only (sparse delta); the frontend
63 // baseline is canonical and ships with the app (task 16 fixture).
64 keyboard_shortcuts: BTreeMap::new(),
65 // --- forward-compat ---
66 unknown: BTreeMap::new(),
67 }
68 }
69}