Skip to content

Commit b248f2e

Browse files
HolofoxJeasmine
authored andcommitted
Fix serialization for grouped notification
1 parent 6cc8416 commit b248f2e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

android/src/main/java/com/onesignal/flutter/OneSignalSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static HashMap<String, Object> convertNotificationToMap(OSNotification notificat
135135
for (OSNotification groupedNotification : notification.getGroupedNotifications())
136136
payloadJsonArray.put(groupedNotification.toJSONObject());
137137

138-
hash.put("groupedNotifications", payloadJsonArray);
138+
hash.put("groupedNotifications", payloadJsonArray.toString());
139139
}
140140

141141
hash.put("notificationId", notification.getNotificationId());

lib/src/notification.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,10 @@ class OSNotification extends JSONStringRepresentable {
217217
json['backgroundImageLayout'].cast<String, dynamic>());
218218
}
219219
if (json.containsKey('groupedNotifications')) {
220-
String jsonGroupedNotifications = json['groupedNotifications'] as String;
221-
List jsonList = jsonDecode(jsonGroupedNotifications) as List;
222-
this.groupedNotifications = jsonList.map((item) => OSNotification(item)).toList();
220+
final dynamic jsonGroupedNotifications = json['groupedNotifications'];
221+
final jsonList = jsonDecode(jsonGroupedNotifications.toString()) as List<dynamic>;
222+
this.groupedNotifications = jsonList.map((dynamic item) =>
223+
OSNotification(item as Map<String, dynamic>)).toList();
223224
}
224225

225226
// shared parameters

0 commit comments

Comments
 (0)