Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions FirebasePushNotifications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ exports.pushToChannels = functions.https.onCall((data, context) => {

let type = data.type;
let senderId = String(data.senderId);
let senderName = data.senderName ? data.senderName : 'You received a message';
let threadId = String(data.threadId);

let userIds = data.userIds;
Expand All @@ -187,8 +188,7 @@ exports.pushToChannels = functions.https.onCall((data, context) => {
var status = {};
for(let uid in userIds) {
if(userIds.hasOwnProperty(uid)) {
let userName = userIds[uid];
let message = buildMessage(userName, body, action, sound, type, senderId, threadId, uid);
let message = buildMessage(senderName, body, action, sound, type, senderId, threadId, uid);
status[uid] = message;
admin.messaging().send(message);
}
Expand All @@ -203,7 +203,6 @@ exports.pushListener = functions.database.ref('{rootPath}/threads/{threadId}/mes

let messageValue = messageSnapshot.val();
let senderId = messageValue["user-firebase-id"];

let pushRef = admin.database().ref(context.params.rootPath).child("push-test");

let threadId = context.params.threadId;
Expand Down Expand Up @@ -232,4 +231,4 @@ exports.pushListener = functions.database.ref('{rootPath}/threads/{threadId}/mes
});
});

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void pushForMessage (Message message) {
data.put("userIds", users);
data.put("body", body);
data.put("type", message.getType());
data.put("senderName", message.getSender().getName());
data.put("senderId", message.getSender().getEntityID());
data.put("threadId", message.getThread().getEntityID());
data.put("action", ChatSDK.config().pushNotificationAction != null ? ChatSDK.config().pushNotificationAction : QuickReplyNotificationCategory);
Expand Down