mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Display user location & email address on about tab
This commit is contained in:
parent
5fd74f9047
commit
bdbdc2c790
@ -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"],
|
||||
);
|
||||
|
@ -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),
|
||||
|
@ -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<AboutUserSection> {
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user