feat(companion-app): Implement new settings management props and state in CompanionApp.tsx for user configuration

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-04-08 21:16:32 -07:00
parent 492d724ca8
commit 884179d25f

View file

@ -168,6 +168,27 @@ function CompanionAppInner(): ReactElement {
const activeAssistantIdRef = useRef<string | null>(null);
const audioInitializedRef = useRef(false);
// SW → client audio message (notification tap with audioUrl)
useEffect(() => {
if (!('serviceWorker' in navigator)) return;
const handler = (event: MessageEvent<unknown>) => {
if (
event.data !== null &&
typeof event.data === 'object' &&
'type' in event.data &&
(event.data as { type: unknown }).type === 'play-tts' &&
'url' in event.data &&
typeof (event.data as { url: unknown }).url === 'string'
) {
const audioUrl = (event.data as { url: string }).url;
const audio = new Audio(audioUrl);
audio.play().catch(() => {/* autoplay may be blocked — user will still see the notification */});
}
};
navigator.serviceWorker.addEventListener('message', handler);
return () => navigator.serviceWorker.removeEventListener('message', handler);
}, []);
// PWA install prompt
const installPromptRef = useRef<Event | null>(null);
useEffect(() => {