-
Notifications
You must be signed in to change notification settings - Fork 440
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
feat: add push notifications #2369
Conversation
Branch preview✅ Deploy successful! |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
This reverts commit 2654d76.
ESLint Summary View Full Report
Report generated by eslint-plus-action |
src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx
Outdated
Show resolved
Hide resolved
src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx
Outdated
Show resolved
Hide resolved
}) | ||
}, [dismissedBannerPerChain, safe.chainId, setDismissedBannerPerChain]) | ||
|
||
// Click outside to dismiss banner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would be in favour of having an explicit "x" Button since pressing outside the banner can happen by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. We're using the same style as the batch banner atm. @liliiaorlenko, what are your thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/components/settings/PushNotifications/hooks/useNotificationPreferences.ts
Outdated
Show resolved
Hide resolved
src/components/settings/PushNotifications/PushNotificationsBanner/styles.module.css
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great and thanks for implementing the changes 👍
Will discuss the notification dismissal tomorrow but it is non-blocking imo. LGTM 🚀
* feat: add push notification tracking * fix: address review comments * fix: error message
ESLint Summary View Full Report
Report generated by eslint-plus-action |
Looks good. A few notes for future iterations that we might want to revisit: |
What it solves
Implements push notifications for transaction events.
How this PR fixes it
New "Notifications" settings sections have been added per-Safes/all added Safes, as well as a feature banner and associated tracking has been added. Subscribed categories dispatch push notifccations when the Safe UI is either out of focus or closed (but the browser is open).
The per-Safe "Notifications" section allows for notification subscription to all notification types, requiring a confirmatory signature as "Confirmation requests" are included. The global section is similar, subscribing to user selected (added) Safes with n number of signatures per selected chain.
Notifications are grouped into three categories: "Incoming transactions", "Outgoing transactions" and "Confirmation requests" according to our Transaction Service webhooks.
INCOMING_ETHER
INCOMING_TOKEN
MODULE_TRANSACTION
EXECUTED_MULTISIG_TRANSACTION
CONFIRMATION_REQUEST
A banner is shown once per chain that has added Safes, subscribing to notifications for all added Safes on that chain.
User interaction within the UI is tracked directly.
Due to technical limitations, direct notification interaction events (opening/closing) are cached and tracked when the UI is again opened.Moved to a separate PR #2500.How to test it
Tacking of notification iteraction should happen when the UI is reopened.(Moved to a separate PR feat: add push notification tracking #2500).If you want to reset your current registration, you need to:
sw.js
service workerfirebase-*
/notification-*
IndexedDB databasesIf you want to show the subscription banner again, you need to delete the
SAFE_v2__dismissPushNotifications
localStorage
key.Screenshots
Please note that these are slightly dated but just demonstrate the notification. See the designs.
Checklist