Skip to content

feat: add push notifications for web and android#802

Open
Linhead wants to merge 86 commits intodevfrom
feat/add-push-notifications
Open

feat: add push notifications for web and android#802
Linhead wants to merge 86 commits intodevfrom
feat/add-push-notifications

Conversation

@Linhead
Copy link
Copy Markdown
Collaborator

@Linhead Linhead commented Jun 16, 2025

feat: Implement FCM Push Notifications infrastructure for Android and Web

  • Add Firebase Cloud Messaging integration with unified PushService interface
  • Create three notification options: "No Notifications", "Background Fetch", "Push"
  • Preserve existing Background Fetch functionality for backward compatibility
  • Implement message decryption and chat navigation logic for push notifications
  • Integrate with ADAMANT Notification Service (ANS) for device token management
  • Add Android permissions and Firebase configuration
  • Support foreground/background notification handling

Implements [Feat, Enhancement] Push notifications for Web/Android, Desktop #881

Addressed review comments

@Linhead Linhead requested a review from a team as a code owner June 16, 2025 07:51
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
adamant-im Ready Ready Preview, Comment Apr 2, 2026 1:25pm

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 16, 2025

Deployed to https://msg-adamant-pr-802.surge.sh 🚀

@Linhead
Copy link
Copy Markdown
Collaborator Author

Linhead commented Jun 16, 2025

@adamantmm
Copy link
Copy Markdown
Member

@Linhead
Please add short pr description and a link to a Trello card

Comment thread src/lib/notifications/pushServiceBase.ts Outdated
Comment thread src/lib/notifications/pushServiceBase.ts
Comment thread src/lib/notifications/pushUtils.ts Outdated
Comment thread src/lib/notifications/pushUtils.ts Outdated
Comment thread src/views/Options.vue Outdated
Comment thread src/views/Options.vue Outdated
Comment thread src/views/Options.vue Outdated
Comment thread src/views/Options.vue Outdated
Comment thread src/views/Options.vue Outdated
Comment thread src/lib/constants/index.ts
Comment thread src/lib/firebase-config.ts
Comment thread src/lib/notifications/pushServiceAndroid.ts Outdated
Comment thread src/lib/notifications/pushServiceFactory.ts Outdated
Comment thread vite-pwa.config.ts
Comment thread src/App.vue Outdated
Comment thread src/App.vue Outdated
Comment thread src/lib/notifications/pushUtils.ts Outdated
Comment thread src/lib/notifications/pushUtils.ts Outdated
Comment thread src/lib/notifications/pushUtils.ts Outdated
Comment thread src/store/modules/options/index.js Outdated
Linhead and others added 29 commits February 28, 2026 13:32
Co-authored-by: Metalisk Trading Bot <119663560+metalisk@users.noreply.github.com>
Co-authored-by: Metalisk Trading Bot <119663560+metalisk@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…g FCM token fetch on Vercel

- Restrict 'script-src' to 'self' since all Firebase dependencies are now local.
- Update 'connect-src' to allow specific Google/Firebase endpoints for push notifications.
- Add 'worker-src' to support Service Worker execution.
- Remove redundant/unsafe directives to reduce the attack surface.
@Linhead
Copy link
Copy Markdown
Collaborator Author

Linhead commented Apr 2, 2026

The task is finished. All review comments and requested changes have been implemented

Test app:
Web - https://adamant-d2hzie3dy-adamant-team.vercel.app/
Android - https://github.com/Adamant-im/adamant-im/actions/runs/23915116300

Testing Summary
The implementation was tested using 4 different accounts across multiple devices and operating systems.

Results:
Windows:
Google Chrome: ✅ OK
Mozilla Firefox: ✅ OK

Android (Phone 1):
Native App: ✅ OK

Android (Phone 2):
Native App: ✅ OK
Mobile Chrome: ✅ OK
Mobile Firefox: ✅ OK

Linux (Ubuntu):
Google Chrome: ✅ OK
Mozilla Firefox: ❌ FAILED (Note: This is a platform-specific issue related to how Firefox Snap/Ubuntu handles background WebPush sockets. It is not an application-level bug.)

Important: Requirements for Push Delivery
Please note that push notifications will only be delivered if the following conditions are met:

The browser tab must be minimized or closed.

The user must be authenticated (logged in via password) with the "Stay logged in" option enabled.

Guidelines for Future Testers:
Before reporting an issue with notifications, please ensure you have performed the following "Self-Audit":

System Notifications: Check that notifications are allowed for your browser/app in the OS settings.

Browser Permissions: Ensure the site has "Allow" permission for notifications.

Focus Mode: Verify that "Do Not Disturb" or "Focus" mode is disabled on your device.

Local Environment: Disable any aggressive ad-blockers or VPNs that might interfere with Firebase/Mozilla Push Service.

Requirement for Bug Reports:
If you have verified the above and still encounter issues, please provide:

Browser Console Logs.
Service Worker Logs (from about:debugging or Chrome's Application tab).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APIs API design, endpoints, and integrations Capacitor Mobile builds and integrations via Capacitor Desktop Issues specific to desktop clients Electron Desktop application packaging and functionality Infrastructure Coin and ADAMANT nodes, Servers, VPSs, Ansible, Nginx, Docker, Zabbix, etc. JavaScript Frontend or backend code in JavaScript Messaging Messengers, communication protocols, news, mentions Mobile Issues specific to iOS or Android apps Primary feature Key feature essential for product functionality TypeScript Code and typing improvements in TypeScript UX/UI User interface and experience improvements Vue Frontend features or fixes primarily in Vue.js Web Issues specific to web client app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat, Enhancement] Push notifications for Web/Android, Desktop

8 participants