mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Start conversation upgrade
This commit is contained in:
@ -8,11 +8,11 @@ import 'package:comunic/models/conversation.dart';
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class ConversationsList extends ListBase<Conversation> {
|
||||
|
||||
final List<Conversation> _list = List();
|
||||
UsersList users;
|
||||
|
||||
set length(l) => _list.length = l;
|
||||
|
||||
int get length => _list.length;
|
||||
|
||||
@override
|
||||
@ -22,12 +22,9 @@ class ConversationsList extends ListBase<Conversation> {
|
||||
void operator []=(int index, Conversation value) => _list[index] = value;
|
||||
|
||||
/// Get the entire lists of users ID in this list
|
||||
List<int> get allUsersID {
|
||||
final List<int> list = List();
|
||||
forEach((c) => c.members.forEach((id){
|
||||
if(!list.contains(id))
|
||||
list.add(id);
|
||||
}));
|
||||
Set<int> get allUsersID {
|
||||
final Set<int> list = Set();
|
||||
forEach((c) => c.members.forEach((member) => list.add(member.userID)));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class MembershipList extends AbstractList<Membership> {
|
||||
case MembershipType.GROUP:
|
||||
break;
|
||||
case MembershipType.CONVERSATION:
|
||||
s.addAll(m.conversation.members);
|
||||
s.addAll(m.conversation.membersID);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -7,5 +7,9 @@ import 'package:comunic/models/unread_conversation.dart';
|
||||
|
||||
class UnreadConversationsList extends AbstractList<UnreadConversation> {
|
||||
/// Get the ID of the users included in this list
|
||||
Set<int> get usersID => new Set<int>()..addAll(map((f) => f.userID));
|
||||
Set<int> get usersID {
|
||||
final set = Set();
|
||||
forEach((element) => set.addAll(element.message.usersID));
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user