fix(webui): refine browser notifications (NAN-227)

Reconcile the original notification fix with the integrated main snapshot.

Group notification settings and simplify localized copy and documentation.
Preserve permission opt-out and notification click routing across app transitions.
Suppress late completion notifications for discarded temporary chats and align
notification settings skeletons with the loaded layout.
This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-20 13:45:04 +08:00
1 parent 7b2af031c0
commit 11152626f8
34 files changed
+728 -289

No files matched your search

@@ -37,6 +37,7 @@ import { usePageVisibility } from "@/hooks/usePageVisibility";
import { useAutoSave } from "@/components/settings/shared/useAutoSave";
import { cancelProviderOAuth, fetchSettings, fetchSettingsUsage } from "@/lib/api";
import {
LOCAL_PREFS_CHANGED_EVENT,
readLocalPreferences,
writeLocalPreferences,
type LocalPreferences,
@@ -257,6 +258,18 @@ export function useSettingsController({
pageVisible,
});
useEffect(() => {
const synchronize = (event: Event) => setLocalPrefs((event as CustomEvent<LocalPreferences>).detail);
const reload = () => setLocalPrefs(readLocalPreferences());
window.addEventListener(LOCAL_PREFS_CHANGED_EVENT, synchronize);
window.addEventListener("storage", reload);
window.addEventListener("focus", reload);
return () => {
window.removeEventListener(LOCAL_PREFS_CHANGED_EVENT, synchronize);
window.removeEventListener("storage", reload);
window.removeEventListener("focus", reload);
};
}, []);
useEffect(() => {
writeLocalPreferences(localPrefs);
}, [localPrefs]);