File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,27 +204,31 @@ function FlamebaseDatabase(database, path) {
204204
205205 this . sendPushMessage = function ( send ) {
206206 this . queue . pushJob ( function ( ) {
207- var message = {
208- registration_ids : send . tokens , // required fill with device token or topics
209- data : send . data ,
210- notification : send . notification
211- } ;
212-
213- if ( object . debugVal ) {
214- logger . debug ( "Sending to: " + JSON . stringifyAligned ( message . registration_ids ) ) ;
215- }
207+ return new Promise ( function ( resolve , reject ) {
208+ var message = {
209+ registration_ids : send . tokens , // required fill with device token or topics
210+ data : send . data ,
211+ notification : send . notification
212+ } ;
213+
214+
215+ if ( object . debugVal ) {
216+ logger . debug ( "Sending to: " + JSON . stringifyAligned ( message . registration_ids ) ) ;
217+ }
216218
217- object . fcm . send ( message )
218- . then ( function ( response ) {
219- if ( object . debugVal ) {
220- logger . debug ( "Successfully sent with response: " + JSON . stringifyAligned ( JSON . parse ( response ) ) ) ;
219+ object . fcm . send ( message )
220+ . then ( function ( response ) {
221+ if ( object . debugVal ) {
222+ logger . debug ( "Successfully sent with response: " + JSON . stringifyAligned ( JSON . parse ( response ) ) ) ;
223+ }
224+ resolve ( ) ;
225+ } )
226+ . catch ( function ( err ) {
227+ logger . error ( "error: " + JSON . stringifyAligned ( err ) ) ;
221228 resolve ( ) ;
222- }
223- } )
224- . catch ( function ( err ) {
225- logger . error ( "error: " + JSON . stringifyAligned ( err ) ) ;
226- resolve ( ) ;
227- } )
229+ } )
230+
231+ } ) ;
228232 } ) ;
229233 } ;
230234
You can’t perform that action at this time.
0 commit comments