Skip to content

fix: ask for notifications in the extension too and use the extension notification API - #19

Merged
ttncode merged 1 commit into
mainfrom
fix/notification-opt-in
Oct 11, 2026
Merged

ttncode merged 1 commit into
mainfrom
fix/notification-opt-in

Conversation

@ttncode

@ttncode ttncode commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Summary

Fix notifications in the extension and make the setting clear.

Why 0.2.0 never asked in the extension: the manifest's notifications permission makes Chrome grant it up front, so the browser has nothing to ask and the first-run banner (which waited for a browser "default" state) never appeared.

  • App-level on/off choice. Notifications now have their own setting on top of the browser permission. The first-run banner ("Get a notification when a focus session or break ends?" → Turn on) appears on first open in both the web app and the extension.
  • Sample on turn-on. Turning them on sends a sample notification and shows a note: if it never arrived, allow notifications for the browser in system settings and turn off Do Not Disturb / Focus — the usual reason a granted notification is silently dropped.
  • Extension uses chrome.notifications. Inside the extension, notifications go through the extension API (with the extension's icon); clicking one focuses the timer tab and window. The web app keeps the Notification API.
  • Menu switch. "Notifications on · test" is replaced by a plain switch: Notifications: On / Off / Blocked. Blocked explains how to allow them in site settings.
  • An earlier "Not now" dismissal is honoured as Off.

Testing

  • Lint, typecheck, unit tests and build pass.
  • Web (stubbed permission already granted): banner asks on first open; Turn on sends the sample and shows the note; the menu switch flips On/Off and stores the choice.
  • Extension page (stubbed chrome API): banner asks; Turn on calls chrome.notifications.create with the sample and the extension icon; a 1-minute session ending sends "Focus session complete" the same way, with no web notification.

… notification API

## Summary
Fix notifications in the extension and make the setting clear.

**Why 0.2.0 never asked in the extension:** the manifest's `notifications` permission makes Chrome grant it up front, so the browser has nothing to ask and the first-run banner (which waited for a browser "default" state) never appeared.

- **App-level on/off choice.** Notifications now have their own setting on top of the browser permission. The first-run banner ("Get a notification when a focus session or break ends?" → **Turn on**) appears on first open in both the web app and the extension.
- **Sample on turn-on.** Turning them on sends a sample notification and shows a note: if it never arrived, allow notifications for the browser in system settings and turn off Do Not Disturb / Focus — the usual reason a granted notification is silently dropped.
- **Extension uses `chrome.notifications`.** Inside the extension, notifications go through the extension API (with the extension's icon); clicking one focuses the timer tab and window. The web app keeps the Notification API.
- **Menu switch.** "Notifications on · test" is replaced by a plain switch: *Notifications: On / Off / Blocked*. Blocked explains how to allow them in site settings.
- An earlier "Not now" dismissal is honoured as Off.

## Testing
- Lint, typecheck, unit tests and build pass.
- Web (stubbed permission already granted): banner asks on first open; Turn on sends the sample and shows the note; the menu switch flips On/Off and stores the choice.
- Extension page (stubbed `chrome` API): banner asks; Turn on calls `chrome.notifications.create` with the sample and the extension icon; a 1-minute session ending sends "Focus session complete" the same way, with no web notification.
@ttncode
ttncode merged commit 0fc9ff2 into main Oct 11, 2026
2 checks passed
@ttncode
ttncode deleted the fix/notification-opt-in branch October 11, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant