Revert "Optimize new message notifications (2)"

This reverts commit c2f2afe0f5.
pull/160/head
M66B 5 years ago
parent 37097ecfbb
commit b39ef5ba48

@ -1986,9 +1986,8 @@ class Core {
// Difference // Difference
for (String group : groupMessages.keySet()) { for (String group : groupMessages.keySet()) {
// Difference // Difference
List<Long> add = new ArrayList<>(); final List<Long> add = new ArrayList<>();
List<Long> remove = new ArrayList<>(groupNotifying.get(group)); final List<Long> remove = new ArrayList<>(groupNotifying.get(group));
List<TupleMessageEx> notify = new ArrayList<>();
for (TupleMessageEx message : groupMessages.get(group)) { for (TupleMessageEx message : groupMessages.get(group)) {
long id = (message.content ? message.id : -message.id); long id = (message.content ? message.id : -message.id);
if (remove.contains(id)) { if (remove.contains(id)) {
@ -1997,7 +1996,6 @@ class Core {
} else { } else {
remove.remove(-id); remove.remove(-id);
add.add(id); add.add(id);
notify.add(message);
Log.i("Notify adding=" + id); Log.i("Notify adding=" + id);
} }
} }
@ -2008,7 +2006,7 @@ class Core {
} }
// Build notifications // Build notifications
List<Notification> notifications = getNotificationUnseen(context, group, notify); List<Notification> notifications = getNotificationUnseen(context, group, groupMessages.get(group));
Log.i("Notify group=" + group + " count=" + notifications.size() + Log.i("Notify group=" + group + " count=" + notifications.size() +
" added=" + add.size() + " removed=" + remove.size()); " added=" + add.size() + " removed=" + remove.size());
@ -2027,7 +2025,7 @@ class Core {
for (Notification notification : notifications) { for (Notification notification : notifications) {
long id = notification.extras.getLong("id", 0); long id = notification.extras.getLong("id", 0);
if (id != 0 || add.size() + remove.size() > 0) { if ((id == 0 && add.size() + remove.size() > 0) || add.contains(id)) {
String tag = "unseen." + group + "." + Math.abs(id); String tag = "unseen." + group + "." + Math.abs(id);
Log.i("Notifying tag=" + tag + Log.i("Notifying tag=" + tag +
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? "" : " channel=" + notification.getChannelId())); (Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? "" : " channel=" + notification.getChannelId()));

Loading…
Cancel
Save