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 {
|
class UsersHelper {
|
||||||
|
|
||||||
/// Download information about some given users ID
|
/// Download information about some given users ID
|
||||||
///
|
///
|
||||||
/// Return the list of users information in case of success, null in case of
|
/// Return the list of users information in case of success, null in case of
|
||||||
@ -96,8 +95,7 @@ class UsersHelper {
|
|||||||
{bool forceDownload = false}) async {
|
{bool forceDownload = false}) async {
|
||||||
final list = await getUsersInfo(users.toList());
|
final list = await getUsersInfo(users.toList());
|
||||||
|
|
||||||
if (list == null)
|
if (list == null) throw Exception("Failed to get the list of users!");
|
||||||
throw Exception("Failed to get the list of users!");
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -113,8 +111,10 @@ class UsersHelper {
|
|||||||
|
|
||||||
// Check cache
|
// Check cache
|
||||||
for (int userID in users) {
|
for (int userID in users) {
|
||||||
if (!forceDownload && await UsersListSerialisationHelper().any((u) => u.id == userID))
|
if (!forceDownload &&
|
||||||
list.add(await UsersListSerialisationHelper().first((u) => u.id == userID));
|
await UsersListSerialisationHelper().any((u) => u.id == userID))
|
||||||
|
list.add(
|
||||||
|
await UsersListSerialisationHelper().first((u) => u.id == userID));
|
||||||
else
|
else
|
||||||
toDownload.add(userID);
|
toDownload.add(userID);
|
||||||
}
|
}
|
||||||
@ -165,6 +165,7 @@ class UsersHelper {
|
|||||||
virtualDirectory:
|
virtualDirectory:
|
||||||
data["virtualDirectory"] == "" ? null : data["virtualDirectory"],
|
data["virtualDirectory"] == "" ? null : data["virtualDirectory"],
|
||||||
accountImageURL: data["accountImage"],
|
accountImageURL: data["accountImage"],
|
||||||
|
emailAddress: data["email_address"],
|
||||||
customEmojies: _parseCustomEmojies(data["customEmojis"]),
|
customEmojies: _parseCustomEmojies(data["customEmojis"]),
|
||||||
publicNote: data["publicNote"],
|
publicNote: data["publicNote"],
|
||||||
canPostTexts: data["can_post_texts"],
|
canPostTexts: data["can_post_texts"],
|
||||||
@ -172,6 +173,7 @@ class UsersHelper {
|
|||||||
numberFriends: data["number_friends"],
|
numberFriends: data["number_friends"],
|
||||||
accountCreationTime: data["account_creation_time"],
|
accountCreationTime: data["account_creation_time"],
|
||||||
personalWebsite: data["personnalWebsite"],
|
personalWebsite: data["personnalWebsite"],
|
||||||
|
location: data["location"],
|
||||||
likes: data["pageLikes"],
|
likes: data["pageLikes"],
|
||||||
userLike: data["user_like_page"],
|
userLike: data["user_like_page"],
|
||||||
);
|
);
|
||||||
|
@ -10,12 +10,14 @@ import 'package:meta/meta.dart';
|
|||||||
/// @author Pierre HUBERT
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
class AdvancedUserInfo extends User implements LikeElement {
|
class AdvancedUserInfo extends User implements LikeElement {
|
||||||
|
final String emailAddress;
|
||||||
final String publicNote;
|
final String publicNote;
|
||||||
final bool canPostTexts;
|
final bool canPostTexts;
|
||||||
final bool isFriendsListPublic;
|
final bool isFriendsListPublic;
|
||||||
final int numberFriends;
|
final int numberFriends;
|
||||||
final int accountCreationTime;
|
final int accountCreationTime;
|
||||||
final String personalWebsite;
|
final String personalWebsite;
|
||||||
|
final String location;
|
||||||
bool userLike;
|
bool userLike;
|
||||||
int likes;
|
int likes;
|
||||||
|
|
||||||
@ -27,12 +29,14 @@ class AdvancedUserInfo extends User implements LikeElement {
|
|||||||
@required String virtualDirectory,
|
@required String virtualDirectory,
|
||||||
@required String accountImageURL,
|
@required String accountImageURL,
|
||||||
@required CustomEmojiesList customEmojies,
|
@required CustomEmojiesList customEmojies,
|
||||||
|
@required this.emailAddress,
|
||||||
@required this.publicNote,
|
@required this.publicNote,
|
||||||
@required this.canPostTexts,
|
@required this.canPostTexts,
|
||||||
@required this.isFriendsListPublic,
|
@required this.isFriendsListPublic,
|
||||||
@required this.numberFriends,
|
@required this.numberFriends,
|
||||||
@required this.accountCreationTime,
|
@required this.accountCreationTime,
|
||||||
@required this.personalWebsite,
|
@required this.personalWebsite,
|
||||||
|
@required this.location,
|
||||||
@required this.userLike,
|
@required this.userLike,
|
||||||
@required this.likes,
|
@required this.likes,
|
||||||
}) : assert(publicNote != null),
|
}) : 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/FrienshipStatusWidget.dart';
|
||||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/text_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/date_utils.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
/// About current user
|
/// About current user
|
||||||
@ -81,6 +82,27 @@ class _AboutUserSectionState extends State<AboutUserSection> {
|
|||||||
subtitle: Text("@${widget.user.virtualDirectory}"))
|
subtitle: Text("@${widget.user.virtualDirectory}"))
|
||||||
: Container(),
|
: 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
|
// Number of friends
|
||||||
widget.user.isFriendsListPublic
|
widget.user.isFriendsListPublic
|
||||||
? ListTile(
|
? ListTile(
|
||||||
|
Loading…
Reference in New Issue
Block a user