Skip to content

armgit / ente

Public Imported from GitHub
0

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

Derive promoted search section orders

ashil-pilotac7fd5e53049
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 08418c5c71..d6f60d1fe3 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
@@ -284,25 +284,20 @@ const List<_SearchResultsSection> _defaultSectionOrder = [
_SearchResultsSection.files,
];
-const List<_SearchResultsSection> _fileIntentSectionOrder = [
- _SearchResultsSection.files,
- _SearchResultsSection.magic,
- _SearchResultsSection.people,
- _SearchResultsSection.locations,
- _SearchResultsSection.moments,
- _SearchResultsSection.albums,
- _SearchResultsSection.shared,
-];
+final List<_SearchResultsSection> _fileIntentSectionOrder =
+ _sectionOrderPromoting(_SearchResultsSection.files);
-const List<_SearchResultsSection> _momentIntentSectionOrder = [
- _SearchResultsSection.moments,
- _SearchResultsSection.magic,
- _SearchResultsSection.people,
- _SearchResultsSection.locations,
- _SearchResultsSection.albums,
- _SearchResultsSection.shared,
- _SearchResultsSection.files,
-];
+final List<_SearchResultsSection> _momentIntentSectionOrder =
+ _sectionOrderPromoting(_SearchResultsSection.moments);
+
+List<_SearchResultsSection> _sectionOrderPromoting(
+ _SearchResultsSection promotedSection,
+) {
+ return List.unmodifiable([
+ promotedSection,
+ ..._defaultSectionOrder.where((section) => section != promotedSection),
+ ]);
+}
const Set<String> _commonFileExtensions = {
"3fr",