Skip to content

Commit

Permalink
add passthrough for settings to enable data notification
Browse files Browse the repository at this point in the history
  • Loading branch information
wcalebgray committed Jun 20, 2024
1 parent 4b3c3f3 commit d4ac65f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/sendFCM.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const sendFCM = (regIds, data, settings) => {

const promises = [];

const fcmMessage = FcmMessage.build(data, regIds);
const fcmMessage = FcmMessage.build(data, settings.fcm);

let chunk = 0;

Expand Down
10 changes: 5 additions & 5 deletions src/utils/fcmMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ class FcmMessage {
}, {});
}

static buildAndroidMessage(params) {
const message = buildGcmMessage(params, {});
static buildAndroidMessage(params, options) {
const message = buildGcmMessage(params, options);

const androidMessage = message.toJson();

androidMessage.ttl = androidMessage.time_to_live * 1000;
androidMessage.data = this.normalizeDataParams(androidMessage.data);

delete androidMessage.content_available;
delete androidMessage.mutable_content;
delete androidMessage.delay_while_idle;
delete androidMessage.time_to_live;
delete androidMessage.dry_run;
delete androidMessage.data;

return androidMessage;
}
Expand All @@ -60,7 +60,7 @@ class FcmMessage {
return { headers: this.normalizeDataParams(headers), payload };
}

static build(params) {
static build(params, options) {
const { providersExclude = [], ...fcmMessageParams } = params;

const data = this.normalizeDataParams(fcmMessageParams.custom);
Expand All @@ -72,7 +72,7 @@ class FcmMessage {
}

if (!providersExclude.includes('android')) {
createParams.android = this.buildAndroidMessage(fcmMessageParams);
createParams.android = this.buildAndroidMessage(fcmMessageParams, options);

Check failure on line 75 in src/utils/fcmMessage.js

View workflow job for this annotation

GitHub Actions / test (14.x)

Replace `fcmMessageParams,·options` with `⏎········fcmMessageParams,⏎········options⏎······`

Check failure on line 75 in src/utils/fcmMessage.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Replace `fcmMessageParams,·options` with `⏎········fcmMessageParams,⏎········options⏎······`

Check failure on line 75 in src/utils/fcmMessage.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Replace `fcmMessageParams,·options` with `⏎········fcmMessageParams,⏎········options⏎······`

Check failure on line 75 in src/utils/fcmMessage.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `fcmMessageParams,·options` with `⏎········fcmMessageParams,⏎········options⏎······`
}

return new this(createParams);
Expand Down

0 comments on commit d4ac65f

Please sign in to comment.