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

fix: failing push notifications #25340

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Jun 14, 2024

Description

This fixes push notifications so that they are not silent push notifications.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Create a wallet notification
  2. See push notification received

Screenshots/Recordings

Before

image

After

Screenshot 2024-06-14 at 21 04 55

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@Prithpal-Sooriya Prithpal-Sooriya requested a review from a team as a code owner June 14, 2024 19:51
Copy link
Contributor

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.

@metamaskbot metamaskbot added the team-notifications Notifications team label Jun 14, 2024
@Prithpal-Sooriya Prithpal-Sooriya added team-notifications Notifications team and removed team-notifications Notifications team labels Jun 14, 2024
Comment on lines +208 to +211
const notificationData = {
...data,
type: data?.type ?? data?.data?.kind,
} as NotificationUnion;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

God more bad types we need to resolve.

A raw notification DOES NOT have a type property, this is something we inject before processing. This adds back this type property if it is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of our types are sound. These are edge-cases and artefacts from the portfolio integration.

@Prithpal-Sooriya Prithpal-Sooriya changed the title fix: fix failing push notifications fix: failing push notifications Jun 14, 2024
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 27.27273% with 8 lines in your changes missing coverage. Please review.

Project coverage is 65.37%. Comparing base (2aaf565) to head (6db5bfc).
Report is 6 commits behind head on develop.

Files Patch % Lines
...s/push-platform-notifications/services/services.ts 0.00% 5 Missing ⚠️
...form-notifications/utils/get-notification-image.ts 50.00% 2 Missing ⚠️
...rm-notifications/utils/get-notification-message.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25340      +/-   ##
===========================================
- Coverage    65.37%   65.37%   -0.00%     
===========================================
  Files         1377     1378       +1     
  Lines        54623    54630       +7     
  Branches     14320    14321       +1     
===========================================
+ Hits         35709    35712       +3     
- Misses       18914    18918       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

import browser from 'webextension-polyfill';

export async function getNotificationImage() {
const iconUrl = await browser.runtime.getURL('../../images/icon-64.png');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This correctly gets the browser image (used on other notifications - e.g. transaction notifications)

Copy link
Contributor

@matteoscurati matteoscurati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

Copy link

@chakra-guy chakra-guy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@metamaskbot
Copy link
Collaborator

Builds ready [6db5bfc]
Page Load Metrics (142 ± 196 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6612782136
domContentLoaded9221131
load401924142409196
domInteractive9221131
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 945 Bytes (0.03%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@Prithpal-Sooriya Prithpal-Sooriya merged commit 68d35f0 into develop Jun 18, 2024
74 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the fix-push-notification-data-shape branch June 18, 2024 10:31
@github-actions github-actions bot locked and limited conversation to collaborators Jun 18, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants