mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Merge branch '196-mark-messages-read' into 'master'
Mark private messages read properly Depends on !386. This branch uses the same approach as forums to mark messages read, i.e. each message is marked read when it becomes visible, rather than marking all messages read in a batch when the activity finishes. This fixes two problems: messages not being marked read when isFinishing() is false, for example when leaving the activity via the home button, and a race condition between updating and loading the group count when leaving the activity, resulting in a stale unread message count in the contact list. Closes #196. See merge request !388
This commit is contained in:
@@ -169,8 +169,9 @@ public abstract class BdfIncomingMessageHook implements IncomingMessageHook,
|
||||
// update unread counter in group metadata
|
||||
GroupCount c = getGroupCount(txn, g);
|
||||
BdfDictionary d = new BdfDictionary();
|
||||
d.put(GROUP_KEY_UNREAD_COUNT,
|
||||
c.getUnreadCount() + (read ? -1 : 1));
|
||||
int count = c.getUnreadCount() + (read ? -1 : 1);
|
||||
if (count < 0) throw new DbException();
|
||||
d.put(GROUP_KEY_UNREAD_COUNT, count);
|
||||
clientHelper.mergeGroupMetadata(txn, g, d);
|
||||
}
|
||||
db.commitTransaction(txn);
|
||||
|
||||
Reference in New Issue
Block a user