-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: notifications UI update to use FCM services (#12214)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR implements support to FCM (Firebase Cloud Messaging) on both iOS and Android on mobile. ## **Related issues** Fixes: [NOTIFY-1219](https://consensyssoftware.atlassian.net/browse/NOTIFY-1219?atlOrigin=eyJpIjoiZDJiMzczYTc5ZGI5NGU3OWE4YTNjZDAyN2M0ZjIzYWYiLCJwIjoiaiJ9) ## **Manual testing steps** 1. Go to Settings --> Notifications --> Enable 2. Open a separated device (or extension) repeat the process above 3. Do any transaction between the two clients/devices 4. Leave the transaction recipient open to see it in Foreground 5. Put app in background to see a native notification ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/3bb403cb-c1b1-4664-bad9-95fd185d3ecc <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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. [NOTIFY-1219]: https://consensyssoftware.atlassian.net/browse/NOTIFY-1219?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
1 parent
9b5a1e5
commit 0b5af0d
Showing
12 changed files
with
2,124 additions
and
197 deletions.
There are no files selected for viewing
1,741 changes: 1,741 additions & 0 deletions
1,741
app/components/UI/Notification/BaseNotification/__snapshots__/index.test.jsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/components/UI/Notification/BaseNotification/index.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import BaseNotification, { getDescription } from './'; | ||
import renderWithProvider from '../../../../util/test/renderWithProvider'; | ||
import { strings } from '../../../../../locales/i18n'; | ||
|
||
const defaultProps = [ | ||
{ status: 'pending', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'pending_withdrawal', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'pending_deposit', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'success_deposit', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'success_withdrawal', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'received', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'received_payment', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'eth_received', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'cancelled', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
{ status: 'error', data: { description: 'Testing description', title: 'Testing Title' } }, | ||
]; | ||
|
||
describe('BaseNotification', () => { | ||
it('gets icon correctly for each status', () => { | ||
defaultProps.forEach(({ status, data}) => { | ||
const { toJSON } = renderWithProvider(<BaseNotification status={status} data={data} />); | ||
expect(toJSON()).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('gets titles correctly for each status', () => { | ||
defaultProps.forEach(({ status }) => { | ||
const { getByText } = renderWithProvider(<BaseNotification status={status} data={{}} />); | ||
expect(getByText(strings(`notifications.${status}_title`))).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
it('gets descriptions correctly for if they are provided', () => { | ||
defaultProps.forEach(({ status, data }) => { | ||
const { getByText } = renderWithProvider(<BaseNotification status={status} data={data} />); | ||
expect(getByText(data.description)).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
it('constructs the correct description using getDescription when no description is provided', () => { | ||
defaultProps.forEach(({ status }) => { | ||
const { getByText } = renderWithProvider(<BaseNotification status={status} data={{}} />); | ||
expect(getByText(getDescription(status, {}))).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.