feat: desktop notification when goose finishes a task (#8647)
Signed-off-by: Abhijay Jain <Abhijay007j@gmail.com>
This commit is contained in:
@@ -32,6 +32,14 @@ const i18n = defineMessages({
|
||||
},
|
||||
configGuide: { id: 'settings.notifications.configGuide', defaultMessage: 'Configuration guide' },
|
||||
openSettings: { id: 'settings.notifications.openSettings', defaultMessage: 'Open Settings' },
|
||||
taskNotifications: {
|
||||
id: 'settings.notifications.task.title',
|
||||
defaultMessage: 'Task completion notifications',
|
||||
},
|
||||
taskNotificationsDesc: {
|
||||
id: 'settings.notifications.task.description',
|
||||
defaultMessage: 'Notify when Goose finishes a task while the window is in the background',
|
||||
},
|
||||
menuBarIcon: { id: 'settings.menuBarIcon.title', defaultMessage: 'Menu bar icon' },
|
||||
menuBarIconDesc: {
|
||||
id: 'settings.menuBarIcon.description',
|
||||
@@ -209,6 +217,7 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
|
||||
const [menuBarIconEnabled, setMenuBarIconEnabled] = useState(true);
|
||||
const [dockIconEnabled, setDockIconEnabled] = useState(true);
|
||||
const [wakelockEnabled, setWakelockEnabled] = useState(true);
|
||||
const [notificationsEnabled, setNotificationsEnabled] = useState(true);
|
||||
const [isMacOS, setIsMacOS] = useState(false);
|
||||
const [isDockSwitchDisabled, setIsDockSwitchDisabled] = useState(false);
|
||||
const [showNotificationModal, setShowNotificationModal] = useState(false);
|
||||
@@ -258,6 +267,10 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
|
||||
setWakelockEnabled(enabled);
|
||||
});
|
||||
|
||||
window.electron.getSetting('enableNotifications').then((enabled) => {
|
||||
setNotificationsEnabled(enabled ?? true);
|
||||
});
|
||||
|
||||
if (isMacOS) {
|
||||
window.electron.getDockIconState().then((enabled) => {
|
||||
setDockIconEnabled(enabled);
|
||||
@@ -316,6 +329,12 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
|
||||
}
|
||||
};
|
||||
|
||||
const handleNotificationsToggle = async (checked: boolean) => {
|
||||
setNotificationsEnabled(checked);
|
||||
await window.electron.setSetting('enableNotifications', checked);
|
||||
trackSettingToggled('task_notifications', checked);
|
||||
};
|
||||
|
||||
const handleShowPricingToggle = async (checked: boolean) => {
|
||||
setShowPricing(checked);
|
||||
await window.electron.setSetting('showPricing', checked);
|
||||
@@ -371,6 +390,24 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h3 className="text-text-primary text-xs">
|
||||
{intl.formatMessage(i18n.taskNotifications)}
|
||||
</h3>
|
||||
<p className="text-xs text-text-secondary max-w-md mt-[2px]">
|
||||
{intl.formatMessage(i18n.taskNotificationsDesc)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Switch
|
||||
checked={notificationsEnabled}
|
||||
onCheckedChange={handleNotificationsToggle}
|
||||
variant="mono"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h3 className="text-text-primary text-xs">{intl.formatMessage(i18n.menuBarIcon)}</h3>
|
||||
|
||||
Reference in New Issue
Block a user