mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-20 07:41:03 +10:00
Correct unread badges for tabs; people first contacts sort option
This commit is contained in:
@@ -336,15 +336,26 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
}
|
||||
|
||||
int getTotalUnreadCount() {
|
||||
if (!_unreadStateLoaded) return 0;
|
||||
return getTotalContactsUnreadCount() + getTotalChannelsUnreadCount();
|
||||
}
|
||||
|
||||
int getTotalContactsUnreadCount() {
|
||||
if (!_unreadStateLoaded) return 0;
|
||||
var total = 0;
|
||||
// Count unread contact messages
|
||||
for (final contact in _contacts) {
|
||||
total += getUnreadCountForContact(contact);
|
||||
}
|
||||
// Count unread channel messages
|
||||
for (final channelIndex in _channelMessages.keys) {
|
||||
total += getUnreadCountForChannelIndex(channelIndex);
|
||||
return total;
|
||||
}
|
||||
|
||||
int getTotalChannelsUnreadCount() {
|
||||
if (!_unreadStateLoaded) return 0;
|
||||
var total = 0;
|
||||
// Check all channels (from _channels or _cachedChannels)
|
||||
final allChannels = _channels.isNotEmpty ? _channels : _cachedChannels;
|
||||
for (final channel in allChannels) {
|
||||
total += channel.unreadCount;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user