Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove unused code of recents

ashilkn14d4f73d0de4
diff --git a/lib/models/search/search_types.dart b/lib/models/search/search_types.dart
index a0d12504d2..1c4f6dbc1e 100644
--- a/lib/models/search/search_types.dart
+++ b/lib/models/search/search_types.dart
@@ -32,7 +32,6 @@ enum ResultType {
}
enum SectionType {
- recents,
face,
location,
// Grouping based on ML or manual tagging
@@ -50,8 +49,6 @@ extension SectionTypeExtensions on SectionType {
// passing context for internalization in the future
String sectionTitle(BuildContext context) {
switch (this) {
- case SectionType.recents:
- return "Recents";
case SectionType.face:
return "Faces";
case SectionType.content:
@@ -74,31 +71,27 @@ extension SectionTypeExtensions on SectionType {
// get int id to each section for ordering them
int get orderID {
switch (this) {
- case SectionType.recents:
- return 0;
case SectionType.face:
- return 1;
+ return 0;
case SectionType.content:
- return 2;
+ return 1;
case SectionType.moment:
- return 3;
+ return 2;
case SectionType.location:
- return 4;
+ return 3;
case SectionType.people:
- return 5;
+ return 4;
case SectionType.album:
- return 6;
+ return 5;
case SectionType.fileTypesAndExtension:
- return 7;
+ return 6;
case SectionType.fileCaption:
- return 8;
+ return 7;
}
}
String getEmptyStateText(BuildContext context) {
switch (this) {
- case SectionType.recents:
- return "";
case SectionType.face:
return S.of(context).searchFaceEmptySection;
case SectionType.content:
@@ -122,8 +115,6 @@ extension SectionTypeExtensions on SectionType {
// Disable the CTA for face, content, moment, fileTypesAndExtension, fileCaption
bool get isCTAVisible {
switch (this) {
- case SectionType.recents:
- return false;
case SectionType.face:
return false;
case SectionType.content:
@@ -145,8 +136,6 @@ extension SectionTypeExtensions on SectionType {
bool get isEmptyCTAVisible {
switch (this) {
- case SectionType.recents:
- return false;
case SectionType.face:
return true;
case SectionType.content:
@@ -168,8 +157,6 @@ extension SectionTypeExtensions on SectionType {
String getCTAText(BuildContext context) {
switch (this) {
- case SectionType.recents:
- return "";
case SectionType.face:
return "Setup";
case SectionType.content:
@@ -191,8 +178,6 @@ extension SectionTypeExtensions on SectionType {
IconData? getCTAIcon() {
switch (this) {
- case SectionType.recents:
- return null;
case SectionType.face:
return Icons.adaptive.arrow_forward_outlined;
case SectionType.content:
@@ -272,9 +257,6 @@ extension SectionTypeExtensions on SectionType {
AssertionError("context cannot be null for SectionType.moment");
}
switch (this) {
- //recents doesn't depend on this value.
- case SectionType.recents:
- return Future.value([]);
case SectionType.face:
return SearchService.instance.getAllLocationTags(limit);
diff --git a/lib/ui/search_tab.dart b/lib/ui/search_tab.dart
index a22b4fa9e3..56c1df518c 100644
--- a/lib/ui/search_tab.dart
+++ b/lib/ui/search_tab.dart
@@ -90,17 +90,11 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
physics: const BouncingScrollPhysics(),
itemCount: searchTypes.length,
itemBuilder: (context, index) {
- return searchTypes[index] == SectionType.recents
- ? const SizedBox.shrink()
- //Recents is in WIP
- // ? RecentSection(
- // searches: snapshot.data!.elementAt(index),
- // )
- : SearchSection(
- sectionType: searchTypes[index],
- examples: snapshot.data!.elementAt(index),
- limit: searchSectionLimit,
- );
+ return SearchSection(
+ sectionType: searchTypes[index],
+ examples: snapshot.data!.elementAt(index),
+ limit: searchSectionLimit,
+ );
},
);
} else if (snapshot.hasError) {
diff --git a/lib/ui/viewer/search/search_section.dart b/lib/ui/viewer/search/search_section.dart
index de15c133d2..01154afc37 100644
--- a/lib/ui/viewer/search/search_section.dart
+++ b/lib/ui/viewer/search/search_section.dart
@@ -145,55 +145,6 @@ class _SearchSectionState extends State<SearchSection> {
}
}
-class RecentSection extends StatelessWidget {
- final List<SearchResult> searches;
-
- const RecentSection({
- required this.searches,
- Key? key,
- }) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- debugPrint("Building section for recents");
- final textTheme = getEnteTextTheme(context);
- return ListenableBuilder(
- listenable: RecentSearches(),
- builder: (context, _) {
- if (RecentSearches().searches.isNotEmpty) {
- return Padding(
- padding: const EdgeInsets.symmetric(vertical: 8),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Padding(
- padding: const EdgeInsets.all(12),
- child: Text(
- SectionType.recents.sectionTitle(context),
- style: textTheme.largeBold,
- ),
- ),
- ],
- ),
- const SizedBox(height: 2),
- SearchExampleRow(
- searches,
- SectionType.recents,
- ),
- ],
- ),
- );
- } else {
- return const SizedBox.shrink();
- }
- },
- );
- }
-}
-
class SearchExampleRow extends StatelessWidget {
final SectionType sectionType;
final List<SearchResult> examples;