Skip to content

Commit f33ccd1

Browse files
feat(fcm): Add directBootOk field to AndroidConfig (#2745)
1 parent 8d49b7e commit f33ccd1

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

etc/firebase-admin.messaging.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface AndroidConfig {
1414
data?: {
1515
[key: string]: string;
1616
};
17+
directBootOk?: boolean;
1718
fcmOptions?: AndroidFcmOptions;
1819
notification?: AndroidNotification;
1920
priority?: ('high' | 'normal');

src/messaging/messaging-api.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,12 @@ export interface AndroidConfig {
418418
* Options for features provided by the FCM SDK for Android.
419419
*/
420420
fcmOptions?: AndroidFcmOptions;
421+
422+
/**
423+
* A boolean indicating whether messages will be allowed to be delivered to
424+
* the app while the device is in direct boot mode.
425+
*/
426+
directBootOk?: boolean;
421427
}
422428

423429
/**

src/messaging/messaging-internal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ function validateAndroidConfig(config: AndroidConfig | undefined): void {
398398
const propertyMappings = {
399399
collapseKey: 'collapse_key',
400400
restrictedPackageName: 'restricted_package_name',
401+
directBootOk: 'direct_boot_ok',
401402
};
402403
renameProperties(config, propertyMappings);
403404
}

test/integration/messaging.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const message: Message = {
4545
},
4646
android: {
4747
restrictedPackageName: 'com.google.firebase.testing',
48+
directBootOk: true,
4849
notification: {
4950
title: 'test.title',
5051
ticker: 'test.ticker',

test/unit/messaging/messaging.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,6 +3961,7 @@ describe('Messaging', () => {
39613961
android: {
39623962
collapseKey: 'test.key',
39633963
restrictedPackageName: 'test.package',
3964+
directBootOk: true,
39643965
notification: {
39653966
clickAction: 'test.click.action',
39663967
titleLocKey: 'title.loc.key',
@@ -3988,6 +3989,7 @@ describe('Messaging', () => {
39883989
android: {
39893990
collapse_key: 'test.key',
39903991
restricted_package_name: 'test.package',
3992+
direct_boot_ok: true,
39913993
notification: {
39923994
click_action: 'test.click.action',
39933995
title_loc_key: 'title.loc.key',
@@ -4043,6 +4045,7 @@ describe('Messaging', () => {
40434045
priority: 'high',
40444046
collapseKey: 'test.key',
40454047
restrictedPackageName: 'test.package',
4048+
directBootOk: true,
40464049
ttl: 5,
40474050
data: {
40484051
k1: 'v1',
@@ -4089,6 +4092,7 @@ describe('Messaging', () => {
40894092
priority: 'high',
40904093
collapse_key: 'test.key',
40914094
restricted_package_name: 'test.package',
4095+
direct_boot_ok: true,
40924096
ttl: '0.005000000s', // 5 ms = 5,000,000 ns
40934097
data: {
40944098
k1: 'v1',

0 commit comments

Comments
 (0)