feat: add opt-in banner for push notifications#76
Open
ClickAndGoScript wants to merge 3 commits into
Open
Conversation
- Add he (Hebrew) translation for all existing strings - Complete zh-CN translation (missing strings added) - Move hardcoded test notification text in library.js to [[web-push:test.*]] - Move hardcoded admin nav label in library.js to [[web-push:admin.menu-label]] - Replace hardcoded strings in ACP template with [[web-push:admin.*]] keys
…tness - Add "Mark as read" and "View notifications" action buttons to push notifications, translated server-side per user language (en-GB, he, zh-CN) - Service worker handles button clicks: mark-read calls the write API directly without needing an open window; view-notifications focuses/opens the notifications page - Pass nid in notification data payload so mark-read can identify the notification - settings.js: add browser support detection (serviceWorker + PushManager) - settings.js: race serviceWorker.ready against a 5s timeout to avoid infinite hang when no SW is registered (common on iOS before PWA install) - settings.js: handle permission denied before and after requestPermission() - settings.js: roll back browser-level subscription on API failure - settings.js: show success toast on subscribe
- Corner banner invites logged-in users to subscribe after a configurable number of page visits; dismissal and visit count stored in localStorage - Banner is shown only on supported devices (serviceWorker + PushManager available, permission not denied, SW registered) - ACP setting to enable/disable the banner and configure the visit threshold - Banner and all admin strings fully translated (en-GB, he, zh-CN)
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.
Adds an optional corner banner that invites logged-in users to enable push
notifications. It's off by default; the ACP has a toggle and a setting for how
many page visits to wait before showing it.
The banner is only shown on devices that actually support push (Service Worker
count and dismissal are stored in localStorage per device, so it won't reappear
after the user dismisses it or subscribes.
Part of #64.