Repository navigation
feat(settings): add aw-notify configuration panel - #923
Conversation
Adds a new Notifications settings group with an AwNotifySettings component that reads/writes /api/0/settings/aw-notify — the same key the Android aw-notify NotifyWorker reads at startup (PR ActivityWatch#202). Users can configure alert labels, category filters, minute thresholds, and goal vs. warning notification type from the Settings UI without editing server-side JSON directly. Default alerts mirror the trimmed set from PR ActivityWatch#206: - All time: 60/120/240 min (warning) - Work: 15/30/60 min (goal) Related: ActivityWatch/aw-android#201
Greptile SummaryThe PR adds a Notifications settings panel for configuring Android aw-notify alerts through the server settings API.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the current code preserves an empty saved configuration and rejects the malformed threshold inputs identified in the previous review. Important Files Changed
Reviews (2): Last reviewed commit: "fix(settings): validate notification thr..." | Re-trigger Greptile |
| if (Array.isArray(data) && data.length > 0) { | ||
| this.alerts = data.map(dtoToRow); | ||
| } else { | ||
| this.alerts = this.defaultAlerts(); | ||
| } |
There was a problem hiding this comment.
Empty configuration restores defaults
When the user removes every alert and saves, the server-backed empty array enters this default branch on reload, causing the saved disabled state to be lost and the All and Work thresholds to become active again.
| if (Array.isArray(data) && data.length > 0) { | |
| this.alerts = data.map(dtoToRow); | |
| } else { | |
| this.alerts = this.defaultAlerts(); | |
| } | |
| if (Array.isArray(data)) { | |
| this.alerts = data.map(dtoToRow); | |
| } else { | |
| this.alerts = this.defaultAlerts(); | |
| } |
Knowledge Base Used: Settings, Server Connection, Theme, and i18n
| const thresholds = row.thresholdStr | ||
| .split(',') | ||
| .map(s => parseInt(s.trim(), 10)) | ||
| .filter(n => !isNaN(n) && n > 0); | ||
| return { |
There was a problem hiding this comment.
Threshold parser silently changes values
When a user enters a fractional or malformed threshold such as 60.5, abc, -5, parseInt truncates the fraction and the filter silently drops other entries, causing a different configuration to be persisted while the UI still reports that the settings were saved.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #923 +/- ##
==========================================
+ Coverage 38.67% 38.80% +0.13%
==========================================
Files 42 43 +1
Lines 2273 2278 +5
Branches 460 456 -4
==========================================
+ Hits 879 884 +5
Misses 1315 1315
Partials 79 79 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@greptileai review |
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
|
@TimeToBuildBob Merged, but this needs to use the same format as https://github.com/ActivityWatch/aw-notify-rs so that desktop (aw-tauri) notifications also work out of the box with unified config. |
|
Fixed the schema mismatch in follow-up #924. The editor now reads/writes |
Summary
Adds a Notifications settings group with an
AwNotifySettingscomponent that reads and writes/api/0/settings/aw-notify— the same key the Android aw-notifyNotifyWorkerreads at startup (ActivityWatch/aw-android#202).src/views/settings/AwNotifySettings.vue[ {"category": null, "label": "All", "thresholdMinutes": [60, 120, 240], "positive": false}, {"category": "Work", "label": "Work", "thresholdMinutes": [15, 30, 60], "positive": true} ]Context
This is Goal 2 from ActivityWatch/aw-android#201: a shared webui config surface so users manage notification thresholds in one place regardless of client, once the config lives in the settings API (done via ActivityWatch/aw-android#202).
Default alerts mirror the trimmed set from ActivityWatch/aw-android#206.
Test plan
aw-notifysetting, defaults (All 60/120/240 min, Work 15/30/60 min) appear/api/0/settings/aw-notifyis updated/api/0/settings/aw-notify