aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/sender.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/sender.js')
-rw-r--r--vnext/server/sender.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/vnext/server/sender.js b/vnext/server/sender.js
index be907059..d5272bfb 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
}
+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',
+ click_action: 'com.juick.NEW_EVENT_ACTION',
+ icon: 'ic_notification',
+ color: '#3c77aa'
+ }
}
return template
}