@@ -22,6 +22,7 @@ export class FcmProvider implements Provider<FcmNotification> {
2222 fcmService : admin . app . App ;
2323
2424 initialValidations ( message : FcmMessage ) {
25+ const maxReceivers = 500 ;
2526 if (
2627 message . receiver . to . length === 0 &&
2728 ! message . options . topic &&
@@ -31,8 +32,7 @@ export class FcmProvider implements Provider<FcmNotification> {
3132 'Message receiver, topic or condition not found in request !' ,
3233 ) ;
3334 }
34-
35- if ( message . receiver . to . length > 500 ) {
35+ if ( message . receiver . to . length > maxReceivers ) {
3636 throw new HttpErrors . BadRequest (
3737 'Message receiver count cannot exceed 500 !' ,
3838 ) ;
@@ -69,11 +69,12 @@ export class FcmProvider implements Provider<FcmNotification> {
6969 ...generalMessageObj ,
7070 data : { ...message . options . data } ,
7171 } ;
72- promises . push (
73- this . fcmService
74- . messaging ( )
75- . sendMulticast ( msgToTransfer , ( message . options . dryRun = false ) ) ,
76- ) ;
72+
73+ const dryRun = message . options . dryRun ?? false ;
74+ const sendPromise = this . fcmService
75+ . messaging ( )
76+ . sendMulticast ( msgToTransfer , dryRun ) ;
77+ promises . push ( sendPromise ) ;
7778 }
7879 return promises ;
7980 }
@@ -94,11 +95,11 @@ export class FcmProvider implements Provider<FcmNotification> {
9495 data : { ...message . options . data } ,
9596 } ;
9697
97- promises . push (
98- this . fcmService
99- . messaging ( )
100- . send ( msgToTransfer , ( message . options . dryRun = false ) ) ,
101- ) ;
98+ const dryRun = message . options . dryRun ?? false ;
99+ const sendPromise = this . fcmService
100+ . messaging ( )
101+ . send ( msgToTransfer , dryRun ) ;
102+ promises . push ( sendPromise ) ;
102103 } ) ;
103104 }
104105
@@ -123,11 +124,11 @@ export class FcmProvider implements Provider<FcmNotification> {
123124 ...generalMessageObj ,
124125 data : { ...message . options . data } ,
125126 } ;
126- promises . push (
127- this . fcmService
128- . messaging ( )
129- . send ( msgToTransfer , ( message . options . dryRun = false ) ) ,
130- ) ;
127+ const dryRun = message . options . dryRun ?? false ;
128+ const sendPromise = this . fcmService
129+ . messaging ( )
130+ . send ( msgToTransfer , dryRun ) ;
131+ promises . push ( sendPromise ) ;
131132 } ) ;
132133 }
133134
0 commit comments