π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Show empty people in all people page
Neeraj Guptaab02cceb8982
diff --git a/mobile/apps/photos/lib/models/search/hierarchical/face_filter.dart b/mobile/apps/photos/lib/models/search/hierarchical/face_filter.dartindex 45dc346299..62878f3c21 100644--- a/mobile/apps/photos/lib/models/search/hierarchical/face_filter.dart+++ b/mobile/apps/photos/lib/models/search/hierarchical/face_filter.dart@@ -5,7 +5,7 @@ class FaceFilter extends HierarchicalSearchFilter {final String? personId;final String? clusterId;final String? faceName;- final EnteFile faceFile;+ final EnteFile? faceFile;final int occurrence;FaceFilter({diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dartindex 20065c62bf..30feeece55 100644--- a/mobile/apps/photos/lib/services/search_service.dart+++ b/mobile/apps/photos/lib/services/search_service.dart@@ -1076,6 +1076,7 @@ class SearchService {required int minClusterSize,int? fallbackMinClusterSize,bool showIgnoredOnly = false,+ bool includeEmptyPersons = false,}) async {try {if (isLocalGalleryMode) {@@ -1239,6 +1240,13 @@ class SearchService {}}+ if (includeEmptyPersons) {+ for (final personID in personIdToPerson.keys) {+ personIdToFiles.putIfAbsent(personID, () => <EnteFile>[]);+ personIdToFileIds.putIfAbsent(personID, () => <int>{});+ }+ }+// get sorted personId by files countfinal sortedPersonIds = personIdToFiles.keys.toList()..sort(@@ -1261,19 +1269,21 @@ class SearchService {final PersonEntity p = personIdToPerson[personID]!;final bool isIgnored = p.data.isIgnored;if (showIgnoredOnly != isIgnored) continue;- if (files.isEmpty) continue;+ if (!includeEmptyPersons && files.isEmpty) continue;final matchedUploadedIDs = personIdToFileIds[personID]!;+ final previewFile = files.isEmpty ? null : files.first;+ final params = {+ kPersonWidgetKey: p.data.avatarFaceID ?? p.hashCode.toString(),+ kPersonParamID: personID,+ if (previewFile != null) kFileID: previewFile.uploadedFileID,+ kPersonPinned: p.data.isPinned,+ };facesResult.add(GenericSearchResult(ResultType.faces,p.data.name,files,- params: {- kPersonWidgetKey: p.data.avatarFaceID ?? p.hashCode.toString(),- kPersonParamID: personID,- kFileID: files.first.uploadedFileID,- kPersonPinned: p.data.isPinned,- },+ params: params,onResultTap: (ctx) {routeToPage(ctx,@@ -1284,18 +1294,12 @@ class SearchService {ResultType.faces,p.data.name,files,- params: {- kPersonWidgetKey:- p.data.avatarFaceID ?? p.hashCode.toString(),- kPersonParamID: personID,- kPersonPinned: p.data.isPinned,- kFileID: files.first.uploadedFileID,- },+ params: params,hierarchicalSearchFilter: FaceFilter(personId: p.remoteID,clusterId: null,faceName: p.data.name,- faceFile: files.first,+ faceFile: previewFile,occurrence: kMostRelevantFilter,matchedUploadedIDs: matchedUploadedIDs,),@@ -1307,7 +1311,7 @@ class SearchService {personId: p.remoteID,clusterId: null,faceName: p.data.name,- faceFile: files.first,+ faceFile: previewFile,occurrence: kMostRelevantFilter,matchedUploadedIDs: matchedUploadedIDs,),@@ -1391,6 +1395,7 @@ class SearchService {limit,minClusterSize: fallbackMinClusterSize,showIgnoredOnly: showIgnoredOnly,+ includeEmptyPersons: includeEmptyPersons,);} else {return [];diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dartindex 25734c1aeb..a28ede2915 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/people_section_all_page.dart@@ -62,6 +62,7 @@ class _PeopleSectionAllPageState extends State<PeopleSectionAllPage> {selectedPeople: _selectedPeople,showSearchBar: true,startInSearchMode: widget.startInSearchMode,+ includeEmptyPersons: true,),bottomNavigationBar: hasSelection? PeopleBottomActionBarWidget(@@ -81,12 +82,14 @@ class PeopleSectionAllSelectionWrapper extends StatefulWidget {final SelectedPeople selectedPeople;final bool showSearchBar;final bool startInSearchMode;+ final bool includeEmptyPersons;const PeopleSectionAllSelectionWrapper({super.key,required this.selectedPeople,this.showSearchBar = false,this.startInSearchMode = false,+ this.includeEmptyPersons = false,});@override@@ -102,6 +105,7 @@ class _PeopleSectionAllSelectionWrapperStateselectedPeople: widget.selectedPeople,showSearchBar: widget.showSearchBar,startInSearchMode: widget.startInSearchMode,+ includeEmptyPersons: widget.includeEmptyPersons,);}}@@ -319,12 +323,14 @@ class PeopleSectionAllWidget extends StatefulWidget {this.namedOnly = false,this.showSearchBar = false,this.startInSearchMode = false,+ this.includeEmptyPersons = false,});final SelectedPeople? selectedPeople;final bool namedOnly;final bool showSearchBar;final bool startInSearchMode;+ final bool includeEmptyPersons;@overrideState<PeopleSectionAllWidget> createState() => _PeopleSectionAllWidgetState();@@ -489,6 +495,7 @@ class _PeopleSectionAllWidgetState extends State<PeopleSectionAllWidget> {null,minClusterSize: kMinimumClusterSizeAllFaces,showIgnoredOnly: _showingIgnoredPeople,+ includeEmptyPersons: widget.includeEmptyPersons,);normalFaces.clear();extraFaces.clear();