Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions etc/firebase-admin.messaging.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Agent } from 'http';

// @public
export interface AndroidConfig {
bandwidthConstrainedOk?: boolean;
collapseKey?: string;
data?: {
[key: string]: string;
Expand All @@ -17,6 +18,7 @@ export interface AndroidConfig {
notification?: AndroidNotification;
priority?: ('high' | 'normal');
restrictedPackageName?: string;
restrictedSatelliteOk?: boolean;
ttl?: number;
}

Expand Down
12 changes: 12 additions & 0 deletions src/messaging/messaging-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,18 @@ export interface AndroidConfig {
* the app while the device is in direct boot mode.
*/
directBootOk?: boolean;

/**
* A boolean indicating whether the message is allowed to be delivered in
* a low-bandwidth environment.
*/
bandwidthConstrainedOk?: boolean;

/**
* A boolean indicating whether the message is allowed to be delivered
* via satellite.
*/
restrictedSatelliteOk?: boolean;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/messaging/messaging-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ function validateAndroidConfig(config: AndroidConfig | undefined): void {
collapseKey: 'collapse_key',
restrictedPackageName: 'restricted_package_name',
directBootOk: 'direct_boot_ok',
bandwidthConstrainedOk: 'bandwidth_constrained_ok',
restrictedSatelliteOk: 'restricted_satellite_ok',
};
renameProperties(config, propertyMappings);
}
Expand Down
8 changes: 8 additions & 0 deletions test/unit/messaging/messaging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,8 @@ describe('Messaging', () => {
collapseKey: 'test.key',
restrictedPackageName: 'test.package',
directBootOk: true,
bandwidthConstrainedOk: true,
restrictedSatelliteOk: true,
notification: {
clickAction: 'test.click.action',
titleLocKey: 'title.loc.key',
Expand Down Expand Up @@ -1927,6 +1929,8 @@ describe('Messaging', () => {
collapse_key: 'test.key',
restricted_package_name: 'test.package',
direct_boot_ok: true,
bandwidth_constrained_ok: true,
restricted_satellite_ok: true,
notification: {
click_action: 'test.click.action',
title_loc_key: 'title.loc.key',
Expand Down Expand Up @@ -1983,6 +1987,8 @@ describe('Messaging', () => {
collapseKey: 'test.key',
restrictedPackageName: 'test.package',
directBootOk: true,
bandwidthConstrainedOk: true,
restrictedSatelliteOk: true,
ttl: 5,
data: {
k1: 'v1',
Expand Down Expand Up @@ -2031,6 +2037,8 @@ describe('Messaging', () => {
collapse_key: 'test.key',
restricted_package_name: 'test.package',
direct_boot_ok: true,
bandwidth_constrained_ok: true,
restricted_satellite_ok: true,
ttl: '0.005000000s', // 5 ms = 5,000,000 ns
data: {
k1: 'v1',
Expand Down