diff --git a/src/app/hooks/useTauriToastActions.ts b/src/app/hooks/useTauriToastActions.ts index 4b608cb08..074b6062f 100644 --- a/src/app/hooks/useTauriToastActions.ts +++ b/src/app/hooks/useTauriToastActions.ts @@ -1,7 +1,10 @@ import { useNavigate } from 'react-router-dom'; import { MsgType } from 'matrix-js-sdk'; +import { useSetAtom } from 'jotai'; +import { Icons } from 'folds'; import { useMatrixClient } from './useMatrixClient'; import { useTauriEvent } from './useTauri'; +import { createErrorToast, toastQueueAtom } from '../state/toast'; /** Payload of the `lotus-notification-activate` event (a plain body click). */ interface ActivateDetail { @@ -27,6 +30,7 @@ interface ReplyDetail { export function useTauriToastActions(): void { const navigate = useNavigate(); const mx = useMatrixClient(); + const setToast = useSetAtom(toastQueueAtom); useTauriEvent('lotus-notification-activate', ({ path }) => { if (path) navigate(path); @@ -34,6 +38,17 @@ export function useTauriToastActions(): void { useTauriEvent('lotus-notification-reply', ({ roomId, text }) => { if (!roomId || !text) return; - mx.sendMessage(roomId, { msgtype: MsgType.Text, body: text }).catch(() => undefined); + // #79 — a quick-reply failure (offline, no send permission, etc.) used to + // be swallowed with no feedback, leaving the user believing it was sent. + // Surface it via the in-app error toast instead. + mx.sendMessage(roomId, { msgtype: MsgType.Text, body: text }).catch(() => { + setToast( + createErrorToast( + 'Your quick reply could not be sent. Please try again.', + Icons.Warning, + 'Reply failed', + ), + ); + }); }); }