1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 06:19:22 +00:00
comunicmobile/lib/models/advanced_user_info.dart

70 lines
2.1 KiB
Dart
Raw Normal View History

2020-05-16 11:41:11 +00:00
import 'package:comunic/enums/likes_type.dart';
2019-06-10 12:24:34 +00:00
import 'package:comunic/enums/user_page_visibility.dart';
2020-04-28 16:47:47 +00:00
import 'package:comunic/lists/custom_emojies_list.dart';
2020-05-16 11:41:11 +00:00
import 'package:comunic/models/like_element.dart';
2019-06-10 12:24:34 +00:00
import 'package:comunic/models/user.dart';
import 'package:meta/meta.dart';
/// Advanced user information
///
/// @author Pierre HUBERT
2020-05-16 11:41:11 +00:00
class AdvancedUserInfo extends User implements LikeElement {
final String emailAddress;
2019-06-10 12:24:34 +00:00
final String publicNote;
2019-07-05 09:40:43 +00:00
final bool canPostTexts;
2020-05-16 15:21:33 +00:00
final bool isFriendsListPublic;
final int numberFriends;
2020-05-17 12:17:37 +00:00
final int accountCreationTime;
2020-05-17 12:53:26 +00:00
final String personalWebsite;
final String location;
2020-05-16 11:41:11 +00:00
bool userLike;
int likes;
2019-06-10 12:24:34 +00:00
2020-05-16 11:41:11 +00:00
AdvancedUserInfo({
2019-06-10 12:24:34 +00:00
@required int id,
@required String firstName,
@required String lastName,
@required UserPageVisibility pageVisibility,
@required String virtualDirectory,
@required String accountImageURL,
2020-04-28 16:47:47 +00:00
@required CustomEmojiesList customEmojies,
@required this.emailAddress,
2019-06-10 12:24:34 +00:00
@required this.publicNote,
2019-07-05 09:40:43 +00:00
@required this.canPostTexts,
2020-05-16 15:21:33 +00:00
@required this.isFriendsListPublic,
@required this.numberFriends,
2020-05-17 12:17:37 +00:00
@required this.accountCreationTime,
2020-05-17 12:53:26 +00:00
@required this.personalWebsite,
@required this.location,
2020-05-16 11:41:11 +00:00
@required this.userLike,
@required this.likes,
2019-06-10 12:24:34 +00:00
}) : assert(publicNote != null),
2019-07-05 09:40:43 +00:00
assert(canPostTexts != null),
2020-05-16 15:21:33 +00:00
assert(isFriendsListPublic != null),
assert(numberFriends != null),
2020-05-17 12:17:37 +00:00
assert(accountCreationTime != null),
2020-05-17 12:53:26 +00:00
assert(personalWebsite != null),
2020-05-16 11:41:11 +00:00
assert(userLike != null),
assert(likes != null),
2019-06-10 12:24:34 +00:00
super(
id: id,
firstName: firstName,
lastName: lastName,
pageVisibility: pageVisibility,
virtualDirectory: virtualDirectory,
2020-04-28 16:47:47 +00:00
accountImageURL: accountImageURL,
customEmojies: customEmojies);
2020-05-16 11:41:11 +00:00
2020-05-17 12:26:52 +00:00
bool get hasPublicNote => publicNote.isNotEmpty;
2020-05-17 12:53:26 +00:00
bool get hasPersonalWebsite => personalWebsite.isNotEmpty;
2021-04-26 07:33:54 +00:00
bool get hasEmailAddress => emailAddress != null && emailAddress.isNotEmpty;
bool get hasLocation => location != null && location.isNotEmpty;
2020-05-16 11:41:11 +00:00
@override
LikesType get likeType => LikesType.USER;
2019-06-10 12:24:34 +00:00
}