Добавлена поддержка вывода имени пользователя в уведомлениях
This commit is contained in:
@@ -110,15 +110,29 @@ public class FirebaseDispatcher {
|
||||
* @param title заголовок уведомления
|
||||
* @param messageText текст уведомления
|
||||
*/
|
||||
public void sendPushNotification(List<String> publicKeys, String title, String messageText) {
|
||||
public void sendPushNotification(List<String> publicKeys, String title, String messageText, String senderPublicKey) {
|
||||
executor.submit(() -> {
|
||||
for (String publicKey : publicKeys) {
|
||||
sendPushNotificationSync(publicKey, title, messageText);
|
||||
sendPushNotificationSync(publicKey, title, messageText, senderPublicKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendPushNotificationSync(String publicKey, String title, String messageText) {
|
||||
/**
|
||||
* Отправляет push-уведомление нескольким пользователям (асинхронно)
|
||||
* @param publicKeys список публичных ключей пользователей
|
||||
* @param title заголовок уведомления
|
||||
* @param messageText текст уведомления
|
||||
*/
|
||||
public void sendPushNotification(List<String> publicKeys, String title, String messageText) {
|
||||
executor.submit(() -> {
|
||||
for (String publicKey : publicKeys) {
|
||||
sendPushNotificationSync(publicKey, title, messageText, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendPushNotificationSync(String publicKey, String title, String messageText, String senderPublicKey) {
|
||||
try {
|
||||
List<String> tokens = userService.getNotificationsTokens(publicKey);
|
||||
if (tokens == null || tokens.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user