From 1fbf3e9e27f92b7031e2f297b372f4ca4d1c6835 Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 18 Sep 2017 13:02:24 -0300 Subject: [PATCH] Android stack push notifications improvement (#912) * Android multiple push notifications improvement * Reverse order and remove duplicate --- .../mattermost/rnbeta/CustomPushNotification.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java index 6bd2df339..625a4f769 100644 --- a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java @@ -76,11 +76,11 @@ public class CustomPushNotification extends PushNotification { Object bundleArray = channelIdToNotification.get(channelId); ArrayList list = null; if (bundleArray == null) { - list = new ArrayList(); + list = new ArrayList(0); } else { list = (ArrayList)bundleArray; } - list.add(data); + list.add(0, data); channelIdToNotification.put(channelId, list); } @@ -193,11 +193,16 @@ public class CustomPushNotification extends PushNotification { Notification.InboxStyle style = new Notification.InboxStyle(); ArrayList list = (ArrayList) channelIdToNotification.get(channelId); + for (Bundle data : list){ - style.addLine(data.getString("message")); + String msg = data.getString("message"); + if (msg != message) { + style.addLine(data.getString("message")); + } } - style.setBigContentTitle(title); + style.setBigContentTitle(message) + .setSummaryText(String.format("+%d more", (numMessages - 1))); notification.setStyle(style) .setContentTitle(summaryTitle); }