Image support
This commit is contained in:
parent
68a7080a5b
commit
9649610e91
@ -1,7 +1,9 @@
|
||||
module.exports = {
|
||||
createPayload: function createPayload(req) {
|
||||
var payload = {
|
||||
android: {},
|
||||
android: {
|
||||
collapseKey: "haclient"
|
||||
},
|
||||
notification: {},
|
||||
data: {
|
||||
click_action: "FLUTTER_NOTIFICATION_CLICK"
|
||||
@ -13,24 +15,16 @@ module.exports = {
|
||||
// Allow setting of ttl
|
||||
// https://firebase.google.com/docs/reference/admin/node/admin.messaging.AndroidConfig.html#optional-ttl
|
||||
if (req.body.data.ttl) {
|
||||
payload.android.ttl = req.body.data.ttl
|
||||
payload.android.ttl = req.body.data.ttl;
|
||||
}
|
||||
|
||||
// https://firebase.google.com/docs/reference/admin/node/admin.messaging.AndroidConfig.html#optional-priority
|
||||
if (req.body.data.priority) {
|
||||
payload.android.priority = req.body.data.priority
|
||||
payload.android.priority = req.body.data.priority;
|
||||
}
|
||||
|
||||
// https://firebase.google.com/docs/reference/admin/node/admin.messaging.AndroidNotification.html
|
||||
for (const key of [
|
||||
'icon', 'color', 'sound', 'tag', 'clickAction',
|
||||
'bodyLocKey', 'bodyLocArgs', 'titleLocKey', 'titleLocArgs', 'channelId',
|
||||
'ticker', 'sticky', 'eventTime', 'localOnly', 'notificationPriority',
|
||||
'defaultSound', 'defaultVibrateTimings', 'defaultLightSettings', 'vibrateTimings',
|
||||
'visibility', 'notificationCount', 'lightSettings', 'image']) {
|
||||
if (req.body.data[key]) {
|
||||
payload.data[key] = String(req.body.data[key])
|
||||
}
|
||||
if (req.body.data.image) {
|
||||
payload.notification.image = req.body.data.image;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user