Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Show name if email is linked to a person for emails in the share info screen of albums

ashilkncea2f5b2dff3
diff --git a/mobile/lib/ui/sharing/album_participants_page.dart b/mobile/lib/ui/sharing/album_participants_page.dart
index 0c137f3001..2479bff28a 100644
--- a/mobile/lib/ui/sharing/album_participants_page.dart
+++ b/mobile/lib/ui/sharing/album_participants_page.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/extensions/list.dart';
+import "package:photos/extensions/user_extension.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/api/collection/user.dart";
import 'package:photos/models/collection/collection.dart';
@@ -106,7 +107,11 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
captionedTextWidget: CaptionedTextWidget(
title: isOwner
? S.of(context).you
- : widget.collection.owner?.email ?? '',
+ : widget.collection.owner != null
+ ? _nameIfAvailableElseEmail(
+ widget.collection.owner!,
+ )
+ : '',
makeTextBold: isOwner,
),
leadingIconWidget: UserAvatarWidget(
@@ -150,7 +155,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
captionedTextWidget: CaptionedTextWidget(
title: isSameAsLoggedInUser
? S.of(context).you
- : currentUser.email,
+ : _nameIfAvailableElseEmail(currentUser),
makeTextBold: isSameAsLoggedInUser,
),
leadingIconSize: 24.0,
@@ -228,7 +233,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
captionedTextWidget: CaptionedTextWidget(
title: isSameAsLoggedInUser
? S.of(context).you
- : currentUser.email,
+ : _nameIfAvailableElseEmail(currentUser),
makeTextBold: isSameAsLoggedInUser,
),
leadingIconSize: 24.0,
@@ -288,4 +293,12 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
),
);
}
+
+ String _nameIfAvailableElseEmail(User user) {
+ final name = user.displayName;
+ if (name != null && name.isNotEmpty) {
+ return name;
+ }
+ return user.email;
+ }
}