Add diagnostics privacy controls
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use ely_browser_core::BrowserSnapshot;
|
use ely_browser_core::BrowserSnapshot;
|
||||||
use ely_design_system::colors;
|
use ely_design_system::colors;
|
||||||
use ely_domain::HistoryRecordingPolicy;
|
use ely_domain::{DiagnosticsReportingPolicy, HistoryRecordingPolicy};
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{AnyElement, Context, IntoElement, ParentElement, Styled, div, px, rgb};
|
use gpui::{AnyElement, Context, IntoElement, ParentElement, Styled, div, px, rgb};
|
||||||
use gpui_component::{
|
use gpui_component::{
|
||||||
@@ -32,7 +32,7 @@ impl ElyShell {
|
|||||||
.when(snapshot.active_profile_history_entry_count > 0, |this| {
|
.when(snapshot.active_profile_history_entry_count > 0, |this| {
|
||||||
this.child(render_history_clear_controls(confirming_clear, cx))
|
this.child(render_history_clear_controls(confirming_clear, cx))
|
||||||
})
|
})
|
||||||
.child(render_history_policy_rows(snapshot.history_recording_policy, cx)),
|
.child(render_privacy_settings_rows(snapshot, cx)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,18 +229,43 @@ fn render_clear_history_confirmation(cx: &mut Context<ElyShell>) -> AnyElement {
|
|||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_history_policy_rows(
|
fn render_privacy_settings_rows(
|
||||||
active_policy: HistoryRecordingPolicy,
|
snapshot: &BrowserSnapshot,
|
||||||
cx: &mut Context<ElyShell>,
|
cx: &mut Context<ElyShell>,
|
||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
div()
|
div()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.min_h_0()
|
.min_h_0()
|
||||||
.flex()
|
|
||||||
.flex_col()
|
|
||||||
.overflow_y_scrollbar()
|
.overflow_y_scrollbar()
|
||||||
.border_t_1()
|
.border_t_1()
|
||||||
.border_color(rgb(colors::HAIRLINE))
|
.border_color(rgb(colors::HAIRLINE))
|
||||||
|
.flex()
|
||||||
|
.flex_col()
|
||||||
|
.child(section_label("History"))
|
||||||
|
.child(render_history_policy_rows(snapshot.history_recording_policy, cx))
|
||||||
|
.child(section_label("Diagnostics"))
|
||||||
|
.child(render_diagnostics_policy_rows(snapshot.diagnostics_reporting_policy, cx))
|
||||||
|
.into_any_element()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn section_label(label: &'static str) -> AnyElement {
|
||||||
|
div()
|
||||||
|
.pt_4()
|
||||||
|
.pb_2()
|
||||||
|
.text_xs()
|
||||||
|
.font_semibold()
|
||||||
|
.text_color(rgb(colors::MUTED))
|
||||||
|
.child(label)
|
||||||
|
.into_any_element()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_history_policy_rows(
|
||||||
|
active_policy: HistoryRecordingPolicy,
|
||||||
|
cx: &mut Context<ElyShell>,
|
||||||
|
) -> AnyElement {
|
||||||
|
div()
|
||||||
|
.flex()
|
||||||
|
.flex_col()
|
||||||
.children(
|
.children(
|
||||||
HistoryRecordingPolicy::ALL
|
HistoryRecordingPolicy::ALL
|
||||||
.iter()
|
.iter()
|
||||||
@@ -251,6 +276,85 @@ fn render_history_policy_rows(
|
|||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_diagnostics_policy_rows(
|
||||||
|
active_policy: DiagnosticsReportingPolicy,
|
||||||
|
cx: &mut Context<ElyShell>,
|
||||||
|
) -> AnyElement {
|
||||||
|
div()
|
||||||
|
.flex()
|
||||||
|
.flex_col()
|
||||||
|
.children(
|
||||||
|
DiagnosticsReportingPolicy::ALL.iter().copied().enumerate().map(|(index, policy)| {
|
||||||
|
render_diagnostics_policy_row(index, policy, active_policy, cx)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.into_any_element()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_diagnostics_policy_row(
|
||||||
|
index: usize,
|
||||||
|
policy: DiagnosticsReportingPolicy,
|
||||||
|
active_policy: DiagnosticsReportingPolicy,
|
||||||
|
cx: &mut Context<ElyShell>,
|
||||||
|
) -> AnyElement {
|
||||||
|
let selected = policy == active_policy;
|
||||||
|
|
||||||
|
div()
|
||||||
|
.py_3()
|
||||||
|
.border_b_1()
|
||||||
|
.border_color(rgb(colors::HAIRLINE))
|
||||||
|
.flex()
|
||||||
|
.items_center()
|
||||||
|
.justify_between()
|
||||||
|
.gap_4()
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.min_w_0()
|
||||||
|
.flex()
|
||||||
|
.items_center()
|
||||||
|
.gap_3()
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.text_color(rgb(diagnostics_policy_icon_color(policy, selected)))
|
||||||
|
.child(diagnostics_policy_icon(policy, selected)),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.min_w_0()
|
||||||
|
.flex()
|
||||||
|
.flex_col()
|
||||||
|
.gap_1()
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.text_sm()
|
||||||
|
.font_semibold()
|
||||||
|
.truncate()
|
||||||
|
.text_color(rgb(colors::INK))
|
||||||
|
.child(policy.name()),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.text_xs()
|
||||||
|
.truncate()
|
||||||
|
.text_color(rgb(colors::MUTED))
|
||||||
|
.child(policy.detail()),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Button::new(("diagnostics-reporting-policy", index))
|
||||||
|
.ghost()
|
||||||
|
.xsmall()
|
||||||
|
.selected(selected)
|
||||||
|
.label(diagnostics_policy_button_label(policy, selected))
|
||||||
|
.tooltip(policy.name())
|
||||||
|
.on_click(cx.listener(move |shell, _, _, cx| {
|
||||||
|
shell.set_diagnostics_reporting_policy(policy, cx);
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
.into_any_element()
|
||||||
|
}
|
||||||
|
|
||||||
fn render_history_policy_row(
|
fn render_history_policy_row(
|
||||||
index: usize,
|
index: usize,
|
||||||
policy: HistoryRecordingPolicy,
|
policy: HistoryRecordingPolicy,
|
||||||
@@ -322,6 +426,13 @@ fn privacy_icon(policy: HistoryRecordingPolicy) -> IconName {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn diagnostics_icon(policy: DiagnosticsReportingPolicy) -> IconName {
|
||||||
|
match policy {
|
||||||
|
DiagnosticsReportingPolicy::Minimal => IconName::Info,
|
||||||
|
DiagnosticsReportingPolicy::Paused => IconName::EyeOff,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn policy_color(policy: HistoryRecordingPolicy) -> u32 {
|
fn policy_color(policy: HistoryRecordingPolicy) -> u32 {
|
||||||
match policy {
|
match policy {
|
||||||
HistoryRecordingPolicy::Record => colors::SUCCESS,
|
HistoryRecordingPolicy::Record => colors::SUCCESS,
|
||||||
@@ -329,14 +440,29 @@ fn policy_color(policy: HistoryRecordingPolicy) -> u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn diagnostics_policy_color(policy: DiagnosticsReportingPolicy) -> u32 {
|
||||||
|
match policy {
|
||||||
|
DiagnosticsReportingPolicy::Minimal => colors::SUCCESS,
|
||||||
|
DiagnosticsReportingPolicy::Paused => colors::PRIMARY,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn history_policy_icon(policy: HistoryRecordingPolicy, selected: bool) -> IconName {
|
fn history_policy_icon(policy: HistoryRecordingPolicy, selected: bool) -> IconName {
|
||||||
if selected { IconName::CircleCheck } else { privacy_icon(policy) }
|
if selected { IconName::CircleCheck } else { privacy_icon(policy) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn diagnostics_policy_icon(policy: DiagnosticsReportingPolicy, selected: bool) -> IconName {
|
||||||
|
if selected { IconName::CircleCheck } else { diagnostics_icon(policy) }
|
||||||
|
}
|
||||||
|
|
||||||
fn history_policy_icon_color(policy: HistoryRecordingPolicy, selected: bool) -> u32 {
|
fn history_policy_icon_color(policy: HistoryRecordingPolicy, selected: bool) -> u32 {
|
||||||
if selected { policy_color(policy) } else { colors::MUTED_SOFT }
|
if selected { policy_color(policy) } else { colors::MUTED_SOFT }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn diagnostics_policy_icon_color(policy: DiagnosticsReportingPolicy, selected: bool) -> u32 {
|
||||||
|
if selected { diagnostics_policy_color(policy) } else { colors::MUTED_SOFT }
|
||||||
|
}
|
||||||
|
|
||||||
fn history_policy_button_label(policy: HistoryRecordingPolicy, selected: bool) -> &'static str {
|
fn history_policy_button_label(policy: HistoryRecordingPolicy, selected: bool) -> &'static str {
|
||||||
match (policy, selected) {
|
match (policy, selected) {
|
||||||
(HistoryRecordingPolicy::Record, true) => "Default",
|
(HistoryRecordingPolicy::Record, true) => "Default",
|
||||||
@@ -344,3 +470,14 @@ fn history_policy_button_label(policy: HistoryRecordingPolicy, selected: bool) -
|
|||||||
_ => "Select",
|
_ => "Select",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn diagnostics_policy_button_label(
|
||||||
|
policy: DiagnosticsReportingPolicy,
|
||||||
|
selected: bool,
|
||||||
|
) -> &'static str {
|
||||||
|
match (policy, selected) {
|
||||||
|
(DiagnosticsReportingPolicy::Minimal, true) => "Default",
|
||||||
|
(_, true) => "Active",
|
||||||
|
_ => "Select",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use ely_domain::{
|
use ely_domain::{
|
||||||
ArchivePolicy, DownloadPolicy, FavoriteLimit, HistoryRecordingPolicy, NewTabDestination,
|
ArchivePolicy, DiagnosticsReportingPolicy, DownloadPolicy, FavoriteLimit,
|
||||||
ProfileId, ProfileSyncPolicy, SearchEngine, SyncObjectKind, SyncObjectPolicy, UpdatePolicy,
|
HistoryRecordingPolicy, NewTabDestination, ProfileId, ProfileSyncPolicy, SearchEngine,
|
||||||
|
SyncObjectKind, SyncObjectPolicy, UpdatePolicy,
|
||||||
};
|
};
|
||||||
use gpui::Context;
|
use gpui::Context;
|
||||||
|
|
||||||
@@ -66,6 +67,17 @@ impl ElyShell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn set_diagnostics_reporting_policy(
|
||||||
|
&mut self,
|
||||||
|
policy: DiagnosticsReportingPolicy,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
if let ShellState::Ready(core) = &mut self.state {
|
||||||
|
core.set_diagnostics_reporting_policy(policy);
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn reset_privacy_settings(&mut self, cx: &mut Context<Self>) {
|
pub(super) fn reset_privacy_settings(&mut self, cx: &mut Context<Self>) {
|
||||||
if let ShellState::Ready(core) = &mut self.state {
|
if let ShellState::Ready(core) = &mut self.state {
|
||||||
core.reset_privacy_settings();
|
core.reset_privacy_settings();
|
||||||
|
|||||||
@@ -343,10 +343,12 @@ const SETTINGS_ROUTE_MATCHES: &[SettingsRouteMatch] = &[
|
|||||||
"privacy & security",
|
"privacy & security",
|
||||||
"history",
|
"history",
|
||||||
"history recording",
|
"history recording",
|
||||||
|
"diagnostics",
|
||||||
|
"diagnostic reporting",
|
||||||
],
|
],
|
||||||
search_terms: &[
|
search_terms: &[
|
||||||
"Privacy & Security",
|
"Privacy & Security",
|
||||||
"History recording and profile-scoped privacy controls.",
|
"History recording, diagnostics, and profile-scoped privacy controls.",
|
||||||
"profile privacy",
|
"profile privacy",
|
||||||
"recording policy",
|
"recording policy",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use std::{collections::BTreeMap, time::SystemTime};
|
use std::{collections::BTreeMap, time::SystemTime};
|
||||||
|
|
||||||
use ely_domain::{
|
use ely_domain::{
|
||||||
ArchivePolicy, ArchivedTab, BookmarkEntry, BrowserTab, DEFAULT_SIDEBAR_WIDTH_PX, DomainError,
|
ArchivePolicy, ArchivedTab, BookmarkEntry, BrowserTab, DEFAULT_SIDEBAR_WIDTH_PX,
|
||||||
DownloadEntry, DownloadPolicy, FavoriteLimit, HistoryEntry, HistoryRecordingPolicy,
|
DiagnosticsReportingPolicy, DomainError, DownloadEntry, DownloadPolicy, FavoriteLimit,
|
||||||
NewTabDestination, NoteEntry, Profile, ProfileId, ProfileKind, ReadingListEntry, SearchEngine,
|
HistoryEntry, HistoryRecordingPolicy, NewTabDestination, NoteEntry, Profile, ProfileId,
|
||||||
SitePermissionAuditEvent, SitePermissionEntry, Space, SpaceId, SplitLayout, SyncStatus,
|
ProfileKind, ReadingListEntry, SearchEngine, SitePermissionAuditEvent, SitePermissionEntry,
|
||||||
TabGroup, TabId, UpdatePolicy, UrlText,
|
Space, SpaceId, SplitLayout, SyncStatus, TabGroup, TabId, UpdatePolicy, UrlText,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{CoreError, navigation::tab_title};
|
use crate::{CoreError, navigation::tab_title};
|
||||||
@@ -112,6 +112,7 @@ pub struct BrowserSnapshot {
|
|||||||
pub search_engine: SearchEngine,
|
pub search_engine: SearchEngine,
|
||||||
pub new_tab_destination: NewTabDestination,
|
pub new_tab_destination: NewTabDestination,
|
||||||
pub history_recording_policy: HistoryRecordingPolicy,
|
pub history_recording_policy: HistoryRecordingPolicy,
|
||||||
|
pub diagnostics_reporting_policy: DiagnosticsReportingPolicy,
|
||||||
pub favorite_limit: FavoriteLimit,
|
pub favorite_limit: FavoriteLimit,
|
||||||
pub update_policy: UpdatePolicy,
|
pub update_policy: UpdatePolicy,
|
||||||
pub command_query: String,
|
pub command_query: String,
|
||||||
@@ -144,6 +145,7 @@ pub struct BrowserCore {
|
|||||||
search_engine: SearchEngine,
|
search_engine: SearchEngine,
|
||||||
new_tab_destination: NewTabDestination,
|
new_tab_destination: NewTabDestination,
|
||||||
history_recording_policy: HistoryRecordingPolicy,
|
history_recording_policy: HistoryRecordingPolicy,
|
||||||
|
diagnostics_reporting_policy: DiagnosticsReportingPolicy,
|
||||||
favorite_limit: FavoriteLimit,
|
favorite_limit: FavoriteLimit,
|
||||||
update_policy: UpdatePolicy,
|
update_policy: UpdatePolicy,
|
||||||
sync_object_policies: SyncObjectPolicies,
|
sync_object_policies: SyncObjectPolicies,
|
||||||
@@ -190,6 +192,7 @@ impl BrowserCore {
|
|||||||
search_engine: SearchEngine::default(),
|
search_engine: SearchEngine::default(),
|
||||||
new_tab_destination,
|
new_tab_destination,
|
||||||
history_recording_policy: HistoryRecordingPolicy::default(),
|
history_recording_policy: HistoryRecordingPolicy::default(),
|
||||||
|
diagnostics_reporting_policy: DiagnosticsReportingPolicy::default(),
|
||||||
favorite_limit: FavoriteLimit::default(),
|
favorite_limit: FavoriteLimit::default(),
|
||||||
update_policy: UpdatePolicy::default(),
|
update_policy: UpdatePolicy::default(),
|
||||||
sync_object_policies: SyncObjectPolicies::default(),
|
sync_object_policies: SyncObjectPolicies::default(),
|
||||||
@@ -325,8 +328,13 @@ impl BrowserCore {
|
|||||||
self.history_recording_policy = policy;
|
self.history_recording_policy = policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_diagnostics_reporting_policy(&mut self, policy: DiagnosticsReportingPolicy) {
|
||||||
|
self.diagnostics_reporting_policy = policy;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn reset_privacy_settings(&mut self) {
|
pub fn reset_privacy_settings(&mut self) {
|
||||||
self.set_history_recording_policy(HistoryRecordingPolicy::default());
|
self.set_history_recording_policy(HistoryRecordingPolicy::default());
|
||||||
|
self.set_diagnostics_reporting_policy(DiagnosticsReportingPolicy::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
@@ -334,6 +342,11 @@ impl BrowserCore {
|
|||||||
self.history_recording_policy
|
self.history_recording_policy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn diagnostics_reporting_policy(&self) -> DiagnosticsReportingPolicy {
|
||||||
|
self.diagnostics_reporting_policy
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_favorite_limit(&mut self, favorite_limit: FavoriteLimit) {
|
pub fn set_favorite_limit(&mut self, favorite_limit: FavoriteLimit) {
|
||||||
self.favorite_limit = favorite_limit;
|
self.favorite_limit = favorite_limit;
|
||||||
}
|
}
|
||||||
@@ -408,6 +421,7 @@ impl BrowserCore {
|
|||||||
search_engine: self.search_engine,
|
search_engine: self.search_engine,
|
||||||
new_tab_destination: self.new_tab_destination,
|
new_tab_destination: self.new_tab_destination,
|
||||||
history_recording_policy: self.history_recording_policy,
|
history_recording_policy: self.history_recording_policy,
|
||||||
|
diagnostics_reporting_policy: self.diagnostics_reporting_policy,
|
||||||
favorite_limit: self.favorite_limit,
|
favorite_limit: self.favorite_limit,
|
||||||
update_policy: self.update_policy,
|
update_policy: self.update_policy,
|
||||||
command_query: self.command_query.clone(),
|
command_query: self.command_query.clone(),
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ use std::{error::Error, path::PathBuf};
|
|||||||
|
|
||||||
use ely_browser_core::{BrowserCore, InitialBrowserConfig};
|
use ely_browser_core::{BrowserCore, InitialBrowserConfig};
|
||||||
use ely_domain::{
|
use ely_domain::{
|
||||||
ArchivePolicy, DEFAULT_SIDEBAR_WIDTH_PX, DownloadPolicy, FavoriteLimit, HistoryRecordingPolicy,
|
ArchivePolicy, DEFAULT_SIDEBAR_WIDTH_PX, DiagnosticsReportingPolicy, DownloadPolicy,
|
||||||
NewTabDestination, ProfileKind, ProfileSyncPolicy, SearchEngine, SyncObjectKind,
|
FavoriteLimit, HistoryRecordingPolicy, NewTabDestination, ProfileKind, ProfileSyncPolicy,
|
||||||
SyncObjectPolicy, UpdatePolicy,
|
SearchEngine, SyncObjectKind, SyncObjectPolicy, UpdatePolicy,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -20,10 +20,13 @@ fn section_resets_restore_settings_defaults() -> Result<(), Box<dyn Error>> {
|
|||||||
assert_eq!(core.snapshot()?.search_engine, SearchEngine::DuckDuckGo);
|
assert_eq!(core.snapshot()?.search_engine, SearchEngine::DuckDuckGo);
|
||||||
|
|
||||||
core.set_history_recording_policy(HistoryRecordingPolicy::Pause);
|
core.set_history_recording_policy(HistoryRecordingPolicy::Pause);
|
||||||
|
core.set_diagnostics_reporting_policy(DiagnosticsReportingPolicy::Paused);
|
||||||
core.reset_privacy_settings();
|
core.reset_privacy_settings();
|
||||||
assert_eq!(core.snapshot()?.history_recording_policy, HistoryRecordingPolicy::Record);
|
let snapshot = core.snapshot()?;
|
||||||
|
assert_eq!(snapshot.history_recording_policy, HistoryRecordingPolicy::Record);
|
||||||
|
assert_eq!(snapshot.diagnostics_reporting_policy, DiagnosticsReportingPolicy::Minimal);
|
||||||
|
|
||||||
let active_space_id = core.snapshot()?.active_space_id;
|
let active_space_id = snapshot.active_space_id;
|
||||||
core.set_active_space_archive_policy(ArchivePolicy::IdleDays(30))?;
|
core.set_active_space_archive_policy(ArchivePolicy::IdleDays(30))?;
|
||||||
core.set_space_sidebar_width(&active_space_id, 56)?;
|
core.set_space_sidebar_width(&active_space_id, 56)?;
|
||||||
core.set_favorite_limit(FavoriteLimit::Six);
|
core.set_favorite_limit(FavoriteLimit::Six);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ pub use plugin::{
|
|||||||
PluginContributionPoint, PluginId, PluginManifest, PluginPermission, PluginPermissionRisk,
|
PluginContributionPoint, PluginId, PluginManifest, PluginPermission, PluginPermissionRisk,
|
||||||
PluginSignature, PluginSignatureAlgorithm,
|
PluginSignature, PluginSignatureAlgorithm,
|
||||||
};
|
};
|
||||||
pub use privacy::HistoryRecordingPolicy;
|
pub use privacy::{DiagnosticsReportingPolicy, HistoryRecordingPolicy};
|
||||||
pub use profile::{Profile, ProfileKind, ProfileSyncPolicy};
|
pub use profile::{Profile, ProfileKind, ProfileSyncPolicy};
|
||||||
pub use reading_list::{ReadingListEntry, ReadingProgress, ReadingProgressPercent};
|
pub use reading_list::{ReadingListEntry, ReadingProgress, ReadingProgressPercent};
|
||||||
pub use search::SearchEngine;
|
pub use search::SearchEngine;
|
||||||
|
|||||||
@@ -37,3 +37,45 @@ impl HistoryRecordingPolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||||
|
pub enum DiagnosticsReportingPolicy {
|
||||||
|
#[default]
|
||||||
|
Minimal,
|
||||||
|
Paused,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DiagnosticsReportingPolicy {
|
||||||
|
pub const ALL: &[Self] = &[Self::Minimal, Self::Paused];
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn reports_diagnostics(self) -> bool {
|
||||||
|
matches!(self, Self::Minimal)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn name(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Minimal => "Minimal Diagnostics",
|
||||||
|
Self::Paused => "Paused Diagnostics",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn detail(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Minimal => {
|
||||||
|
"Send startup, crash, WebView crash, sync error, plugin crash, and update result codes."
|
||||||
|
}
|
||||||
|
Self::Paused => "Keep diagnostics local for review and privacy exports.",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn status(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Minimal => "Diagnostics reporting is on",
|
||||||
|
Self::Paused => "Diagnostics reporting is paused",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user