[mob][photos] Show 'Reassign Me' option on PeopleAppBar if 'Me' is assigned and the person 'Me' is opened

This commit is contained in:
ashilkn
2025-01-23 12:15:51 +05:30
parent 718dcafdd0
commit e850dae7be

View File

@@ -1,6 +1,5 @@
import 'dart:async';
import "package:flutter/cupertino.dart";
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
@@ -15,6 +14,7 @@ import "package:photos/models/ml/face/person.dart";
import 'package:photos/models/selected_files.dart';
import 'package:photos/services/collections_service.dart';
import "package:photos/services/machine_learning/face_ml/person/person_service.dart";
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";
import "package:photos/ui/viewer/hierarchicial_search/applied_filters_for_appbar.dart";
@@ -52,6 +52,7 @@ enum PeoplePopupAction {
removeLabel,
reviewSuggestions,
unignore,
reassignMe,
}
class _AppBarWidgetState extends State<PeopleAppBar> {
@@ -176,6 +177,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
}
List<Widget> _getDefaultActions(BuildContext context) {
final textTheme = getEnteTextTheme(context);
final List<Widget> actions = <Widget>[];
// If the user has selected files, don't show any actions
if (widget.selectedFiles.files.isNotEmpty ||
@@ -196,7 +198,10 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
const Padding(
padding: EdgeInsets.all(8),
),
Text(S.of(context).edit),
Text(
S.of(context).edit,
style: textTheme.bodyBold,
),
],
),
),
@@ -208,7 +213,10 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
const Padding(
padding: EdgeInsets.all(8),
),
Text(S.of(context).review),
Text(
S.of(context).review,
style: textTheme.bodyBold,
),
],
),
),
@@ -220,10 +228,30 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
const Padding(
padding: EdgeInsets.all(8),
),
Text(S.of(context).remove),
Text(
S.of(context).remove,
style: textTheme.bodyBold,
),
],
),
),
if (widget.person.data.email != null &&
(widget.person.data.email == Configuration.instance.getEmail()))
PopupMenuItem(
value: PeoplePopupAction.reassignMe,
child: Row(
children: [
const Icon(Icons.delete_outline),
const Padding(
padding: EdgeInsets.all(8),
),
Text(
"Reassign \"Me\"",
style: textTheme.bodyBold,
),
],
),
),
],
);
} else {