mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 14:29:22 +00:00
36 lines
812 B
Dart
36 lines
812 B
Dart
|
import 'dart:collection';
|
||
|
|
||
|
import 'package:comunic/models/conversation_message.dart';
|
||
|
|
||
|
/// Conversations messages list
|
||
|
///
|
||
|
/// @author Pierre HUBERT
|
||
|
|
||
|
class ConversationMessagesList extends ListBase<ConversationMessage> {
|
||
|
final List<ConversationMessage> _list = List();
|
||
|
|
||
|
set length(int v) => _list.length = v;
|
||
|
|
||
|
int get length => _list.length;
|
||
|
|
||
|
@override
|
||
|
ConversationMessage operator [](int index) {
|
||
|
return _list[index];
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
void operator []=(int index, ConversationMessage value) {
|
||
|
_list[index] = value;
|
||
|
}
|
||
|
|
||
|
/// Get the list of the users ID who own a message in this list
|
||
|
List<int> getUsersID() {
|
||
|
final List<int> users = List();
|
||
|
|
||
|
for (ConversationMessage message in this)
|
||
|
if (!users.contains(message.userID)) users.add(message.userID);
|
||
|
|
||
|
return users;
|
||
|
}
|
||
|
}
|