1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-09-18 21:38:48 +00:00

Load memberships

This commit is contained in:
2020-05-05 18:49:50 +02:00
parent 3d0bfe6c3f
commit 286639889b
8 changed files with 160 additions and 18 deletions

View File

@@ -22,8 +22,6 @@ class Friend extends CacheModel implements Comparable<Friend> {
}) : assert(id != null),
assert(accepted != null),
assert(lastActive != null),
assert(following != null),
assert(canPostTexts != null),
super(id: id);
/// Check out whether friend is connected or not

View File

@@ -0,0 +1,38 @@
import 'package:comunic/models/conversation.dart';
import 'package:comunic/models/friend.dart';
import 'package:flutter/material.dart';
/// Membership information
///
/// @author Pierre Hubert
enum MembershipType { FRIEND, GROUP, CONVERSATION }
class Membership {
final MembershipType type;
final Conversation conversation;
final Friend friend;
final int groupID;
final int groupLastActive;
Membership.conversation(this.conversation)
: type = MembershipType.CONVERSATION,
friend = null,
groupID = null,
groupLastActive = null,
assert(conversation != null);
Membership.friend(this.friend)
: type = MembershipType.FRIEND,
conversation = null,
groupID = null,
groupLastActive = null,
assert(friend != null);
Membership.group({@required this.groupID, @required this.groupLastActive})
: type = MembershipType.GROUP,
conversation = null,
friend = null,
assert(groupID != null),
assert(groupLastActive != null);
}