fix: Enable wallet push notifications on restart#24752
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
app/scripts/controllers/metamask-notifications/metamask-notifications.ts
Show resolved
Hide resolved
… NOTIFY-668-extension-qa-handle-reinitialising-of-push-notifications
Builds ready [46bc896]
Page Load Metrics (629 ± 469 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
app/scripts/controllers/push-platform-notifications/services/services.ts
Show resolved
Hide resolved
| ): Promise<() => void> { | ||
| // Firebase | ||
| const messaging = await getFirebaseMessaging(); | ||
| const unsubscribe = onBackgroundMessage( |
There was a problem hiding this comment.
In the file above, there is a rename firebaseUnsubscribe -> pushListenerUnsubscribe. Here there is a rename unsubscribe -> unsubscribeFirebase. What is the difference between these two contexts that lead to the different names?
There was a problem hiding this comment.
I agree - I will rename this to pushListenerUnsubscribe.
In this context, when listening to push notifications we need to listen to 2 things:
- When a push notification is received (and how we need to handle it to show to users).
- When a push notification is clicked.
Since we have 2 listeners, we need to make sure we unsubscribe from both if they need to be torn down.
app/scripts/controllers/metamask-notifications/metamask-notifications.ts
Show resolved
Hide resolved
danjm
left a comment
There was a problem hiding this comment.
Sort of indpendent of this PR, but a question came to me as I was reviewing: can users opt out of push notifications while still enabling the other notification functionality? Should they be able to?
… NOTIFY-668-extension-qa-handle-reinitialising-of-push-notifications
This was discussed somewhere in slack with our PM (see thread) - currently allowing notifications will also allow push notifications. I think we can in the future add more fine grain control (e.g. disable push notifications without disabling notifications). |
Builds ready [35cbb3b]
Page Load Metrics (667 ± 492 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…sing-of-push-notifications
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #24752 +/- ##
===========================================
- Coverage 65.74% 65.73% -0.00%
===========================================
Files 1366 1366
Lines 54227 54236 +9
Branches 14106 14108 +2
===========================================
+ Hits 35648 35652 +4
- Misses 18579 18584 +5 ☔ View full report in Codecov by Sentry. |
Builds ready [12e2fb4]
Page Load Metrics (335 ± 371 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This ensures that users who have enabled wallet notifications will receive push notifications when the application is starting up.
Related issues
Fixes: Bug when a user stops receiving push notifications if the service worker dies (e.g. browser is closed)
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist