diff --git a/packages/app/src/desktop/components/desktop-permissions-section.tsx b/packages/app/src/desktop/components/desktop-permissions-section.tsx index cb265876c..ee6b98938 100644 --- a/packages/app/src/desktop/components/desktop-permissions-section.tsx +++ b/packages/app/src/desktop/components/desktop-permissions-section.tsx @@ -14,6 +14,7 @@ export function DesktopPermissionsSection() { isRefreshing, requestingPermission, isSendingTestNotification, + testNotificationError, refreshPermissions, requestPermission, sendTestNotification, @@ -58,6 +59,11 @@ export function DesktopPermissionsSection() { void sendTestNotification(); }} /> + {testNotificationError ? ( + + {testNotificationError} + + ) : null} ({ gap: theme.spacing[2], marginBottom: theme.spacing[3], }, + errorText: { + fontSize: theme.fontSize.xs, + paddingHorizontal: theme.spacing[4], + paddingBottom: theme.spacing[2], + }, })); diff --git a/packages/app/src/desktop/permissions/use-desktop-permissions.ts b/packages/app/src/desktop/permissions/use-desktop-permissions.ts index e393511e3..b2778c6db 100644 --- a/packages/app/src/desktop/permissions/use-desktop-permissions.ts +++ b/packages/app/src/desktop/permissions/use-desktop-permissions.ts @@ -14,6 +14,7 @@ export interface UseDesktopPermissionsReturn { isRefreshing: boolean; requestingPermission: DesktopPermissionKind | null; isSendingTestNotification: boolean; + testNotificationError: string | null; refreshPermissions: () => Promise; requestPermission: (kind: DesktopPermissionKind) => Promise; sendTestNotification: () => Promise; @@ -112,22 +113,25 @@ export function useDesktopPermissions(): UseDesktopPermissionsReturn { [isDesktop, refreshPermissions], ); + const [testNotificationError, setTestNotificationError] = useState(null); + const sendTestNotification = useCallback(async () => { if (!isDesktop) { return; } setIsSendingTestNotification(true); + setTestNotificationError(null); try { const sent = await sendOsNotification({ title: "Paseo notification test", body: "If you can see this, desktop notifications work.", }); if (!sent) { - console.warn("[Settings] Desktop test notification was not delivered"); + setTestNotificationError("Notification was not delivered. Check System Settings > Notifications."); } } catch (error) { - console.error("[Settings] Failed to send desktop test notification", error); + setTestNotificationError("Failed to send notification."); } finally { if (isMountedRef.current) { setIsSendingTestNotification(false); @@ -149,6 +153,7 @@ export function useDesktopPermissions(): UseDesktopPermissionsReturn { isRefreshing, requestingPermission, isSendingTestNotification, + testNotificationError, refreshPermissions, requestPermission, sendTestNotification,