mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Display the list of friends of the user
This commit is contained in:
		
							
								
								
									
										29
									
								
								lib/models/friend.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								lib/models/friend.dart
									
									
									
									
									
										Normal 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;
 | 
			
		||||
}
 | 
			
		||||
@@ -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: É => é)
 | 
			
		||||
 | 
			
		||||
  Map<String, dynamic> toMap() {
 | 
			
		||||
    return {
 | 
			
		||||
      UserTableContract.C_ID: id,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user