use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PrivacySettings {
pub remember_recent_searches: bool,
pub diagnostics_include_paths: bool,
pub diagnostics_include_recent_searches: bool,
}
impl Default for PrivacySettings {
fn default() -> Self {
Self {
remember_recent_searches: true,
diagnostics_include_paths: false,
diagnostics_include_recent_searches: false,
}
}
}
impl PrivacySettings {
pub fn effective_recent_searches(&self) -> bool {
self.remember_recent_searches
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LocalDataCategory {
SourcePaths,
FileMetadata,
ExtractedText,
KeywordIndex,
Embeddings,
Snippets,
TemporaryPreviews,
RecentSearches,
Logs,
Diagnostics,
ModelFiles,
Settings,
}
impl LocalDataCategory {
pub fn user_label(self) -> &'static str {
match self {
LocalDataCategory::SourcePaths => "Folder list",
LocalDataCategory::FileMetadata => "File information",
LocalDataCategory::ExtractedText => "Prepared text",
LocalDataCategory::KeywordIndex => "Search data",
LocalDataCategory::Embeddings => "Better search data",
LocalDataCategory::Snippets => "Temporary previews",
LocalDataCategory::TemporaryPreviews => "Temporary previews",
LocalDataCategory::RecentSearches => "Recent searches",
LocalDataCategory::Logs => "Logs",
LocalDataCategory::Diagnostics => "Support files",
LocalDataCategory::ModelFiles => "Search helper",
LocalDataCategory::Settings => "App settings",
}
}
}
#[derive(Debug, Clone, Default)]
pub struct DiagnosticsPolicy {
pub include_raw_paths: bool,
pub include_folder_names: bool,
pub include_recent_searches: bool,
pub include_detailed_logs: bool,
}
impl DiagnosticsPolicy {
pub fn from_privacy(settings: &PrivacySettings) -> Self {
Self {
include_raw_paths: false, include_folder_names: false, include_recent_searches: settings.diagnostics_include_recent_searches,
include_detailed_logs: false,
}
}
pub fn allows_sensitive_optins(&self) -> bool {
true
}
}