Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Make linter happy

Neeraj Gupta199dad370591
diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart
index 7f1053d7f4..95eb0ac157 100644
--- a/mobile/lib/face/db.dart
+++ b/mobile/lib/face/db.dart
@@ -215,7 +215,7 @@ class FaceMLDataDB {
final List<int> fileId = [recentFileID];
int? avatarFileId;
if (avatarFaceId != null) {
- avatarFileId = int.tryParse(avatarFaceId!.split('_')[0]);
+ avatarFileId = int.tryParse(avatarFaceId.split('_')[0]);
if (avatarFileId != null) {
fileId.add(avatarFileId);
}
diff --git a/mobile/lib/services/machine_learning/face_ml/face_clustering/clusters_mapping.dart b/mobile/lib/services/machine_learning/face_ml/face_clustering/clusters_mapping.dart
new file mode 100644
index 0000000000..77be47e2b2
--- /dev/null
+++ b/mobile/lib/services/machine_learning/face_ml/face_clustering/clusters_mapping.dart
@@ -0,0 +1,22 @@
+import "package:photos/face/model/person.dart";
+
+enum MappingSource {
+ local,
+ remote,
+}
+
+class ClustersMapping {
+ final Map<int, Set<int>> fileIDToClusterIDs;
+ final Map<int, String> clusterToPersonID;
+ // personIDToPerson is a map of personID to PersonEntity, and it's same for
+ // both local and remote sources
+ final Map<String, PersonEntity> personIDToPerson;
+ final MappingSource source;
+
+ ClustersMapping({
+ required this.fileIDToClusterIDs,
+ required this.clusterToPersonID,
+ required this.personIDToPerson,
+ required this.source,
+ });
+}
diff --git a/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart b/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart
index 86b747551a..80ec060aa2 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart
@@ -503,7 +503,7 @@ class FaceClustering {
"[ClusterIsolate] ${DateTime.now()} Copied to isolate ${x.length} faces",
);
- DBSCAN dbscan = DBSCAN(
+ final DBSCAN dbscan = DBSCAN(
epsilon: eps,
minPoints: minPts,
distanceMeasure: cosineDistForNormVectors,
diff --git a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
index 811eec3ac6..a31f31dd3d 100644
--- a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
@@ -49,11 +49,11 @@ class PersonService {
Future<Map<String, PersonEntity>> getPersonsMap() async {
final entities = await entityService.getEntities(EntityType.person);
final Map<String, PersonEntity> map = {};
- entities.forEach((e) {
+ for (var e in entities) {
final person =
PersonEntity(e.id, PersonData.fromJson(json.decode(e.data)));
map[person.remoteID] = person;
- });
+ }
return map;
}
diff --git a/mobile/lib/services/search_service.dart b/mobile/lib/services/search_service.dart
index 06a6dc5e64..c597c22193 100644
--- a/mobile/lib/services/search_service.dart
+++ b/mobile/lib/services/search_service.dart
@@ -745,7 +745,6 @@ class SearchService {
final clusterIDToPerson =
await FaceMLDataDB.instance.getClusterIdToPerson(personIdToPerson);
- debugPrint("building result");
final List<GenericSearchResult> facesResult = [];
final Map<int, List<EnteFile>> clusterIdToFiles = {};
final Map<String, List<EnteFile>> personIdToFiles = {};
diff --git a/mobile/lib/ui/viewer/search/result/person_face_widget.dart b/mobile/lib/ui/viewer/search/result/person_face_widget.dart
index fe2732c4ec..36f5db8007 100644
--- a/mobile/lib/ui/viewer/search/result/person_face_widget.dart
+++ b/mobile/lib/ui/viewer/search/result/person_face_widget.dart
@@ -26,8 +26,10 @@ class PersonFaceWidget extends StatelessWidget {
this.personId,
this.clusterID,
Key? key,
- }) : assert(personId != null || clusterID != null,
- "PersonFaceWidget requires either personId or clusterID to be non-null"),
+ }) : assert(
+ personId != null || clusterID != null,
+ "PersonFaceWidget requires either personId or clusterID to be non-null",
+ ),
super(key: key);
@override
@@ -85,7 +87,7 @@ class PersonFaceWidget extends StatelessWidget {
Future<Face?> _getFace() async {
String? personAvatarFaceID;
if (personId != null) {
- PersonEntity? personEntity =
+ final PersonEntity? personEntity =
await PersonService.instance.getPerson(personId!);
if (personEntity != null) {
personAvatarFaceID = personEntity.data.avatarFaceId;