From 3509a5f98be92c6a0cb97e3f1ab2bef0619ee90e Mon Sep 17 00:00:00 2001 From: ricautomation <240336275+ricautomation@users.noreply.github.com> Date: Tue, 21 Apr 2026 21:52:07 +0200 Subject: [PATCH] fix: add test notification button (closes #930) (#948) Adds a "Send test notification" button to the notification settings page to allow users to immediately verify their configuration. The button uses the existing notifyAgentCompletion API. --- .../openchamber/NotificationSettings.tsx | 78 ++++++++++++++----- 1 file changed, 58 insertions(+), 20 deletions(-) diff --git a/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx b/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx index ee5fad69..0411fdbf 100644 --- a/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx +++ b/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx @@ -385,6 +385,31 @@ export const NotificationSettings: React.FC = () => { }; }; + const handleTestNotification = async () => { + const apis = getRegisteredRuntimeAPIs(); + if (!apis?.notifications) { + toast.error('Notifications API not available'); + return; + } + + try { + const success = await apis.notifications.notifyAgentCompletion({ + title: 'Test Notification', + body: 'This is a test notification from OpenChamber.', + tag: 'openchamber-test', + }); + + if (success) { + toast.success('Test notification sent successfully'); + } else { + toast.error('Failed to send test notification'); + } + } catch (error) { + console.error('Test notification failed:', error); + toast.error('Failed to send test notification'); + } + }; + const handleEnableBackgroundNotifications = async () => { if (!pushSupported) { toast.error('Push notifications not supported'); @@ -547,26 +572,39 @@ export const NotificationSettings: React.FC = () => { {nativeNotificationsEnabled && canShowNotifications && ( -