mirror of
https://github.com/ente-io/ente.git
synced 2025-04-29 19:15:33 +00:00
[mob][photos] Improve tag "me" flow (#5426)
## Description Simplified the action of assigning "me" by sticky-ing the users email on top (in case "me" is not assigned). ## Tests Tested in debug mode on my pixel phone.
This commit is contained in:
commit
39e1f7bfe7
@ -248,9 +248,7 @@ class _LinkEmailScreen extends State<LinkEmailScreen> {
|
||||
List<User> _getContacts() {
|
||||
final userEmailsToAviod =
|
||||
PersonService.instance.emailToPartialPersonDataMapCache.keys.toSet();
|
||||
final ownerEmail = Configuration.instance.getEmail();
|
||||
final relevantUsers = UserService.instance.getRelevantContacts()
|
||||
..add(User(email: ownerEmail!))
|
||||
..removeWhere(
|
||||
(user) => userEmailsToAviod.contains(user.email),
|
||||
);
|
||||
@ -259,6 +257,12 @@ class _LinkEmailScreen extends State<LinkEmailScreen> {
|
||||
(a, b) => (a.email).compareTo(b.email),
|
||||
);
|
||||
|
||||
final ownerEmail = Configuration.instance.getEmail();
|
||||
if (ownerEmail != null && !userEmailsToAviod.contains(ownerEmail)) {
|
||||
relevantUsers.insert(0, User(email: ownerEmail));
|
||||
_selectedEmail = ownerEmail;
|
||||
}
|
||||
|
||||
return relevantUsers;
|
||||
}
|
||||
|
||||
|
18
mobile/lib/ui/viewer/people/people_util.dart
Normal file
18
mobile/lib/ui/viewer/people/people_util.dart
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
import "package:photos/core/configuration.dart";
|
||||
import "package:photos/services/machine_learning/face_ml/person/person_service.dart";
|
||||
|
||||
Future<bool> isMeAssigned() async {
|
||||
final personEntities = await PersonService.instance.getPersons();
|
||||
final currentUserEmail = Configuration.instance.getEmail();
|
||||
|
||||
bool isAssigned = false;
|
||||
for (final personEntity in personEntities) {
|
||||
if (personEntity.data.email == currentUserEmail) {
|
||||
isAssigned = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isAssigned;
|
||||
}
|
@ -35,6 +35,7 @@ import "package:photos/ui/sharing/user_avator_widget.dart";
|
||||
import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";
|
||||
import "package:photos/ui/viewer/gallery/hooks/pick_person_avatar.dart";
|
||||
import "package:photos/ui/viewer/people/link_email_screen.dart";
|
||||
import "package:photos/ui/viewer/people/people_util.dart";
|
||||
import "package:photos/ui/viewer/people/person_clusters_page.dart";
|
||||
import "package:photos/ui/viewer/people/person_row_item.dart";
|
||||
import "package:photos/ui/viewer/search/result/person_face_widget.dart";
|
||||
@ -845,7 +846,7 @@ class _EmailSectionState extends State<_EmailSection> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: FutureBuilder<bool>(
|
||||
future: _isMeAssigned(),
|
||||
future: isMeAssigned(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
final isMeAssigned = snapshot.data!;
|
||||
@ -963,20 +964,6 @@ class _EmailSectionState extends State<_EmailSection> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _isMeAssigned() async {
|
||||
final personEntities = await PersonService.instance.getPersons();
|
||||
final currentUserEmail = Configuration.instance.getEmail();
|
||||
|
||||
bool isAssigned = false;
|
||||
for (final personEntity in personEntities) {
|
||||
if (personEntity.data.email == currentUserEmail) {
|
||||
isAssigned = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isAssigned;
|
||||
}
|
||||
|
||||
void _updateEmailField(String? newEmail) {
|
||||
final saveOrEditPersonState =
|
||||
context.findAncestorStateOfType<_SaveOrEditPersonState>()!;
|
||||
|
Loading…
x
Reference in New Issue
Block a user