import 'package:comunic/lists/abstract_list.dart'; import 'package:comunic/models/notification.dart'; /// Notifications list /// /// @author Pierre HUBERT class NotificationsList extends AbstractList { /// Get the ID of all the users related to the notifications /// included in the list Set get usersIds { final list = Set(); forEach((n) { list.add(n.fromUser); if (n.onElemType == NotificationElementType.FRIENDSHIP_REQUEST || n.onElemType == NotificationElementType.USER_PAGE) list.add(n.onElemId); if (n.fromContainerType == NotificationElementType.FRIENDSHIP_REQUEST || n.fromContainerType == NotificationElementType.USER_PAGE) list.add(n.fromContainerId); }); return list; } /// Get the ID of all the groups related to the notifications /// included in the list Set get groupsIds { final list = Set(); forEach((n) { if (n.onElemType == NotificationElementType.GROUP_PAGE) list.add(n.onElemId); if (n.fromContainerType == NotificationElementType.GROUP_PAGE) list.add(n.fromContainerId); if (n.onElemType == NotificationElementType.GROUP_MEMBERSHIP) list.add(n.onElemId); }); return list; } }