diff --git a/lib/helpers/users_helper.dart b/lib/helpers/users_helper.dart index 7a1553c..b5bb96e 100644 --- a/lib/helpers/users_helper.dart +++ b/lib/helpers/users_helper.dart @@ -27,7 +27,6 @@ class GetUserAdvancedUserError extends Error { } class UsersHelper { - /// Download information about some given users ID /// /// Return the list of users information in case of success, null in case of @@ -96,8 +95,7 @@ class UsersHelper { {bool forceDownload = false}) async { final list = await getUsersInfo(users.toList()); - if (list == null) - throw Exception("Failed to get the list of users!"); + if (list == null) throw Exception("Failed to get the list of users!"); return list; } @@ -113,8 +111,10 @@ class UsersHelper { // Check cache for (int userID in users) { - if (!forceDownload && await UsersListSerialisationHelper().any((u) => u.id == userID)) - list.add(await UsersListSerialisationHelper().first((u) => u.id == userID)); + if (!forceDownload && + await UsersListSerialisationHelper().any((u) => u.id == userID)) + list.add( + await UsersListSerialisationHelper().first((u) => u.id == userID)); else toDownload.add(userID); } @@ -165,6 +165,7 @@ class UsersHelper { virtualDirectory: data["virtualDirectory"] == "" ? null : data["virtualDirectory"], accountImageURL: data["accountImage"], + emailAddress: data["email_address"], customEmojies: _parseCustomEmojies(data["customEmojis"]), publicNote: data["publicNote"], canPostTexts: data["can_post_texts"], @@ -172,6 +173,7 @@ class UsersHelper { numberFriends: data["number_friends"], accountCreationTime: data["account_creation_time"], personalWebsite: data["personnalWebsite"], + location: data["location"], likes: data["pageLikes"], userLike: data["user_like_page"], ); diff --git a/lib/models/advanced_user_info.dart b/lib/models/advanced_user_info.dart index ce90de5..1f00ddd 100644 --- a/lib/models/advanced_user_info.dart +++ b/lib/models/advanced_user_info.dart @@ -10,12 +10,14 @@ import 'package:meta/meta.dart'; /// @author Pierre HUBERT class AdvancedUserInfo extends User implements LikeElement { + final String emailAddress; final String publicNote; final bool canPostTexts; final bool isFriendsListPublic; final int numberFriends; final int accountCreationTime; final String personalWebsite; + final String location; bool userLike; int likes; @@ -27,12 +29,14 @@ class AdvancedUserInfo extends User implements LikeElement { @required String virtualDirectory, @required String accountImageURL, @required CustomEmojiesList customEmojies, + @required this.emailAddress, @required this.publicNote, @required this.canPostTexts, @required this.isFriendsListPublic, @required this.numberFriends, @required this.accountCreationTime, @required this.personalWebsite, + @required this.location, @required this.userLike, @required this.likes, }) : assert(publicNote != null), diff --git a/lib/ui/screens/user_page_sections/about_user_section.dart b/lib/ui/screens/user_page_sections/about_user_section.dart index 587f172..d78b4fb 100644 --- a/lib/ui/screens/user_page_sections/about_user_section.dart +++ b/lib/ui/screens/user_page_sections/about_user_section.dart @@ -6,6 +6,7 @@ import 'package:comunic/models/friend_status.dart'; import 'package:comunic/ui/widgets/FrienshipStatusWidget.dart'; import 'package:comunic/ui/widgets/async_screen_widget.dart'; import 'package:comunic/ui/widgets/text_widget.dart'; +import 'package:comunic/utils/clipboard_utils.dart'; import 'package:comunic/utils/date_utils.dart'; import 'package:comunic/utils/intl_utils.dart'; /// About current user @@ -81,6 +82,27 @@ class _AboutUserSectionState extends State { subtitle: Text("@${widget.user.virtualDirectory}")) : Container(), + // User email address + widget.user.emailAddress == null + ? Container() + : ListTile( + leading: Icon(Icons.email_outlined), + title: Text(tr("Email address")), + subtitle: Text(widget.user.emailAddress), + onTap: () => + copyToClipboard(context, widget.user.emailAddress), + ), + + // User location + widget.user.location == null + ? Container() + : ListTile( + leading: Icon(Icons.location_on), + title: Text(tr("Location")), + subtitle: Text(widget.user.location), + onTap: () => copyToClipboard(context, widget.user.location), + ), + // Number of friends widget.user.isFriendsListPublic ? ListTile(