Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Small fix for setting data in FCM message. JSON node with string values where being put with two quotes

Michael Rademakerd881403cce22
diff --git a/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.java b/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.java
index 45e299eb9..d8f4fe5c5 100644
--- a/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.java
+++ b/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.java
@@ -20,7 +20,7 @@
package org.openremote.manager.notification;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
@@ -32,7 +32,6 @@ import org.openremote.manager.asset.AssetStorageService;
import org.openremote.manager.gateway.GatewayService;
import org.openremote.model.Container;
import org.openremote.model.ContainerService;
-import org.openremote.model.asset.Asset;
import org.openremote.model.asset.impl.ConsoleAsset;
import org.openremote.model.console.ConsoleProvider;
import org.openremote.model.notification.AbstractNotificationMessage;
@@ -393,12 +392,7 @@ public class PushNotificationHandler extends RouteBuilder implements Notificatio
}
if (pushMessage.getData() != null) {
- Iterable<Map.Entry<String, JsonNode>> iterable = () -> pushMessage.getData().fields();
- StreamSupport.stream(iterable.spliterator(), false).forEach(stringValuePair -> {
- if (stringValuePair.getValue() != null) {
- builder.putData(stringValuePair.getKey(), stringValuePair.getValue().toString());
- }
- });
+ builder.putAllData(Values.JSON.convertValue(pushMessage.getData(), new TypeReference<Map<String, String>>(){}));
if (dataOnly) {
apsBuilder.setContentAvailable(true);