mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-12 08:50:30 +00:00
Review MeshCore payload status
This commit is contained in:
@@ -213,6 +213,22 @@ class MessagesProvider with ChangeNotifier {
|
||||
.where((message) => _isMessageForDestination(message, contact))
|
||||
.length;
|
||||
|
||||
DateTime? getLastActivityForDestination(Contact contact) {
|
||||
DateTime? latest;
|
||||
|
||||
for (final message in _messages) {
|
||||
if (!_isMessageForDestination(message, contact)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (latest == null || message.sentAt.isAfter(latest)) {
|
||||
latest = message.sentAt;
|
||||
}
|
||||
}
|
||||
|
||||
return latest;
|
||||
}
|
||||
|
||||
int getUnreadCountForDestination(Contact contact) => _messages
|
||||
.where(
|
||||
(message) =>
|
||||
@@ -904,7 +920,8 @@ class MessagesProvider with ChangeNotifier {
|
||||
|
||||
final matchesDestination = switch (destinationType) {
|
||||
'channel' => _isChannelMessageForContact(message, contact),
|
||||
'contact' || 'room' => contact != null && _isMessageForDestination(message, contact),
|
||||
'contact' ||
|
||||
'room' => contact != null && _isMessageForDestination(message, contact),
|
||||
_ => false,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user