Skip to content

armgit / ente

Public Imported from GitHub
0

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

Clarify moment search intent helpers

ashil-pilot97c4d0610825
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 d6f60d1fe3..e9b9dc2735 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/search_suggestions.dart
@@ -397,8 +397,8 @@ bool _looksLikeMomentQuery(BuildContext context, String query) {
return false;
}
return _isYearQuery(query) ||
- _isSupportedDateQuery(query) ||
- _isMonthQuery(context, query);
+ _isParsedDateQuery(query) ||
+ _isLocalizedMonthQuery(context, query);
}
bool _isYearQuery(String query) {
@@ -406,20 +406,15 @@ bool _isYearQuery(String query) {
return yearAsInt != null && yearAsInt <= currentYear;
}
-bool _isSupportedDateQuery(String query) {
+bool _isParsedDateQuery(String query) {
final parsedDate = DateParseService.instance.parse(query);
if (parsedDate.isEmpty) {
return false;
}
- if (parsedDate.day == null &&
- parsedDate.month == null &&
- parsedDate.year != null) {
- return _isYearQuery(query);
- }
- return true;
+ return parsedDate.day != null || parsedDate.month != null;
}
-bool _isMonthQuery(BuildContext context, String query) {
+bool _isLocalizedMonthQuery(BuildContext context, String query) {
if (query.length < 3) {
return false;
}