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

Display the list of friends of the user

This commit is contained in:
2019-05-01 17:52:41 +02:00
parent 3109f7c482
commit 5021ded039
9 changed files with 343 additions and 2 deletions

29
lib/models/friend.dart Normal file
View File

@ -0,0 +1,29 @@
import 'package:comunic/utils/date_utils.dart';
import 'package:meta/meta.dart';
/// Single user Friend information
///
/// @author Pierre HUBERT
class Friend {
final int id;
final bool accepted;
final int lastActive;
final bool following;
final bool canPostTexts;
Friend({
@required this.id,
@required this.accepted,
@required this.lastActive,
@required this.following,
@required this.canPostTexts,
}) : assert(id != null),
assert(accepted != null),
assert(lastActive != null),
assert(following != null),
assert(canPostTexts != null);
/// Check out whether friend is connected or not
bool get isConnected => time() - 30 < lastActive;
}

View File

@ -31,6 +31,9 @@ class User extends CacheModel {
/// Get user full name
String get fullName => firstName + " " + lastName;
/// Get user display name
String get displayName => fullName; //TODO : support HTML characters (eg: &Eacute; => é)
Map<String, dynamic> toMap() {
return {
UserTableContract.C_ID: id,