Skip to content

Commit

Permalink
feat: add feature announcements channel for android (#11427)
Browse files Browse the repository at this point in the history
<!--
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 adds ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID for AndroidChannels.

## **Related issues**

Fixes: [11415](#11415)

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [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.
  • Loading branch information
Jonathansoufer authored Sep 25, 2024
1 parent f2b4392 commit 6036bcb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/util/notifications/androidChannels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('notificationChannels', () => {
it('should have the correct properties for the second channel', () => {
const secondChannel: MetaMaskAndroidChannel = notificationChannels[1];
expect(secondChannel).toEqual({
id: ChannelId.DEFAULT_NOTIFICATION_CHANNEL_ID,
id: ChannelId.ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID,
name: 'MetaMask Announcement',
lights: false,
vibration: false,
Expand Down
3 changes: 2 additions & 1 deletion app/util/notifications/androidChannels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AndroidChannel, AndroidImportance } from '@notifee/react-native';

export enum ChannelId {
DEFAULT_NOTIFICATION_CHANNEL_ID = 'DEFAULT_NOTIFICATION_CHANNEL_ID',
ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID = 'ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID',
}

export interface MetaMaskAndroidChannel extends AndroidChannel {
Expand All @@ -21,7 +22,7 @@ export const notificationChannels = [
subtitle: 'Transaction Complete',
} as MetaMaskAndroidChannel,
{
id: ChannelId.DEFAULT_NOTIFICATION_CHANNEL_ID,
id: ChannelId.ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID,
name: 'MetaMask Announcement',
lights: false,
vibration: false,
Expand Down
1 change: 1 addition & 0 deletions app/util/notifications/settings/storage/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const STORAGE_IDS = {
PUSH_NOTIFICATIONS_PROMPT_TIME: 'pushNotificationsPromptTime',
DEVICE_ID_STORAGE_KEY: 'pns:deviceId',
DEFAULT_NOTIFICATION_CHANNEL_ID: 'DEFAULT_NOTIFICATION_CHANNEL_ID',
ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID: 'ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID',
DEFAULT_PUSH_NOTIFICATION_CHANNEL_PRIORITY: 'high',
REQUEST_PERMISSION_ASKED: 'REQUEST_PERMISSION_ASKED',
REQUEST_PERMISSION_GRANTED: 'REQUEST_PERMISSION_GRANTED',
Expand Down
2 changes: 2 additions & 0 deletions app/util/notifications/settings/storage/contants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ describe('constants', () => {
PUSH_NOTIFICATIONS_PROMPT_TIME: 'pushNotificationsPromptTime',
DEVICE_ID_STORAGE_KEY: 'pns:deviceId',
DEFAULT_NOTIFICATION_CHANNEL_ID: 'DEFAULT_NOTIFICATION_CHANNEL_ID',
ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID:
'ANNOUNCEMENT_NOTIFICATION_CHANNEL_ID',
DEFAULT_PUSH_NOTIFICATION_CHANNEL_PRIORITY: 'high',
REQUEST_PERMISSION_ASKED: 'REQUEST_PERMISSION_ASKED',
REQUEST_PERMISSION_GRANTED: 'REQUEST_PERMISSION_GRANTED',
Expand Down

0 comments on commit 6036bcb

Please sign in to comment.