Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Suggestion option to assign to different person

laurenspriemf4024d2007e0
diff --git a/mobile/lib/ui/viewer/people/person_cluster_suggestion.dart b/mobile/lib/ui/viewer/people/person_cluster_suggestion.dart
index e8e0e90211..9615ce6da7 100644
--- a/mobile/lib/ui/viewer/people/person_cluster_suggestion.dart
+++ b/mobile/lib/ui/viewer/people/person_cluster_suggestion.dart
@@ -14,6 +14,7 @@ import "package:photos/services/machine_learning/face_ml/person/person_service.d
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
+import "package:photos/ui/viewer/people/add_person_action_sheet.dart";
import "package:photos/ui/viewer/people/cluster_page.dart";
import "package:photos/ui/viewer/people/person_clusters_page.dart";
import "package:photos/ui/viewer/search/result/person_face_widget.dart";
@@ -193,22 +194,29 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
setState(() {});
}
} else {
- canGiveFeedback = false;
- await FaceMLDataDB.instance.captureNotPersonFeedback(
- personID: widget.person.remoteID,
- clusterID: clusterID,
- );
- // Recalculate the suggestions when a suggestion is rejected
- setState(() {
- currentSuggestionIndex = 0;
- futureBuilderKeySuggestions =
- UniqueKey(); // Reset to trigger FutureBuilder
- futureBuilderKeyFaceThumbnails = UniqueKey();
- _fetchClusterSuggestions();
- });
+ await _rejectSuggestion(clusterID, numberOfSuggestions);
}
}
+ Future<void> _rejectSuggestion(
+ int clusterID,
+ int numberOfSuggestions,
+ ) async {
+ canGiveFeedback = false;
+ await FaceMLDataDB.instance.captureNotPersonFeedback(
+ personID: widget.person.remoteID,
+ clusterID: clusterID,
+ );
+ // Recalculate the suggestions when a suggestion is rejected
+ setState(() {
+ currentSuggestionIndex = 0;
+ futureBuilderKeySuggestions =
+ UniqueKey(); // Reset to trigger FutureBuilder
+ futureBuilderKeyFaceThumbnails = UniqueKey();
+ _fetchClusterSuggestions();
+ });
+ }
+
// Method to fetch cluster suggestions
void _fetchClusterSuggestions() {
futureClusterSuggestions =
@@ -245,7 +253,7 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
),
const SizedBox(
height: 24.0,
- ), // Add some spacing between the thumbnail and the text
+ ),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: Row(
@@ -282,6 +290,25 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
],
),
),
+ const SizedBox(
+ height: 24.0,
+ ),
+ ButtonWidget(
+ shouldSurfaceExecutionStates: false,
+ buttonType: ButtonType.neutral,
+ labelText: 'Assign different person',
+ buttonSize: ButtonSize.small,
+ onTap: () async {
+ final result = await showAssignPersonAction(
+ context,
+ clusterID: clusterID,
+ );
+ if (result == null || result is! PersonEntity) {
+ return;
+ }
+ await _rejectSuggestion(clusterID, numberOfSuggestions);
+ },
+ ),
],
);
// Precompute face thumbnails for next suggestions, in case there are