mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-05 00:14:18 +00:00
Settings search knew none of the desktop app's rows, short words matched a dozen descriptions, and the app's Notifications, Privacy and Backup pages talked about websites, browsers and Safari. - Search indexes the app's rows when its bridge is there (tray, start at sign-in, menu bar, quiet hours, taskbar, default mail app, updates, developer tools, usage info, crash reports) with translated synonyms, and the browser-only push rows only in a browser. New synonyms for threads, block images, dark mode, timezone, reading pane, week start, empty trash and quiet hours. A single word of up to five letters looks only in names and synonyms, so "about" finds About. - In the app, Notifications has no push relay section; one row says the app tells about new mail while it runs, with a link to General. Its taskbar and quiet hours section is "On this computer". Privacy has no relay link there, Backup says "other devices". - In a browser that can't push, two sentences, and the home screen hint only on iPhone and iPad. - Several accounts get one notification switch each instead of a checklist with "Enable for selected" and "Disable for selected". - Developer tools show only with advanced settings on. - "Two-step sign-in" heads its section, "Pictures from company websites" replaces "Sender favicons", the Privacy relay link no longer points to a hidden choice, Offline warns about disk encryption once, and the reset confirm says what stays and whether other devices change. A reset keeps the choice to sync settings. Changed assertions: account-security-signin looks for the heading by its new name, settings-search expects the renamed rows, multi-account-push tests the switches that replace the checklist.
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect, useState } from "react";
|
|
import { useTranslations } from "next-intl";
|
|
import { getDesktopBridge } from "@/lib/desktop/bridge";
|
|
import type { DesktopDevToolsState } from "@/lib/desktop/types";
|
|
import { SettingItem, SettingsSection, ToggleSwitch } from "./settings-section";
|
|
|
|
/**
|
|
* Troubleshooting in the desktop app: Chromium's developer tools on a key, off until the
|
|
* user turns them on. Main keeps the switch and asks with a native warning, so a page or
|
|
* plugin can't turn it on by itself. A browser never shows this.
|
|
*/
|
|
export function DesktopDevToolsSettings() {
|
|
const t = useTranslations("desktopDevTools");
|
|
const bridge = getDesktopBridge();
|
|
const devTools = bridge?.devTools;
|
|
const [state, setState] = useState<DesktopDevToolsState | null>(null);
|
|
|
|
useEffect(() => {
|
|
if (!devTools) return;
|
|
let stale = false;
|
|
void devTools.get().then((next) => {
|
|
if (!stale) setState(next);
|
|
}, () => {});
|
|
const stop = devTools.onChange((next) => {
|
|
if (!stale) setState(next);
|
|
});
|
|
return () => {
|
|
stale = true;
|
|
stop();
|
|
};
|
|
}, [devTools]);
|
|
|
|
if (!devTools || !state) return null;
|
|
const shortcut = bridge?.platform === "darwin" ? "Cmd+Option+I" : "Ctrl+Shift+I";
|
|
const description = state.forcedOff ? t("forced_off") : state.locked ? t("locked") : t("description", { shortcut });
|
|
|
|
return (
|
|
// Only with "Show advanced settings" on: nobody needs it to read mail (settings-p2-9).
|
|
<SettingsSection id="desktop-troubleshooting" advanced title={t("section_title")}>
|
|
<SettingItem label={t("label", { shortcut })} description={description} locked={state.forcedOff}>
|
|
<ToggleSwitch
|
|
checked={state.on}
|
|
disabled={state.forcedOff || state.locked}
|
|
testId="desktop-devtools-toggle"
|
|
onChange={(on) => void devTools.set(on).then(setState, () => {})}
|
|
/>
|
|
</SettingItem>
|
|
</SettingsSection>
|
|
);
|
|
}
|