1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Show groups posts

This commit is contained in:
2019-06-10 09:47:02 +02:00
parent d62d23bd44
commit ee864d3d98
7 changed files with 186 additions and 7 deletions

View File

@ -0,0 +1,29 @@
import 'dart:collection';
import 'package:comunic/models/group.dart';
/// Groups list
///
/// @author Pierre HUBERT
class GroupsList extends MapBase<int, Group> {
final Map<int, Group> _groups = Map();
@override
Group operator [](Object key) => _groups[key];
@override
void operator []=(int key, Group value) => _groups[key] = value;
@override
void clear() => _groups.clear();
@override
Iterable<int> get keys => _groups.keys;
@override
Group remove(Object key) => _groups.remove(key);
}

View File

@ -9,7 +9,6 @@ import 'package:comunic/models/post.dart';
/// @author Pierre HUBERT
class PostsList extends ListBase<Post> {
List<Post> _list = List();
int get length => _list.length;
@ -29,14 +28,22 @@ class PostsList extends ListBase<Post> {
forEach((p) {
set.add(p.userID);
if(p.userPageID != null && p.userPageID > 0)
set.add(p.userPageID);
if (p.userPageID != null && p.userPageID > 0) set.add(p.userPageID);
if(p.comments != null)
set.addAll(p.comments.usersID);
if (p.comments != null) set.addAll(p.comments.usersID);
});
return set;
}
}
/// Get the list of groups in this list of posts
Set<int> get groupsID {
Set<int> set = Set();
forEach((p) {
if (p.isGroupPost) set.add(p.groupID);
});
return set;
}
}