Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions etc/firebase-admin.messaging.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface AndroidNotification {
localOnly?: boolean;
notificationCount?: number;
priority?: ('min' | 'low' | 'default' | 'high' | 'max');
proxy?: ('allow' | 'deny' | 'if_priority_lowered');
sound?: string;
sticky?: boolean;
tag?: string;
Expand Down
7 changes: 7 additions & 0 deletions src/messaging/messaging-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,13 @@ export interface AndroidNotification {
* displayed on the long-press menu each time a new notification arrives.
*/
notificationCount?: number;

/**
* Sets if this notification should attempt to be proxied. Must be either
* `allow`, `deny` or `if_priority_lowered`. If unspecified, defaults to
* `if_priority_lowered`.
*/
proxy?: ('allow' | 'deny' | 'if_priority_lowered');
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/messaging/messaging-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ function validateAndroidNotification(notification: AndroidNotification | undefin
(notification as any).priority = priority;
}

if (typeof notification.proxy !== 'undefined') {
const proxy = notification.proxy.toUpperCase();
(notification as any).proxy = proxy;
}

if (typeof notification.visibility !== 'undefined') {
const visibility = notification.visibility.toUpperCase();
(notification as any).visibility = visibility;
Expand Down
1 change: 1 addition & 0 deletions test/integration/messaging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const message: Message = {
},
defaultLightSettings: false,
notificationCount: 1,
proxy: 'if_priority_lowered',
},
},
apns: {
Expand Down
4 changes: 4 additions & 0 deletions test/unit/messaging/messaging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,7 @@ describe('Messaging', () => {
ticker: 'test.ticker',
sticky: true,
visibility: 'private',
proxy: 'deny',
},
},
},
Expand All @@ -1840,6 +1841,7 @@ describe('Messaging', () => {
ticker: 'test.ticker',
sticky: true,
visibility: 'PRIVATE',
proxy: 'DENY'
},
},
},
Expand Down Expand Up @@ -1970,6 +1972,7 @@ describe('Messaging', () => {
},
defaultLightSettings: false,
notificationCount: 1,
proxy: 'if_priority_lowered',
},
fcmOptions: {
analyticsLabel: 'test.analytics',
Expand Down Expand Up @@ -2022,6 +2025,7 @@ describe('Messaging', () => {
},
default_light_settings: false,
notification_count: 1,
proxy: 'IF_PRIORITY_LOWERED',
},
fcmOptions: {
analyticsLabel: 'test.analytics',
Expand Down