diff --git a/android/src/main/java/com/onesignal/flutter/OneSignalSerializer.java b/android/src/main/java/com/onesignal/flutter/OneSignalSerializer.java index e9a42216..24cf4cde 100644 --- a/android/src/main/java/com/onesignal/flutter/OneSignalSerializer.java +++ b/android/src/main/java/com/onesignal/flutter/OneSignalSerializer.java @@ -143,10 +143,9 @@ static HashMap convertNotificationToMap(OSNotification notificat if (notification.getCollapseId() != null) hash.put("collapseId", notification.getCollapseId()); hash.put("priority", notification.getPriority()); - if (notification.getAdditionalData() != null) - hash.put("additionalData", notification.getAdditionalData()); - - if (notification.getActionButtons() != null) { + if (notification.getAdditionalData() != null && notification.getAdditionalData().length() > 0) + hash.put("additionalData", convertJSONObjectToHashMap(notification.getAdditionalData())); + if (notification.getActionButtons() != null && !notification.getActionButtons().isEmpty()) { ArrayList buttons = new ArrayList<>(); List actionButtons = notification.getActionButtons(); @@ -168,7 +167,7 @@ static HashMap convertNotificationToMap(OSNotification notificat hash.put("rawPayload", notification.getRawPayload()); - Log.d("onesignal", "Created json raw payload: " + convertJSONObjectToHashMap(new JSONObject(notification.getRawPayload())).toString()); + Log.d("onesignal", "Created json raw payload: " + hash.toString()); return hash; } @@ -235,7 +234,7 @@ private static HashMap convertAndroidBackgroundImageLayoutToMap( hash.put("image", layout.getImage()); hash.put("bodyTextColor", layout.getBodyTextColor()); - hash.put("titleTextColor", layout.getBodyTextColor()); + hash.put("titleTextColor", layout.getTitleTextColor()); return hash; } diff --git a/lib/src/notification.dart b/lib/src/notification.dart index a2bc74ad..aadadcb5 100644 --- a/lib/src/notification.dart +++ b/lib/src/notification.dart @@ -171,7 +171,6 @@ class OSNotification extends JSONStringRepresentable { //converts JSON map to OSNotification instance OSNotification(Map json) { - // iOS Specific Parameters if (json.containsKey('contentAvailable')) this.contentAvailable = json['contentAvailable'] as bool?; @@ -386,7 +385,7 @@ class OSNotificationReceivedEvent extends JSONStringRepresentable { String jsonRepresentation() { return convertToJsonString({ - 'notification': this.notification.jsonRepresentation + 'notification': this.notification.jsonRepresentation() }); } } \ No newline at end of file