Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Popup UI for Web Push Subscription in Extension #1424

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GAURAVCHAWLA1808
Copy link

This PR enhances the cookbook.push example by introducing a popup.html and popup.js to provide a user-friendly interface for managing push subscriptions. It addresses Issue #1408 by ensuring a complete web push implementation with non-interactive subscription handling.

Additionally, this PR addresses the review feedback from PR #1410 by isolating and implementing the requested changes separately.

Changes Implemented:
popup.html & popup.js:

User Interface for Subscription Management:
Added a simple UI with "Subscribe" and "Unsubscribe" buttons.
Displays the current subscription status to the user.
Service Worker Integration:
Ensures the service worker is ready before attempting push subscription.
Handles both subscribing and unsubscribing from push notifications.
Enhanced Logging & Error Handling:
Provides clear console logs for debugging.
Displays subscription status updates directly in the popup.
background.js:

Integrated with popup.js to ensure smooth communication between the popup and service worker.
Improved push subscription flow by ensuring userVisibleOnly: true.
This update ensures a fully functional web push example with a proper UI, making it easier for users to subscribe/unsubscribe without requiring manual DevTools interactions.

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