aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-15 11:51:17 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-15 11:51:17 +0100
commitbac5992e429a18a63a59cb7f63a213d9a5f79ed0 (patch)
treea302bca9ede6c7616141d0a5ca18eaf8df12893b /src/main/java
parent61da550aa070299d89a902ba644761272e371a66 (diff)
finish of backlog only for one particular account
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/services/MessageArchiveService.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java19
2 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
index 702e0d093..9e2c6febd 100644
--- a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
+++ b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
@@ -224,7 +224,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
this.finalizeQuery(query, done);
Log.d(Config.LOGTAG, query.getAccount().getJid().toBareJid() + ": finished mam after " + query.getTotalCount() + " messages. messages left=" + Boolean.toString(!done));
if (query.getWith() == null && query.getMessageCount() > 0) {
- mXmppConnectionService.getNotificationService().finishBacklog(true);
+ mXmppConnectionService.getNotificationService().finishBacklog(true,query.getAccount());
}
} else {
final Query nextQuery;
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index 7987bf8c9..3cdc9a7ce 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -106,13 +106,28 @@ public class NotificationService {
}
}
- public void finishBacklog(boolean notify) {
+ public void finishBacklog(boolean notify, Account account) {
synchronized (notifications) {
mXmppConnectionService.updateUnreadCountBadge();
- updateNotification(notify);
+ if (account == null || !notify) {
+ updateNotification(notify);
+ } else {
+ boolean hasPendingMessages = false;
+ for (ArrayList<Message> messages : notifications.values()) {
+ if (messages.size() > 0 && messages.get(0).getConversation().getAccount() == account) {
+ hasPendingMessages = true;
+ break;
+ }
+ }
+ updateNotification(hasPendingMessages);
+ }
}
}
+ public void finishBacklog(boolean notify) {
+ finishBacklog(notify, null);
+ }
+
private void pushToStack(final Message message) {
final String conversationUuid = message.getConversationUuid();
if (notifications.containsKey(conversationUuid)) {