You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Push Notifications are not working. When a message is sent the other user does not receive a notification. This is happening because the code that sends the notification is not being called. I would appreciate if anyone can fix it.
for notificationID in notificationIDs.values {
NotificationsController.send(to: notificationID, title: message.sender, message: message.text ?? Constants.Placeholders.pictureMessagePlaceholder)
}
This code is not being executed from the send message and no notifications is being sent.
func send(message: Message) {
// Write the message to Firebase
let randomMessageId = messagesRef!.childByAutoId().key
// Since we are sending this message, we can cache it as most recent
mostRecentMessageTimestamp = message.timestamp
// If there are inactive members, attempt to rejoin them
// Otherwise you would manually have to rejoin to be added again
for (uid, username) in inactiveMembers {
databaseManager.attemptRejoinIntoConversation(convoID: convoId, uid: uid, username: username, completion: {_ in})
}
// Each message record (uniquely identified) will record sender and message text
if let text = message.text {
messagesRef?.child(randomMessageId!).setValue(
["sender" : message.sender, "text" : text, "timestamp" : message.timestamp.timeIntervalSince1970]
)
} else if let imageURL = message.imageURL {
messagesRef?.child(randomMessageId!).setValue(
["imageURL": imageURL, "sender" : message.sender, "timestamp" : message.timestamp.timeIntervalSince1970]
)
}
// Set timestamp for most recent conversation viewing
// This is required to later determine if messages loaded have already been seen
updateLastSeenTimestamp(convoID: convoId)
// TODO: Internet speed may prevent sending notification if observers do not find out about newly reactivated users in time
// Ask NotificationController to send this message as a push notification
for notificationID in notificationIDs.values {
NotificationsController.send(to: notificationID, title: message.sender, message: message.text ?? Constants.Placeholders.pictureMessagePlaceholder)
}
}
Let me know if you know how to fix this issue!
The text was updated successfully, but these errors were encountered:
Push Notifications are not working. When a message is sent the other user does not receive a notification. This is happening because the code that sends the notification is not being called. I would appreciate if anyone can fix it.
This code is not being executed from the send message and no notifications is being sent.
Let me know if you know how to fix this issue!
The text was updated successfully, but these errors were encountered: