4509a2b6d3
- P5-41/35 useTauriToastActions: native rich-toast click → navigate(path) (opens the room), quick reply → mx.sendMessage(roomId, m.text). The desktop bridge routes message notifications (tag=roomId) to show_rich_toast. - P5-56 useTauriFocusAssist + focusAssistActiveAtom: a native focus-assist-changed event drives the atom, OR'd into the existing quiet-hours gate in ClientNonUIFeatures so notifications+sounds suppress during Windows Focus Assist. - P5-48 recursive folder drag-drop: fileEntries.ts (sync webkitGetAsEntry capture → async batched readEntries traversal, path-prefixed names, 500-file cap) wired into useFileDrop, reusing the existing upload pipeline. +3 unit tests. Hooks no-op in the browser. Gates: tsc/eslint/prettier clean, build OK, 559 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
980 B
TypeScript
25 lines
980 B
TypeScript
import { useSetAtom } from 'jotai';
|
|
import { focusAssistActiveAtom } from '../state/focusAssist';
|
|
import { useTauriEvent } from './useTauri';
|
|
|
|
/** Detail shape of the `focus-assist-changed` event emitted by the native side. */
|
|
type FocusAssistChangedDetail = {
|
|
active: boolean;
|
|
};
|
|
|
|
/**
|
|
* P5-56 — Windows Focus Assist ↔ Do-Not-Disturb sync (desktop). Subscribes to
|
|
* the native `focus-assist-changed` event (Windows `SHQueryUserNotificationState`
|
|
* poll, `{ active }`) and mirrors it into `focusAssistActiveAtom`, which the
|
|
* notification gate reads to suppress notifications while the shell is in Focus
|
|
* Assist / Quiet Hours, presenting, gaming full-screen, or busy. Inert in the
|
|
* browser, since `useTauriEvent` only listens under Tauri.
|
|
*/
|
|
export function useTauriFocusAssist(): void {
|
|
const setFocusAssist = useSetAtom(focusAssistActiveAtom);
|
|
|
|
useTauriEvent<FocusAssistChangedDetail>('focus-assist-changed', ({ active }) =>
|
|
setFocusAssist(active),
|
|
);
|
|
}
|