fix(desktop): focus the native window when a notification is clicked
On cinny-desktop (Tauri/WebView2) a clicked notification navigated the web content but never raised the OS window (a service-worker/WebView2 client.focus() only focuses the document). The service-worker notificationClick path now calls a new focus_main_window Tauri command via invokeTauri (no-op outside Tauri) in addition to navigating; the rich-toast path is focused natively on the Rust side. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,7 @@ import { toastQueueAtom } from '../../state/toast';
|
||||
import { useReminders } from '../../hooks/useReminders';
|
||||
import { getRoomRetentionMs, isExpired } from '../../utils/retention';
|
||||
import { useTauriUpdater } from '../../hooks/useTauriUpdater';
|
||||
import { invokeTauri } from '../../hooks/useTauri';
|
||||
import { TauriDesktopFeatures } from '../../components/TauriDesktopFeatures';
|
||||
import { KeyboardShortcutsDialog, useKeyboardShortcutsTrigger } from '../../features/shortcuts';
|
||||
import { useRoomsListener } from '../../hooks/useRoomsListener';
|
||||
@@ -485,6 +486,10 @@ function MessageNotifications() {
|
||||
const onMessage = (event: MessageEvent) => {
|
||||
const data = event.data ?? {};
|
||||
if (data.type === 'notificationClick' && typeof data.path === 'string') {
|
||||
// On desktop, raise the native window — a service-worker/WebView2
|
||||
// `client.focus()` only focuses the document, not the OS window. No-op
|
||||
// outside Tauri.
|
||||
invokeTauri('focus_main_window');
|
||||
navigate(data.path);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user