Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge branch 'mobile_face' into mobile_face_feedback_sync

Neeraj Gupta7c6001321f21
diff --cc mobile/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
index b923cf0370,cef19c7a28..a434f5377e
--- a/mobile/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
+++ b/mobile/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
@@@ -325,15 -325,28 +325,28 @@@ class ClusterFeedbackService
}
}
- Future<void> removeFilesFromPerson(List<EnteFile> files, PersonEntity p) {
- return FaceMLDataDB.instance.removeFilesFromPerson(files, p.remoteID);
- Future<void> removeFilesFromPerson(List<EnteFile> files, Person p) async {
- await FaceMLDataDB.instance.removeFilesFromPerson(files, p);
++ Future<void> removeFilesFromPerson(
++ List<EnteFile> files, PersonEntity p) async {
++ await FaceMLDataDB.instance.removeFilesFromPerson(files, p.remoteID);
+ Bus.instance.fire(PeopleChangedEvent());
- return;
}
- Future<void> removeFilesFromCluster(List<EnteFile> files, int clusterID) {
- return FaceMLDataDB.instance.removeFilesFromCluster(files, clusterID);
+ Future<void> removeFilesFromCluster(
+ List<EnteFile> files,
+ int clusterID,
+ ) async {
+ await FaceMLDataDB.instance.removeFilesFromCluster(files, clusterID);
+ Bus.instance.fire(PeopleChangedEvent());
+ return;
+ }
+
+ Future<void> addFilesToCluster(List<String> faceIDs, int clusterID) async {
+ await FaceMLDataDB.instance.addFacesToCluster(faceIDs, clusterID);
+ Bus.instance.fire(PeopleChangedEvent());
+ return;
}
- Future<bool> checkAndDoAutomaticMerges(Person p) async {
+ Future<bool> checkAndDoAutomaticMerges(PersonEntity p) async {
final faceMlDb = FaceMLDataDB.instance;
final allClusterIdsToCountMap = (await faceMlDb.clusterIdToFaceCount());
final ignoredClusters = await faceMlDb.getPersonIgnoredClusters(p.remoteID);
diff --cc mobile/lib/ui/viewer/file_details/face_widget.dart
index 0a048a900e,9ee41add2b..ef75870b12
--- a/mobile/lib/ui/viewer/file_details/face_widget.dart
+++ b/mobile/lib/ui/viewer/file_details/face_widget.dart
@@@ -16,13 -18,15 +18,15 @@@ import "package:photos/ui/viewer/people
import "package:photos/ui/viewer/people/people_page.dart";
import "package:photos/utils/face/face_box_crop.dart";
import "package:photos/utils/thumbnail_util.dart";
+ // import "package:photos/utils/toast_util.dart";
- class FaceWidget extends StatelessWidget {
+ class FaceWidget extends StatefulWidget {
final EnteFile file;
final Face face;
- final Person? person;
+ final PersonEntity? person;
final int? clusterID;
final bool highlight;
+ final bool editMode;
const FaceWidget(
this.file,
@@@ -82,39 -96,62 +96,62 @@@ class _FaceWidgetState extends State<Fa
},
child: Column(
children: [
- // TODO: the edges of the green line are still not properly rounded around ClipRRect
- Container(
- height: 60,
- width: 60,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- borderRadius:
- const BorderRadius.all(Radius.elliptical(16, 12)),
- side: highlight
- ? BorderSide(
- color: getEnteColorScheme(context).primary700,
- width: 2.0,
- )
- : BorderSide.none,
- ),
- ),
- child: ClipRRect(
- borderRadius:
- const BorderRadius.all(Radius.elliptical(16, 12)),
- child: SizedBox(
- width: 60,
+ Stack(
+ children: [
+ Container(
height: 60,
- child: Image(
- image: imageProvider,
- fit: BoxFit.cover,
+ width: 60,
+ decoration: ShapeDecoration(
+ shape: RoundedRectangleBorder(
+ borderRadius: const BorderRadius.all(
+ Radius.elliptical(16, 12),
+ ),
+ side: widget.highlight
+ ? BorderSide(
+ color:
+ getEnteColorScheme(context).primary700,
+ width: 1.0,
+ )
+ : BorderSide.none,
+ ),
+ ),
+ child: ClipRRect(
+ borderRadius:
+ const BorderRadius.all(Radius.elliptical(16, 12)),
+ child: SizedBox(
+ width: 60,
+ height: 60,
+ child: Image(
+ image: imageProvider,
+ fit: BoxFit.cover,
+ ),
+ ),
),
),
- ),
+ // TODO: the edges of the green line are still not properly rounded around ClipRRect
+ if (widget.editMode)
+ Positioned(
+ right: 0,
+ top: 0,
+ child: GestureDetector(
+ onTap: _cornerIconPressed,
+ child: isJustRemoved
+ ? const Icon(
+ CupertinoIcons.add_circled_solid,
+ color: Colors.green,
+ )
+ : const Icon(
+ Icons.cancel,
+ color: Colors.red,
+ ),
+ ),
+ ),
+ ],
),
const SizedBox(height: 8),
- if (person != null)
+ if (widget.person != null)
Text(
- person!.data.name.trim(),
- widget.person!.attr.name.trim(),
++ widget.person!.data.name.trim(),
style: Theme.of(context).textTheme.bodySmall,
overflow: TextOverflow.ellipsis,
maxLines: 1,
@@@ -235,9 -290,9 +290,9 @@@
),
),
const SizedBox(height: 8),
- if (person != null)
+ if (widget.person != null)
Text(
- person!.data.name.trim(),
- widget.person!.attr.name.trim(),
++ widget.person!.data.name.trim(),
style: Theme.of(context).textTheme.bodySmall,
overflow: TextOverflow.ellipsis,
maxLines: 1,
diff --cc mobile/lib/ui/viewer/people/people_app_bar.dart
index e8caccae5d,b6379153cb..14ced3ea28
--- a/mobile/lib/ui/viewer/people/people_app_bar.dart
+++ b/mobile/lib/ui/viewer/people/people_app_bar.dart
@@@ -12,10 -13,9 +12,10 @@@ import "package:photos/generated/l10n.d
import 'package:photos/models/gallery_type.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/ui/actions/collection/collection_sharing_actions.dart';
- import "package:photos/ui/viewer/people/person_cluserts.dart";
import "package:photos/ui/viewer/people/person_cluster_suggestion.dart";
+ import 'package:photos/ui/viewer/people/person_clusters_page.dart';
import "package:photos/utils/dialog_util.dart";
class PeopleAppBar extends StatefulWidget {
diff --cc mobile/lib/ui/viewer/people/person_clusters_page.dart
index 7f48d0ddd9,044cd90d28..c18d2905ce
--- a/mobile/lib/ui/viewer/people/person_clusters_page.dart
+++ b/mobile/lib/ui/viewer/people/person_clusters_page.dart
@@@ -13,10 -13,10 +13,10 @@@ import "package:photos/ui/viewer/file/n
import "package:photos/ui/viewer/people/cluster_page.dart";
import "package:photos/ui/viewer/search/result/person_face_widget.dart";
- class PersonClusters extends StatefulWidget {
+ class PersonClustersPage extends StatefulWidget {
- final Person person;
+ final PersonEntity person;
- const PersonClusters(
+ const PersonClustersPage(
this.person, {
super.key,
});