Skip to content

armgit / ente

Public Imported from GitHub
0

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

Separate shared category

laurenspriem0b043d651d10
diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart b/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
index 45f3db0dae..edcfe93cb4 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
@@ -179,38 +179,16 @@ class _SearchSuggestionsWidgetState extends State<SearchSuggestionsWidget> {
if (widgets.isNotEmpty) {
widgets.add(const SizedBox(height: 18));
}
- final orderedResults = _orderedResultsForSection(section, results);
widgets.add(
_SearchResultsSectionWidget(
title: _sectionTitle(context, section),
icon: _sectionIcon(section),
- results: orderedResults,
+ results: results,
),
);
}
return widgets;
}
-
- List<SearchResult> _orderedResultsForSection(
- _SearchResultsSection section,
- List<SearchResult> results,
- ) {
- if (section != _SearchResultsSection.people) {
- return results;
- }
- final people = <SearchResult>[];
- final shared = <SearchResult>[];
- for (final result in results) {
- if (result.type() == ResultType.faces) {
- people.add(result);
- } else if (result.type() == ResultType.shared) {
- shared.add(result);
- } else {
- shared.add(result);
- }
- }
- return [...people, ...shared];
- }
}
class SearchResultsWidgetGenerator extends StatelessWidget {
@@ -261,6 +239,7 @@ class SearchResultsWidgetGenerator extends StatelessWidget {
enum _SearchResultsSection {
people,
+ shared,
albums,
magic,
files,
@@ -274,14 +253,16 @@ const List<_SearchResultsSection> _sectionOrder = [
_SearchResultsSection.albums,
_SearchResultsSection.locations,
_SearchResultsSection.people,
+ _SearchResultsSection.shared,
_SearchResultsSection.magic,
];
_SearchResultsSection _sectionForResult(SearchResult result) {
switch (result.type()) {
case ResultType.faces:
- case ResultType.shared:
return _SearchResultsSection.people;
+ case ResultType.shared:
+ return _SearchResultsSection.shared;
case ResultType.collection:
return _SearchResultsSection.albums;
case ResultType.magic:
@@ -308,6 +289,8 @@ String _sectionTitle(BuildContext context, _SearchResultsSection section) {
switch (section) {
case _SearchResultsSection.people:
return AppLocalizations.of(context).people;
+ case _SearchResultsSection.shared:
+ return AppLocalizations.of(context).searchResultShared;
case _SearchResultsSection.albums:
return AppLocalizations.of(context).albums;
case _SearchResultsSection.magic:
@@ -325,6 +308,8 @@ List<List<dynamic>> _sectionIcon(_SearchResultsSection section) {
switch (section) {
case _SearchResultsSection.people:
return HugeIcons.strokeRoundedUserMultiple;
+ case _SearchResultsSection.shared:
+ return HugeIcons.strokeRoundedShare08;
case _SearchResultsSection.albums:
return HugeIcons.strokeRoundedImage01;
case _SearchResultsSection.magic: