Repository navigation
fix: ask for notifications in the extension too and use the extension notification API - #19
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix notifications in the extension and make the setting clear.
Why 0.2.0 never asked in the extension: the manifest's
notificationspermission 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.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.Testing
chromeAPI): banner asks; Turn on callschrome.notifications.createwith the sample and the extension icon; a 1-minute session ending sends "Focus session complete" the same way, with no web notification.