aboutsummaryrefslogtreecommitdiff
path: root/vnext/server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-09-02 10:34:30 +0300
committerGravatar Vitaly Takmazov2024-09-02 10:34:30 +0300
commit7b8a213808a579a5d044bfc82fe2e723eb10f93e (patch)
treef3a3bc511a0e0007751daf4a0be924476630bb88 /vnext/server
parent5a30741ef70d8a11e2f1976229957983f9c08fad (diff)
sender: `firebase-admin` compatibility
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
}