Skip to content

feat(fcm): Add directBootOk field to AndroidConfig #2745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2024
Merged
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
1 change: 1 addition & 0 deletions etc/firebase-admin.messaging.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface AndroidConfig {
data?: {
[key: string]: string;
};
directBootOk?: boolean;
fcmOptions?: AndroidFcmOptions;
notification?: AndroidNotification;
priority?: ('high' | 'normal');
Expand Down
6 changes: 6 additions & 0 deletions src/messaging/messaging-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,12 @@ export interface AndroidConfig {
* Options for features provided by the FCM SDK for Android.
*/
fcmOptions?: AndroidFcmOptions;

/**
* A boolean indicating whether messages will be allowed to be delivered to
* the app while the device is in direct boot mode.
*/
directBootOk?: boolean;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/messaging/messaging-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ function validateAndroidConfig(config: AndroidConfig | undefined): void {
const propertyMappings = {
collapseKey: 'collapse_key',
restrictedPackageName: 'restricted_package_name',
directBootOk: 'direct_boot_ok',
};
renameProperties(config, propertyMappings);
}
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 @@ -45,6 +45,7 @@ const message: Message = {
},
android: {
restrictedPackageName: 'com.google.firebase.testing',
directBootOk: true,
notification: {
title: 'test.title',
ticker: 'test.ticker',
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 @@ -3961,6 +3961,7 @@ describe('Messaging', () => {
android: {
collapseKey: 'test.key',
restrictedPackageName: 'test.package',
directBootOk: true,
notification: {
clickAction: 'test.click.action',
titleLocKey: 'title.loc.key',
Expand Down Expand Up @@ -3988,6 +3989,7 @@ describe('Messaging', () => {
android: {
collapse_key: 'test.key',
restricted_package_name: 'test.package',
direct_boot_ok: true,
notification: {
click_action: 'test.click.action',
title_loc_key: 'title.loc.key',
Expand Down Expand Up @@ -4043,6 +4045,7 @@ describe('Messaging', () => {
priority: 'high',
collapseKey: 'test.key',
restrictedPackageName: 'test.package',
directBootOk: true,
ttl: 5,
data: {
k1: 'v1',
Expand Down Expand Up @@ -4089,6 +4092,7 @@ describe('Messaging', () => {
priority: 'high',
collapse_key: 'test.key',
restricted_package_name: 'test.package',
direct_boot_ok: true,
ttl: '0.005000000s', // 5 ms = 5,000,000 ns
data: {
k1: 'v1',
Expand Down