From 5f9476448f54113e27f04f38fd64959b13bcd97b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 14 Oct 2015 21:18:34 +0200 Subject: make unread status and notifications presistent across restarts --- .../siacs/conversations/services/XmppConnectionService.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/services/XmppConnectionService.java') diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 7a39bd06..cfd3ba6e 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1072,7 +1072,14 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa for (Conversation conversation : conversations) { conversation.addAll(0, databaseBackend.getMessages(conversation, Config.PAGE_SIZE)); checkDeletedFiles(conversation); + conversation.findUnreadMessages(new Conversation.OnMessageFound() { + @Override + public void onMessageFound(Message message) { + mNotificationService.pushFromBacklog(message); + } + }); } + mNotificationService.finishBacklog(); mRestoredFromDatabase = true; Log.d(Config.LOGTAG,"restored all messages"); updateConversationUi(); @@ -1330,7 +1337,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public void updateKeyInAccount(final Account account, final String alias) { - Log.d(Config.LOGTAG,"update key in account "+alias); + Log.d(Config.LOGTAG, "update key in account " + alias); try { X509Certificate[] chain = KeyChain.getCertificateChain(XmppConnectionService.this, alias); Pair info = CryptoHelper.extractJidAndName(chain[0]); @@ -2566,7 +2573,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void markRead(final Conversation conversation) { mNotificationService.clear(conversation); - conversation.markRead(); + for(Message message : conversation.markRead()) { + databaseBackend.updateMessage(message); + } updateUnreadCountBadge(); } -- cgit v1.2.3