Show notification badge for new messages in BriarSidebar
See the discussion at #108 (comment 57164):
@paul-lorenc:
Would it also make sense to add a blue notification badge to the sidebar above the type of incoming message? For example, if you are having a one-on-one conversation with a contact, it might be useful to see that there are unread messages in the private group or forum tabs. I don't think a numbered message badge is needed, just a simple blue or green badge to indicate there are new messages in that tab. If something like this would be somewhat simple, I think it would help UX a lot.
Yeah, on Android it looks like we depend on ContactListFragment reloading the contact list to update the unread count when the user returns from a conversation to the contact list (which incidentally makes me wonder how briar#2145 ever existed - apparently the problem was not what I thought).
To update the contact list's unread count via events we'd want to do something similar to briar!1541 (merged), wrapping MessageTracker#setReadFlag() and broadcasting an event with the contact ID. Fortunately ConversationManager already wraps that method, so we don't need to refactor any callers, just add the event. So the first part of this should be easy.
Similarly, we can display the unread counts and timestamps for individual forums and private groups by adding an event broadcast to ForumManager and PrivateGroupManager's existing wrappers around MessageTracker methods.
Blogs don't seem to use GroupCounts at all, so there's a big pile of work to do there.
And then finally we'd want to display an aggregate count for all private conversations, another aggregate count for all forums, etc, in the sidebar (nav drawer on Android). We could add methods to ConversationManager, ForumManager, PrivateGroupManager and BlogManager (after adding GroupCounts to the individual blogs) to calculate these aggregate counts when first loading the sidebar, and then update the aggregate counts via the same events that would be used to update the individual counts.
The related upstream issue is briar#42 and the custom event introduced in !46 (comment 56940) could be adapted for this.