Merge pull request #485 from ente-io/search_changes
This commit is contained in:
commit
2e66c3236d
|
@ -42,7 +42,6 @@ class FFDefault {
|
|||
static const bool disableUrlSharing = false;
|
||||
static const bool disableCFWorker = false;
|
||||
static const bool enableMissingLocationMigration = false;
|
||||
static const bool enableSearch = false;
|
||||
}
|
||||
|
||||
const kDefaultProductionEndpoint = 'https://api.ente.io';
|
||||
|
|
|
@ -86,15 +86,6 @@ class FeatureFlagService {
|
|||
}
|
||||
}
|
||||
|
||||
bool enableSearch() {
|
||||
try {
|
||||
return isInternalUserOrDebugBuild() || _getFeatureFlags().enableSearch;
|
||||
} catch (e) {
|
||||
_logger.severe("failed to getSearchFeatureFlag", e);
|
||||
return FFDefault.enableSearch;
|
||||
}
|
||||
}
|
||||
|
||||
bool isInternalUserOrDebugBuild() {
|
||||
final String email = Configuration.instance.getEmail();
|
||||
return (email != null && email.endsWith("@ente.io")) || kDebugMode;
|
||||
|
@ -122,21 +113,18 @@ class FeatureFlags {
|
|||
disableUrlSharing: FFDefault.disableUrlSharing,
|
||||
enableStripe: FFDefault.enableStripe,
|
||||
enableMissingLocationMigration: FFDefault.enableMissingLocationMigration,
|
||||
enableSearch: FFDefault.enableSearch,
|
||||
);
|
||||
|
||||
final bool disableCFWorker;
|
||||
final bool disableUrlSharing;
|
||||
final bool enableStripe;
|
||||
final bool enableMissingLocationMigration;
|
||||
final bool enableSearch;
|
||||
|
||||
FeatureFlags({
|
||||
@required this.disableCFWorker,
|
||||
@required this.disableUrlSharing,
|
||||
@required this.enableStripe,
|
||||
@required this.enableMissingLocationMigration,
|
||||
@required this.enableSearch,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
|
@ -145,7 +133,6 @@ class FeatureFlags {
|
|||
"disableUrlSharing": disableUrlSharing,
|
||||
"enableStripe": enableStripe,
|
||||
"enableMissingLocationMigration": enableMissingLocationMigration,
|
||||
"enableSearch": enableSearch,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -162,7 +149,6 @@ class FeatureFlags {
|
|||
enableStripe: json["enableStripe"] ?? FFDefault.enableStripe,
|
||||
enableMissingLocationMigration: json["enableMissingLocationMigration"] ??
|
||||
FFDefault.enableMissingLocationMigration,
|
||||
enableSearch: json["enableSearch"] ?? FFDefault.enableSearch,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,14 +84,12 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
|
|||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: FeatureFlagService.instance.enableSearch()
|
||||
? Container(
|
||||
child: Container(
|
||||
color:
|
||||
Theme.of(context).colorScheme.defaultBackgroundColor,
|
||||
height: kContainerHeight,
|
||||
child: const SearchIconWidget(),
|
||||
)
|
||||
: const SizedBox(height: 36, width: 48),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -57,10 +57,11 @@ class NoResultWidget extends StatelessWidget {
|
|||
Container(
|
||||
margin: const EdgeInsets.only(bottom: 20, top: 12),
|
||||
child: Text(
|
||||
'''\u2022 Places (e.g. "London")
|
||||
'''\u2022 Album names (e.g. "Camera")
|
||||
\u2022 Types of files (e.g. "Videos", ".gif")
|
||||
\u2022 Years and months (e.g. "2022", "January")
|
||||
\u2022 Holidays (e.g. "Christmas")
|
||||
\u2022 Album names (e.g. "Recents")''',
|
||||
''',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context)
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:photos/ente_theme_data.dart';
|
||||
import 'package:photos/models/search/search_result.dart';
|
||||
import 'package:photos/services/feature_flag_service.dart';
|
||||
import 'package:photos/services/search_service.dart';
|
||||
import 'package:photos/ui/viewer/search/result/no_result_widget.dart';
|
||||
import 'package:photos/ui/viewer/search/search_suffix_icon_widget.dart';
|
||||
|
@ -196,9 +197,12 @@ class _SearchWidgetState extends State<SearchWidget> {
|
|||
await _searchService.getCollectionSearchResults(query);
|
||||
allResults.addAll(collectionResults);
|
||||
|
||||
final locationResults =
|
||||
await _searchService.getLocationSearchResults(query);
|
||||
allResults.addAll(locationResults);
|
||||
if (FeatureFlagService.instance.isInternalUserOrDebugBuild() &&
|
||||
query.startsWith("l:")) {
|
||||
final locationResults = await _searchService
|
||||
.getLocationSearchResults(query.replaceAll("l:", ""));
|
||||
allResults.addAll(locationResults);
|
||||
}
|
||||
|
||||
final monthResults = await _searchService.getMonthSearchResults(query);
|
||||
allResults.addAll(monthResults);
|
||||
|
|
Loading…
Reference in a new issue