@runnerpro/backend 1.8.14 → 1.8.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,38 +24,39 @@ const sendNotification = ({ firebaseMessaging, idCliente, title, body, screen =
|
|
|
24
24
|
}),
|
|
25
25
|
]);
|
|
26
26
|
const screenParamsString = JSON.stringify(screenParams);
|
|
27
|
+
const resultsDevices = [];
|
|
27
28
|
for (const device of devices) {
|
|
28
|
-
notificationWEB(firebaseMessaging, {
|
|
29
|
+
const resultDevice = yield notificationWEB(firebaseMessaging, {
|
|
29
30
|
title,
|
|
30
31
|
body,
|
|
31
32
|
idNotification: (idNotification || '0').toString(),
|
|
32
33
|
screen,
|
|
33
34
|
screenParams: screenParamsString,
|
|
34
35
|
}, device.subscription);
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
resultsDevices.push(resultDevice);
|
|
35
38
|
}
|
|
36
|
-
return { status: 'success', idNotification, devices };
|
|
39
|
+
return { status: 'success', idNotification, devices, resultsDevices };
|
|
37
40
|
});
|
|
38
41
|
exports.sendNotification = sendNotification;
|
|
39
42
|
function notificationWEB(firebaseMessaging, msg, token) {
|
|
40
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
44
|
if (!msg.title)
|
|
42
45
|
msg.title = '';
|
|
43
|
-
|
|
44
|
-
.send({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
});
|
|
46
|
+
try {
|
|
47
|
+
const result = yield firebaseMessaging.send({
|
|
48
|
+
token,
|
|
49
|
+
notification: {
|
|
50
|
+
title: msg.title,
|
|
51
|
+
body: msg.body,
|
|
52
|
+
},
|
|
53
|
+
data: msg,
|
|
54
|
+
});
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.log('Error al enviar notificación', error);
|
|
59
|
+
return error;
|
|
60
|
+
}
|
|
60
61
|
});
|
|
61
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY;;;;;EAmCd,CAAC;AAyBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|