Correct unread badges for tabs; people first contacts sort option

This commit is contained in:
Serge Tarkovski
2026-02-09 12:56:38 +02:00
parent c320378be1
commit 8668564464
26 changed files with 215 additions and 22 deletions
+15 -4
View File
@@ -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;
}