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

feat: mobile push notifications #13006

Draft
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

Prithpal-Sooriya
Copy link
Contributor

Description

Adds support for mobile push notifications. Reorganised some services, and utilising the shared controller over custom logic.

Draft TODO:

  • Validate push notification click listener
  • Double check segment events
  • Go through entire UI flow to spot discrepancies

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

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.

TODO - must update segment-schema repo for this to be available in MXP
- remove coupling notification services with these managers/services
- remove notification service types from the transaction notification types
- tidy FCMService to match extension/CORE
- remove coupling from the notifee NotificationService file.
update types, and add correct push interface
This is now done in the controller. The push click handler may need to be done through UI though.
remove old code
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 Jan 15, 2025
Copy link

socket-security bot commented Jan 15, 2025

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected] None 0 0 B

View full report↗︎

Comment on lines 40 to 41
// TODO - Find out how to handle clicking notifications in the background.
// The only approach notifee + navigate offers is through React.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notifee + ReactNavigation offers react bindings for clicking notifications, but I don't see non-react bindings.

2 Approaches:

  1. We use a react approach and invoke a hook at root.
  2. There are "Deep Links" that we can add to IOS and Android settings to prompt what page/view the application should open up into.
  3. Fallback - we can just open the home page worst case.

contains some fixes we found that needed to be added to the package
ensures that notifications are enabled before we register for push notifications
…ot enabled

I don't really like this, I think we might need to actually decouple notifications from push notifications?
remove some actions that are unused, and add some comments to come back to
remove unused methods, and add tests
notifee can only store string objects
we forgot to update some allowed actions and events
this prevents the app from being fully rendered if in headless mode
I dont think this is necessary anymore
we don't need to call it from the index.js file
this matches notifee notifications to give some similarities for foreground/background/killed notifications
these changes are not needed as IOS does not run in expo
@Prithpal-Sooriya Prithpal-Sooriya force-pushed the feat/add-controller-push-notifications branch from 609d5ce to 84ec599 Compare January 29, 2025 15:39
this has issues for both android and ios, so instead our server will send a notification payload
Comment on lines +885 to +890
PUSH_NOTIFICATIONS_RECEIVED: generateOpt(
EVENT_NAME.PUSH_NOTIFICATIONS_RECEIVED,
),
PUSH_NOTIFICATIONS_CLICKED: generateOpt(
EVENT_NAME.PUSH_NOTIFICATIONS_CLICKED,
),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm removing these events for mobile, they are not feasible.

Context:
Mobile background and killed push notifications currently will not run headless JS for us to then intercept and send events for receive and clicks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants