aboutsummaryrefslogtreecommitdiff
path: root/vnext/server
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server')
-rw-r--r--vnext/server/sender.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/vnext/server/sender.js b/vnext/server/sender.js
index be907059..fa8c4853 100644
--- a/vnext/server/sender.js
+++ b/vnext/server/sender.js
@@ -19,20 +19,22 @@ const apnConfig = (production = true) => {
}
return apn
}
-const gcmConfig = {
- ...cfg.gcm,
- id: cfg.gcm?.id || process.env.JUICK_GCM_ID
+const fcmConfig = {
+ ...cfg.fcm,
+ serviceAccountKey: process.env.JUICK_FCM_SERVICE_ACCOUNT_FILE
}
+console.log(`fcm config: ${JSON.stringify(fcmConfig)}`)
+
const push = new PushNotifications({
...config,
apn: apnConfig(true),
- gcm: gcmConfig,
+ fcm: fcmConfig,
})
const sandbox = new PushNotifications({
...config,
apn: apnConfig(false),
- gcm: gcmConfig
+ fcm: fcmConfig
})
/** @type {string} */
@@ -139,14 +141,18 @@ export function buildNotification(user, msg) {
template.text2 = body
template.title = title
template.body = body
- template.badge = user.unreadCount || 0
+ //template.badge = user.unreadCount || 0
template.mutableContent = 1
template.color = '#3c77aa'
template.icon = 'ic_notification'
template.clickAction = 'com.juick.NEW_EVENT_ACTION'
const tag = msg.mid == 0 ? msg.user.uname : msg.mid
template.tag = `${tag}`
- template.android_channel_id = 'default'
+ template.fcm_notification = {
+ title: title,
+ body: body,
+ channel_id: 'default'
+ }
}
return template
}